Ejemplo n.º 1
0
    public IEnumerator UpdateUnit(CombatUnit unit)
    {
        HexCell nextMove = null;

        if (unit.CurrentStance == CombatUnit.Stance.UNASSIGNED)
        {
            AssignStance(unit);
        }

        nextMove = GetNextMove(unit);

        if (!nextMove)
        {
            nextMove = unit.Behaviour.Patrol(cityState.GetCity().GetHexCell(), 2);
        }

        if (!nextMove || nextMove == unit.HexUnit.Location)
        {
            unit.EndTurn();
        }
        else
        {
            unit.SetPath(nextMove);
            while (unit.AttackUnit && unit.HexUnit.pathToTravel != null && unit.HexUnit.pathToTravel.Count != 0)
            {
                yield return(new WaitForFixedUpdate());
            }
        }
    }