Ejemplo n.º 1
0
    public void Test()
    {
        FindPath.Instance().SetDestination(new Vector3(-18, -6));
        Waypoint next = FindPath.Instance().DoStep(FindPath.Instance().GetCurrentWaypoint(this.transform.position));

        Debug.Log(next.gameObject);
        transform.position = next.transform.position;
    }
Ejemplo n.º 2
0
 void Update()
 {
     if (!LevelManager.Instance().clickLocked)
     {
         if (Input.GetMouseButtonDown(0) && GameObject.FindObjectOfType <ContextMenu>() == null)
         {
             FindPath.Instance().SetDestination(Camera.main.ScreenToWorldPoint(Input.mousePosition));
         }
         if (FindPath.Instance().HasDestination())
         {
             if (nextDestination == transform.position && FindPath.Instance().HasDestination())
             {
                 nextDestination = FindPath.Instance().DoStep(FindPath.Instance().GetCurrentWaypoint(transform.position)).transform.position;
                 GoToNextPoint();
             }
         }
     }
 }