예제 #1
0
    public List <Vector2> SetNewPath(Vector3 newDest)
    {
        List <Vector2> p;
        Vector3        newDestCenterPos = CenterPosition(newDest);
        Vector3        currCenterPos    = CenterPosition(transform.position);

        currDestCenterPosition = newDestCenterPos;

        ClearPathMarker();
        objPosPair = new Dictionary <Vector2, GameObject>();

        p = JumpPointSearch.SearchPath(currCenterPos, newDestCenterPos);
        DrawPath(p);
        return(p);
    }
예제 #2
0
    void Start()
    {
        Vector3 sourceCenterPosition = CenterPosition(transform.position);

        currDestCenterPosition = CenterPosition(bush.transform.position);

        if (path == null || path.Count == 0)
        {
            path = JumpPointSearch.SearchPath(sourceCenterPosition, currDestCenterPosition);

            DrawPath(path);
        }

        lastDestCenterPosition = currDestCenterPosition;
    }