public void Patrol() { if (patrol == true) { //for (int i = 0; i < navPoints.Length; i++) { path.CreatePath(this.transform.position, navPoints[0].transform.position); //} } }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { Vector3 mouseworldPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); mouseworldPos.z = 0.0f; path.CreatePath(new Vector3(0.0f, 0.0f, 0.0f), mouseworldPos); } }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { // Get the world position of the user's click Vector3 mouseworldpos = Camera.main.ScreenToWorldPoint(Input.mousePosition); mouseworldpos.z = 0.0f; // Create a path from the 0,0,0 position to the mouseworldpos. path.CreatePath(new Vector3(0.0f, 0.0f, 0.0f), mouseworldpos); // To see this path, turn on DebugDrawPaths on the SimplePathFinding2D component on the Grid GameObject. } }