Пример #1
0
        public override void Update(GameTime gameTime)
        {
            if (target != null && !IsInRange(target.Center))
                target = null;
            bulletTimer += 0.05f;

            base.Update(gameTime);
        }
Пример #2
0
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>   Attacks enemies. </summary>
 ///
 /// <remarks>   Frost, 16.11.2010. </remarks>
 ///
 /// <param name="enemy">    The enemy. </param>
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 public void Attack(Enemy enemy)
 {
     if (IsInRange(enemy.Center))
     {
         attacking = true;
         target = enemy;
     }
 }
Пример #3
0
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>   Slows enemy. </summary>
 ///
 /// <remarks>   Frost, 16.11.2010. </remarks>
 ///
 /// <param name="enemy">    The enemy. </param>
 /// <param name="slowness"> The slowness. </param>
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 public void slowEnemy(Enemy enemy, float slowness)
 {
     currentSpeed = enemy.Speed;
     if (currentSpeed >= 0.35f)
     {
         newSpeed = currentSpeed * slowness;
         enemy.Speed = newSpeed;
     }
 }
Пример #4
0
        private void SetUpEnemies()
        {
            for (int i = 0; i < numOfEnemies; i++)
            {
                if (timer >= 10)
                {
                    float currentHealth = 0;
                    int bountyGiven = 0;
                    float speed = 0.5f;

                    if ((waveNumber + 1) % 5 != 0 && (waveNumber + 1) % 6 != 0) // Normal
                    {
                        currentHealth = 50 * (waveNumber + 1);

                        if ((waveNumber + 1) < 10)
                            bountyGiven = 1;
                        else if ((waveNumber + 1) < 20)
                            bountyGiven = 2;
                        else if ((waveNumber + 1) < 30)
                            bountyGiven = 3;
                        else if ((waveNumber + 1) < 40)
                            bountyGiven = 4;
                        else if ((waveNumber + 1) < 50)
                            bountyGiven = 5;
                        else if ((waveNumber + 1) < 60)
                            bountyGiven = 6;
                        else if ((waveNumber + 1) < 70)
                            bountyGiven = 7;

                        speed = 0.5f;
                    }

                    else if ((waveNumber + 1) % 5 == 0 && (waveNumber + 1) % 6 != 0) // Boss
                    {
                        currentHealth = 80 * (waveNumber + 1);
                        bountyGiven = 25 * ((waveNumber + 1) / 5);
                        speed = 0.25f;
                    }

                    else if ((waveNumber + 1) % 5 != 0 && (waveNumber + 1) % 6 == 0) // Fast
                    {
                        currentHealth = 45 * (waveNumber + 1);
                        bountyGiven = 2;
                        speed = 1f;
                    }

                    Enemy enemy = new Enemy(enemyTexture, startLocation,
                        new Queue<Vector2>(waypoints), currentHealth, bountyGiven,speed);

                    enemies.Add(enemy);
                    timer = 0;
                    enemiesSpawned++;
                }
            }
        }