Exemplo n.º 1
0
    public IEnumerator <Coroutine> FindPathAndMove(TriCell target, bool entityCheck, bool terrainCheck)
    {
        TriGrid inst = TriGrid.Instance;

        if (target && IsValidDestination(target))
        {
            inst.FindPath(Location, target, entityCheck, terrainCheck);
            if (inst.HasPath)
            {
                pathToTravel = inst.GetPath();
                CancelNowAct();
                yield return(nowRoutine = StartCoroutine(TravelPath()));

                inst.ClearPath();
                ActResult = true;
            }
            else
            {
                ActResult = false;
            }
        }
        else
        {
            inst.ClearPath();
            ActResult = false;
        }
        yield return(null);
    }