public void CreateMinion(Tower tower)
        {
            if (ActiveMinions[tower.Side].Count(m => !m.IsDisposed) >= MaxMinions) return;

            var minion = new Minion(tower.Side, tower.Position +
                new Vector2(ConvertUnits.ToSimUnits(SpawnOffsetX*(tower.Side == Side.Heart?-1:1)),
                    ConvertUnits.ToSimUnits(SpawnOffsetY)), this);

            minion.Died += (s, e) => RemoveMinion(minion);
            ActiveMinions[tower.Side].Add(minion);
        }
Пример #2
0
 public virtual void Attack(Tower tower)
 {
     if (_timeSinceLastAttack < AttackTime + AttackDelay) return;
     if ((Direction < 0 && tower.Position.X - Position.X < 0) || (Direction > 0 && tower.Position.X - Position.X > 0) &&
         Math.Abs(Position.X - tower.Position.X) < AttackRange)
     {
         _timeSinceLastAttack = 0;
         Action = "attack";
         tower.Hurt(AttackDamage);
     }
 }