public void Update(MiniUziBullet[] MiniUziBullets, Hero Player, int NumberOfPlayersLeft, Zombie[] Zombies, int NumberOfZombies, int NumberOfZombiesKilled, Vector2 scrollOffset)
        {
            numberOfZombies = NumberOfZombies;
            numberOfZombiesKilled = NumberOfZombiesKilled;

            foreach (MiniUziBullet miniUziBullet in MiniUziBullets)
            {
                if (miniUziBullet.alive)
                {
                    //this actually moves the bullet across the screen
                    miniUziBullet.position += miniUziBullet.velocity;

                    if (Vector2.Distance(Player.position + scrollOffset, miniUziBullet.position + scrollOffset) > 1200.0f)
                    {
                        miniUziBullet.alive = false;
                        continue;
                    }
                    else
                    {
                        foreach (Zombie zombie in Zombies)
                        {
                            if (zombie.alive)
                            {
                                miniUziBullet.CheckForCollision(Player, zombie, NumberOfZombies, NumberOfZombiesKilled, scrollOffset);

                                if (miniUziBullet.collision)
                                {
                                    numberOfZombies = miniUziBullet.numberOfZombies;
                                    numberOfZombiesKilled = miniUziBullet.numberOfZombiesKilled;

                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void LoadBullets(Character playerCharacter)
 {
     #region Sayid Bullets
     if (playerCharacter == Character.Sayid)
     {
         for (int i = 0; i < numberOfminiUziBullets; i++)
         {
             miniUziBullets[i] = new MiniUziBullet(ScreenManager.Game.Content.Load<Texture2D>("Sprites\\Players\\Sayid\\Bullet\\miniUziBullet"));
         }
     }
     #endregion
     #region Sir Edward Bullets
     if (playerCharacter == Character.Sir_Edward)
     {
         for (int i = 0; i < numberOfm4Bullets; i++)
         {
             m4Bullets[i] = new M4Bullet(ScreenManager.Game.Content.Load<Texture2D>("Sprites\\Players\\Sir_Edward\\Bullet\\m4Bullet"));
         }
     }
     #endregion
     #region Wilhelm Bullets
     if (playerCharacter == Character.Wilhelm)
     {
         for (int i = 0; i < numberOfg36cBullets; i++)
         {
             g36cBullets[i] = new G36CBullet(ScreenManager.Game.Content.Load<Texture2D>("Sprites\\Players\\Wilhelm\\Bullet\\g36cBullet"));
         }
     }
     #endregion
     #region Juan Bullets
     if (playerCharacter == Character.Juan)
     {
         for (int i = 0; i < numberOfshotgunBullets; i++)
         {
             shotgunBullets[i] = new ShotgunBullet(ScreenManager.Game.Content.Load<Texture2D>("Sprites\\Misc\\shotgunEffectBullet"));
         }
     }
     #endregion
 }
Exemplo n.º 3
0
        public override void LoadContent()
        {
            if (ScreenManager.Game.Content == null)
                ScreenManager.Game.Content = new ContentManager(ScreenManager.Game.Services, "Content");

            redRectangle = ScreenManager.Game.Content.Load<Texture2D>("Sprites\\Misc\\redRectangle");

            players = new Hero[NumberOfPlayers];
            playerHalos = new OtherObject[NumberOfPlayers];

            shotgunBullets = new ShotgunBullet[numberOfshotgunBullets];
            miniUziBullets = new MiniUziBullet[numberOfminiUziBullets];
            m4Bullets = new M4Bullet[numberOfm4Bullets];
            g36cBullets = new G36CBullet[numberOfg36cBullets];

            zombies = new Zombie[MaxZombies];

            for (int i = 0; i < NumberOfPlayers; i++)
            {

                //Load the texture data from the Sprite folder depending on who the player is
                #region Texture Data
                if (PlayerCharacters[i] == Character.Sayid)
                {
                    players[i] = new Hero(ScreenManager.Game.Content.Load<Texture2D>("Sprites\\Players\\Sayid\\Images\\Sayid"));
                    playerHalos[i] = new OtherObject(ScreenManager.Game.Content.Load<Texture2D>("Sprites\\Players\\Sayid\\Halo\\Sayid-Halo"));
                }
                if (PlayerCharacters[i] == Character.Sir_Edward)
                {
                    players[i] = new Hero(ScreenManager.Game.Content.Load<Texture2D>("Sprites\\Players\\Sir_Edward\\Images\\Sir_Edward"));
                    playerHalos[i] = new OtherObject(ScreenManager.Game.Content.Load<Texture2D>("Sprites\\Players\\Sir_Edward\\Halo\\Sir_Edward-Halo"));
                }
                if (PlayerCharacters[i] == Character.Wilhelm)
                {
                    players[i] = new Hero(ScreenManager.Game.Content.Load<Texture2D>("Sprites\\Players\\Wilhelm\\Images\\Wilhelm"));
                    playerHalos[i] = new OtherObject(ScreenManager.Game.Content.Load<Texture2D>("Sprites\\Players\\Wilhelm\\Halo\\Wilhelm-Halo"));
                }
                if (PlayerCharacters[i] == Character.Juan)
                {
                    players[i] = new Hero(ScreenManager.Game.Content.Load<Texture2D>("Sprites\\Players\\Juan\\Images\\Juan"));
                    playerHalos[i] = new OtherObject(ScreenManager.Game.Content.Load<Texture2D>("Sprites\\Players\\Juan\\Halo\\Juan-Halo"));
                }

                #endregion
                //give a position for the player to start out at
                #region Position
                //bottom left first
                players[i].position = new Vector2(players[i].sprite.Width * xSignedPosition + (totalFieldWidth / 2), players[i].sprite.Height * ySignedPosition + (totalFieldHeight / 2));
                if (xSignedPosition == -1 && ySignedPosition == -1)
                {
                    //then bottom right
                    xSignedPosition *= -1;
                }
                else if (xSignedPosition == 1 && ySignedPosition == -1)
                {
                    //then top right
                    ySignedPosition *= -1;
                }
                else if (xSignedPosition == 1 && ySignedPosition == 1)
                {
                    //then top left
                    xSignedPosition *= -1;
                }
                #endregion
                //give the correct health for the player depending on the handicap
                #region Health
                if (players[i].playerHandicap == Handicap.Easy)
                {
                    players[i].health = 20;
                }
                else if (players[i].playerHandicap == Handicap.Medium)
                {
                    players[i].health = 15;
                }
                else if (players[i].playerHandicap == Handicap.Hard)
                {
                    players[i].health = 10;
                }
                else if (players[i].playerHandicap == Handicap.VeryHard)
                {
                    players[i].health = 5;
                }
                //reference giving origina2 health for sca2e factoring 2ater
                players[i].fullHealth = players[i].health;
                #endregion

                players[i].playerCharacter = PlayerCharacters[i];
                players[i].playerHandicap = PlayerHandicaps[i];
                players[i].triggerSensitivity = sen[i];
                LoadBullets(players[i].playerCharacter);
                players[i].LoadUpBulletManager();

            }

            #region Zombies
            for (int i = 0; i < MaxZombies; i++)
            {
                zombies[i] = new Zombie(ScreenManager.Game.Content.Load<Texture2D>("Sprites\\Zombies\\Images\\zombie1(1)"));
            }
            #endregion

            healthBar = ScreenManager.Game.Content.Load<Texture2D>("Sprites\\Misc\\HealthBar");

            gameBackgroundTexture = ScreenManager.Game.Content.Load<Texture2D>("Background\\GrassBackground");

            Active = true;

            //sleep for a little so the game can load
            Thread.Sleep(1000);
            //resets so xbox doesnt try to catch up with lost time in thread
            ScreenManager.Game.ResetElapsedTime();
        }