private void WanderAround() { AStar.OnBlockedPath -= OnBlockedPath; AStar.OnFoundPath -= OnFoundPath; AStar.OnBlockedPath += OnBlockedPath; AStar.OnFoundPath += OnFoundPath; finalPath = AStar.FindPath(new Vector2(transform.position.x, transform.position.z), map.FindUnblockedSpace()); if (finalPath != null) { finalPathArray = new Node[finalPath.Count]; finalPath.CopyTo(finalPathArray); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); cAmStar myScript = (cAmStar)target; if (GUILayout.Button("Random start/target")) { myScript.RandomlyPositionStartAndTarget(); } if (GUILayout.Button("Find path")) { myScript.ClearMap(); myScript.FindPath(); } }
private void WanderAround() { AStar.OnBlockedPath -= OnBlockedPath; AStar.OnFoundPath -= OnFoundPath; AStar.OnBlockedPath += OnBlockedPath; AStar.OnFoundPath += OnFoundPath; // Coroutine visualise AStar.FindPath(new Vector2(transform.position.x, transform.position.z), map.FindUnblockedSpace()); // Instant // finalPath = AStar.FindPath(new Vector2(transform.position.x, transform.position.z), map.FindUnblockedSpace()); // finalPathArray = new Node[finalPath.Count]; // finalPath.CopyTo(finalPathArray); }