Пример #1
0
 void CheckHex(IOccupant o)
 {
     if (o != null && o is Ball)
     {
         ((Ball)o).Receive(this);
     }
 }
Пример #2
0
 public static SurrogateForIOccupant Convert(IOccupant value)
 {
     if (value == null)
     {
         return(null);
     }
     return(new SurrogateForIOccupant {
         Target = ((OccupantRef)value).Target
     });
 }
Пример #3
0
    IEnumerator MoveCoroutine(Hex destHex)
    {
        moving = true;

        if (onMoveBegan != null)
        {
            onMoveBegan(this);
        }

        HideMovementHexes();

        AStarPath p = new AStarPath(GridManager.Instance.Grid, currentHex, destHex, true);

        Hex next;

        Hex current = CurrentHex;

        destOccupant = destHex.Occupant;
        CurrentHex   = destHex;

        while (p.IsNextHex())
        {
            next = p.GetNextHex();

            CheckHex(next.Occupant);

            if (movesInActionRemaining >= next.MoveCost)
            {
                yield return(StartCoroutine(MoveToHex(current, next)));
            }

            current = next;
        }

        onMoveComplete(this);

        if (UserControlManager.Instance.Selected == this)
        {
            ShowMovementHexes();
        }

        moving = false;
    }