public Path ( Vector3 startPos, Vector3 targetPos, float zDiff = -1 ) : List |
||
startPos | Vector3 | |
targetPos | Vector3 | |
zDiff | float | |
return | List |
/// <summary> /// Sets the target node path to travel to the clicked node /// </summary> void SetTarget() { path = control.Path(currNode, target); currNode.GetComponent <NodeProperties>().setVisited(true); currNode.GetComponent <NodeProperties>().addToInventory(); nodeIndex = 0; onNode = true; }
// Update is called once per frame // void Update () { // // //finder.velocity = Vector2.right; // hits = Physics2D.LinecastAll (finder.position, target.position,layerMask); // // if(hits.Length>0){ // Debug.Log (hits.Length); // for (int i = 0; i < hits.Length; i++) { // Debug.Log (hits [i].transform.name); // if (hits [i].transform.name != target.name) { // // } // } // } // // // } // void Update () { // // //finder.velocity = Vector2.right; // hit = Physics2D.Linecast (finder.position+finderBound, target.position,layerMask); // // if(hit){ // //Debug.Log (hit.transform.name); // if (hit.transform.name == target.name) { // Debug.DrawLine (transform.position, hit.transform.position,Color.blue); // // } else { // Debug.DrawLine (transform.position, hit.transform.position,Color.red); // Transform[] childs = hit.transform.gameObject.GetComponentsInChildren<Transform>(); // for (int i = 0; i < childs.Length; i++) { // Vector2 nodePos= new Vector2(childs[i].position.x,childs[i].position.y); // RaycastHit2D cantSee = (Physics2D.Linecast (finder.position+finderBound, childs[i].position)); // Debug.Log(childs[i].tag); // if(childs[i].CompareTag("Node")&& !cantSee){ // Debug.DrawLine (finder.position, childs[i].transform.position, Color.cyan); // } // } // // } // // } // } void Update() { Debug.Log("Calling Path"); path = control.Path(finder, target, layerName); if (path == null) { Debug.Log("No Path Found"); } else { for (int i = 0; i < path.Count - 1; i++) { Debug.Log(path.Count); DrawPath(path [i], path [i + 1], Color.blue); } } }
private void SetTarget() { _path = ControllNode.Path(transform.position, _target); _nodeIndex = 0; _onNode = true; }
private void SetTarget() { path = control.Path(transform.position, m_target); nodeIndex = 0; onNode = true; }
private void SetTarget() { path = control.Path(transform.position, m_target); //this calls the Path method from NodeControl and assigns the list of vector3 positions to path attribute nodeIndex = 0; onNode = true; }