Ejemplo n.º 1
0
    public void AttackMode(ICellRange range)
    {
        if (_canAttack)
        {
            if (_selectedCells != null)
            {
                foreach (var cell in _selectedCells)
                {
                    cell.Unhighlight();
                }
            }

            //Please don't look at this
            if (UnitType == UnitType.SOLDIER)
            {
                _selectedCells = range.GetCellsInRange(Position, MaxRange, true);
            }
            else if (UnitType == UnitType.SNIPER)
            {
                _selectedCells = range.GetCellsInLineRange(Position);
            }

            foreach (var cell in _selectedCells)
            {
                cell.Highlight();
            }
        }
    }
Ejemplo n.º 2
0
 public void Attack(Unit u, ICellRange range)
 {
     if (_canAttack && u.Player != Player)
     {
         List <Cell> cellsInRange = null;
         if (UnitType == UnitType.SOLDIER)
         {
             cellsInRange = range.GetCellsInRange(Position, MaxRange, true);
         }
         else if (UnitType == UnitType.SNIPER)
         {
             cellsInRange = range.GetCellsInLineRange(Position);
         }
         if (cellsInRange.Contains(u.Position))
         {
             StartCoroutine(Attack(u, 0.6f));
             _canAttack    = false;
             _currentRange = 0;
         }
     }
 }