Beispiel #1
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            AssetsManager.LoadContent(Content);
            connection.Start();

            System.Diagnostics.Debug.WriteLine("Sent Init");
            Random  rand = new Random();
            Vector2 vec  = new Vector2(rand.Next(800), 300);

            lock (Players)
            {
                Players.Add(connection.peerID, (myPlayer = new Player(connection.peerID, vec)));
            }
            Message msg = new Message();

            msg.msgCode       = Message.INIT;
            msg.playerPos0    = vec;
            msg.PeerID        = connection.peerID;
            msg.playerTexture = myPlayer.getPlayerTextureNumber();
            connection.SendBroadCastMessage(msg.Construct());

            myPlayer.setIsCurrentPlayer(true);
            System.Diagnostics.Debug.WriteLine("Sent Init");

            if (IsCreator)
            {
                WhoseTurn = connection.peerID;
                myPlayer.setFire(false);
            }
        }
Beispiel #2
0
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            AssetsManager.Initialize();

            graphics.PreferredBackBufferWidth  = 900;
            graphics.PreferredBackBufferHeight = 540;
            base.Initialize();
        }