Beispiel #1
0
 public Room(string roomId, Peer creator, int maxPlayers)
 {
     this.maxPlayer = maxPlayers;
     this.roomId = roomId;
     this.Creator = creator;
     this.members = new List<Peer>();
 }
Beispiel #2
0
        // increment the currentPlayer value
        private void NextPlayer()
        {
            if(teamA.FindIndex(fpeer => fpeer.IsAlive == true) == -1)
            {
                return;
            }

            if (teamB.FindIndex(fpeer => fpeer.IsAlive == true) == -1)
            {
                return;
            }

            if (teamA.FindIndex(fpeer => fpeer == currentPlayer) >= 0)
            {
                do
                {
                    idxB = (idxB + 1) % teamB.Count;
                    currentPlayer = teamB[idxB];
                    if (currentPlayer.IsAlive)
                    {
                        break;
                    }
                }
                while (!currentPlayer.IsAlive);
            }
            else if (teamB.FindIndex(fpeer => fpeer == currentPlayer) >= 0)
            {
                do
                {
                    idxA = (idxA + 1) % teamA.Count;
                    currentPlayer = teamA[idxA];
                    if (currentPlayer.IsAlive)
                    {
                        break;
                    }
                }
                while (!currentPlayer.IsAlive);
            }
            clock = TimeSpan.Zero;
        }
Beispiel #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        public void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            device = graphics.GraphicsDevice;

            // linking variable backgroundTexture to an img named "background"
            backgroundTexture = Content.Load<Texture2D>("bg_blue");

            // array of CariageTexture
            carriageTexture[0] = Content.Load<Texture2D>("P1");
            carriageTexture[1] = Content.Load<Texture2D>("P2");
            carriageTexture[2] = Content.Load<Texture2D>("P3");
            carriageTexture[3] = Content.Load<Texture2D>("P4");
            carriageTexture[4] = Content.Load<Texture2D>("P5");
            carriageTexture[5] = Content.Load<Texture2D>("P6");
            carriageTexture[6] = Content.Load<Texture2D>("P7");
            carriageTexture[7] = Content.Load<Texture2D>("P8");

            cannonTexture = Content.Load<Texture2D>("cannon");

            playerScaling = 50.0f / (float)carriageTexture[0].Width;

            font = Content.Load<SpriteFont>("myFont");

            rocketTexture = Content.Load<Texture2D>("rocket");
            smokeTexture = Content.Load<Texture2D>("smoke");
            groundTexture = Content.Load<Texture2D>("ground");
            exitTexture = Content.Load<Texture2D>("Images\\Lobby\\Exit");

            GenerateTerrainContour();
            SetUpPlayers();
            FlattenTerrainBelowPlayers();
            CreateForeground();

            currentPlayer = teamA[0];
            rocketColorArray = TextureTo2DArray(rocketTexture);
            carriageColorArray = TextureTo2DArray(currentPlayer.CarriageTexture);
            cannonColorArray = TextureTo2DArray(cannonTexture);
            // TODO: use this.Content to load your game content here
        }