Пример #1
0
    private IEnumerator IE_finding(LinkE s, LinkE e)
    {
        if (isFindPass)
        {
            yield break;
        }

        yield return(new WaitForSeconds(FindDeltT));

        LinkE linkE = null;

        Map[s.R, s.C] = false; //设为已走过
        GameObject gameobject = GameObject.Instantiate(GameControl._Instance.cube_green);

        gameobject.transform.position = new Vector3(GetX(s.C), 0, GetZ(s.R));



        if (s.EqualTo(e))
        {
            isFindPass = true;
            yield break;
        }

        while ((linkE = GetNextE(s)) != null)
        {
            yield return(mono.StartCoroutine(IE_finding(linkE, e)));

            if (isFindPass)
            {
                s.Next = linkE;
                yield break;
            }
        }
        GameObject.Destroy(gameobject);

        yield return(null);
    }
Пример #2
0
    private bool FindingPath(LinkE s, LinkE e)
    {
        LinkE linkE = null;

        Map[s.R, s.C] = false; //设为已走过


        if (s.EqualTo(e))
        {
            return(true);
        }

        while ((linkE = GetNextE(s)) != null)
        {
            bool bo = FindingPath(linkE, e);
            if (bo)
            {
                s.Next = linkE;
                return(true);
            }
        }

        return(false);
    }