Beispiel #1
0
    public void OnEnable()
    {
        mapLocation = GameObject.Find("Main Camera").GetComponent <HeuristicMap>();
        float xpos      = transform.localPosition.x + mapLocation.fieldLength / 2;
        float ypos      = transform.localPosition.y + mapLocation.fieldHeight / 2;
        float heuristic = mapLocation.nodeHeuristic[(int)xpos, (int)ypos];

        if (heuristic != 0f)
        {
            Vector2 destination = nextMove((int)xpos, (int)ypos);
            mapLocation.pathFind(destination, transform.parent.transform);
        }
    }
Beispiel #2
0
 public void pathHere()
 {
     mapLocation.pathFind(transform.localPosition, transform.parent);
 }