Example #1
0
 public void TakeDamage(Enemy enemy)
 {
     if (!starwhalPowerActive && !NarlyGame.lairdMode)
     {
         health -= 2 * projectileDamage * enemy.Health;
         takingDamage = true;
         NarlyGame.rumble.damageRumbleTimer = 0.75f;
     }
     //Debug.WriteLine("Damage!");
 }
Example #2
0
 public void LockOnEnemy(Enemy enemy)
 {
     lockedEnemy = enemy;
 }
 public void AddEnemy(Enemy enemy)
 {
     enemiesToAdd.Add(enemy);
 }
 public void RemoveEnemy(Enemy enemy)
 {
     enemiesToRemove.Add(enemy);
 }
Example #5
0
        public static Enemy Create(Game game, GameColors gameColor)
        {
            released = false;
            if (unusedEnemies[(int)gameColor] == null)
            {
                unusedEnemies[(int)gameColor] = new Queue<Enemy>();
            }
            else if (unusedEnemiesToRelease[(int)gameColor] != null)
            {
                foreach (var enemy in unusedEnemiesToRelease[(int)gameColor])
                {
                    if (enemy.ToRelease)
                    {
                        unusedEnemies[(int)gameColor].Enqueue(enemy);
                    }
                    else
                    {
                        enemy.ToRelease = true;
                    }
                }
                unusedEnemiesToRelease[(int)gameColor] = (from enemy in unusedEnemiesToRelease[(int)gameColor]
                                                        where !enemy.ToRelease
                                                        select enemy).ToList();
            }

            if (unusedEnemies[(int)gameColor].Count > 0)
            {
                Enemy enemy = unusedEnemies[(int)gameColor].Dequeue();
                enemy.renderColor = GameColorsUtilities.GetSystemColor(gameColor);
                enemy.IsAlive = true;
                enemy.particleSystem.On = false;
                enemy.IsDying = false;
                enemy.enteredScreen = false;
                enemy.lastVelocity = Vector3.Zero;
                enemy.health = 5;
                enemy.time = 0;
                enemy.timeToFire = 0;
                enemy.takingDamage = false;
                enemy.damageRollAngle = 0;
                enemy.damageRollAngle2 = 0;
                enemy.damageRollCounter = 0;
                enemy.position = Vector3.Zero;
                enemy.ToRelease = false;
                return enemy;
            }
            else
            {
                Enemy enemy = new Enemy(game, gameColor);
                enemy.Initialize();
                return enemy;
            }
        }