示例#1
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 <= shipsShotChance)
                    {
                        Vector2 fireLoc = Enemies[x].EnemySprite.Position;
                        fireLoc += Enemies[x].gunOffset;

                        Vector2 ShotDirection = playerManager.Position - fireLoc;

                        ShotDirection.Normalize();

                        EnemyShotManager.FireShot(fireLoc, ShotDirection, false);
                    }
                }
            }
            if (Active)
            {
                updateWaveSpawns(gameTime);
            }
        }
示例#2
0
 private void FireShot()
 {
     if (shotTimer >= minShotTimer)
     {
         PlayerShotManager.FireShot(position + gunOffset, new Vector2(0, -1), true);
         shotTimer = 0.0f;
     }
 }