Example #1
0
    public void ClickUnit(MBUnit unit)
    {
        MapCoordinate pos = units.Get(unit);

        switch (State)
        {
        case ControlState.DESELECTED:
        case ControlState.UNIT_MENU:
            MoveCursorTo(pos);
            OpenUnitMenu();
            break;

        case ControlState.UNIT_ATTACK:
            MoveCursorTo(pos);
            GetSelected().Attack(unit.Unit);
            CloseRangeSelection();
            CloseUnitMenu();
            break;

        default:
            break;
        }
    }
Example #2
0
 public void RegisterUnit(MBUnit unit)
 {
     Units[unit.Unit.Faction].Add(unit);
 }
Example #3
0
 public bool IsSelected(MBUnit unit)
 {
     return(selected != null && units.Get(selected) == unit);
 }
Example #4
0
 private void MoveUnit(MBUnit unit, List <MapCoordinate> path)
 {
     units.Remove(unit);
     units.Add(unit, path[path.Count - 1]);
     unit.Move(path);
 }