public override void LoadContent()
        {
            base.LoadContent();

            HasCursor = true;

            if (World == null)
            {
                World = new World(new Vector2(0, 20));
            }
            else
            {
                World.Clear();
            }

            if (Camera == null)
            {
                Camera = new Camera2D(ScreenManager.GraphicsDevice);
            }
            else
            {
                Camera.ResetCamera();
            }

            Map = new Map(this, World, ScreenManager);
            var config = new NetPeerConfiguration("xnaapp");

            client = new NetClient(config);
            client.Start();

            config = new NetPeerConfiguration("xnaapp");

            config.AcceptIncomingConnections = true;
            config.EnableMessageType(NetIncomingMessageType.DiscoveryRequest);
            config.Port = port;
            server = new NetServer(config);
            server.Start();

            IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName());
            foreach (IPAddress ip in host.AddressList)
            {
                if (ip.AddressFamily == AddressFamily.InterNetwork)
                {
                    localIP = ip.ToString();
                }
            }

            recipients = new List<NetConnection>();

            // Loading may take a while... so prevent the game from "catching up" once we finished loading
            ScreenManager.Game.ResetElapsedTime();
            Players = new Dictionary<string, Player>();
            Factory = new MinionFactory();
        }
Example #2
0
 public Minion(Side side, Vector2 position, MinionFactory factory)
     : base(side, "Minion")
 {
     _factory = factory;
     Position = position;
 }