コード例 #1
0
        public void Update(GameTime gameTime)
        {
            EnemyShotManager.Update(gameTime);

            for (int i = Enemies.Count - 1; i >= 0; i--)
            {
                Enemies[i].Update(gameTime);
                if (Enemies[i].IsActive() == false)
                {
                    Enemies.RemoveAt(i);
                }
                else
                {
                    if ((float)rand.Next(0, 1000) / 10 <= shipShotChance)
                    {
                        Vector2 fireLoc = Enemies[i].EnemySprite.Position;
                        fireLoc += Enemies[i].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;
     }
 }