/// <summary> /// this will send the current path stored in this object to the next tile to continue the path /// the paramiter is the next tile (hit by the raycast) /// </summary> /// <param name="tile"></param> /// <returns>will return true on the "recieved ray" returning true from hitting the endtile</returns> public virtual bool sendPath(pathNodes tile) { //if the path list does not contain the next tile add the list to the next tile (binary searching idea) if (!path.Contains(tile.transform.position)) { //clear the tile of the old path from pervious searches tile.path.Clear(); //add the current tile to the list before sending the list on path.Add(transform.position); foreach (var item in path) { //for every location in the path add it to the next tile list tile.path.Add(item); } } //this is on recieving the "recieve Ray" depending on if the path was sucsessful or not if (tile.recieveRay() == true) { return(true); } else { return(false); } }
// Use this for initialization void Start() { Node = this.GetComponent <pathNodes>(); towerData = GameObject.Find("Game Data").GetComponent <towerData>(); towerUI = GameObject.Find("Game Data").GetComponent <UIData>(); start = GameObject.Find("board/start").GetComponent <startNode>(); board = GameObject.Find("board").GetComponent <boardTiles>(); playerData = GameObject.Find("Game Data").GetComponent <PlayerData>(); }