示例#1
0
        public virtual void Attack()
        {
            // FLYSPAWN LOOP
            SpawnTimer.UpdateTimer();
            // Every X seconds, spawn some enemies.
            if (SpawnTimer.Test())
            {
                // Spawn 3 flies
                for (int i = 0; i < 3; i++)
                {
                    Level.CurrentRoom.Add(new Fly(new Vector2(Position.X - 25 + (25 * i), Position.Y)));
                }
                // Restart the thing.
                SpawnTimer.ResetToZero();
            }

            // ATTACK LOOP
            AttackTimer.UpdateTimer();
            // Every X seconds, attack the player
            if (AttackTimer.Test())
            {
                // Spawn 3 projectiles
                for (int i = 0; i < 3; i++)
                {
                    Globals.sounds.PlaySoundEffectOnce("EnemyAttack");
                    Level.CurrentRoom.Add(new EnemyAttack(Globals.Vector2ToDegrees(Level.Player.Position - Position) - 25 + (i * 25), Position));
                }
                // Restart the thing.
                AttackTimer.ResetToZero();
            }
        }