예제 #1
0
 private void FireShot()
 {
     if (shotTimer >= minShotTimer)
     {
         PlayerShotManager.FireShot(
             playerSprite.Location + gunOffset,
             new Vector2(0, -2),
             true);
         shotTimer = 0.0f;
     }
 }
예제 #2
0
        public void Update(GameTime gameTime)
        {
            EnemyShotManager.Update(gameTime);

            for (int x = Enemies.Count - 1; x >= 0; x--)
            {
                Enemies[x].Update(gameTime);
                if (Enemies[x].IsActive() == false)
                {
                    Enemies.RemoveAt(x);
                }
                else
                {
                    if ((float)rand.Next(0, 1000) / 10 <= shipShotChance)
                    {
                        Vector2 fireLoc = Enemies[x].EnemySprite.Location;
                        fireLoc += Enemies[x].gunOffset;

                        Vector2 shotDirection =
                            playerManager.playerSprite.Center -
                            fireLoc;

                        shotDirection.Normalize();

                        EnemyShotManager.FireShot(
                            fireLoc,
                            shotDirection,
                            false);
                    }
                }
            }

            if (Active)
            {
                updateWaveSpawns(gameTime);
            }
        }