public void MouseDownLeftClick() { PathFinder.node block = new PathFinder.node((int)transform.position.x, (int)transform.position.z); Debug.Log("set block"); PathFinder.m_instance.SetNodeAsBusy(block.X, block.Y); m_originalColor = Color.black; m_rend.material.color = m_originalColor; }
// find a path a change the color of the jump points( for debug purposses) private void FindPath(PathFinder.node s, PathFinder.node g) { PathFinder.m_instance.ResetTable(); List <PathFinder.node> list = PathFinder.m_instance.FindPath(s, g); if (list != null) { foreach (PathFinder.node i in list) { m_map[i.X, i.Y].GetComponent <Renderer>().material.color = Color.red; } } }
// set start tile, goal tile and find a path public void SetClick(PathFinder.node n) { for (int i = 0; i < width; ++i) { for (int j = 0; j < height; ++j) { m_map[i, j].GetComponent <tile>().ResetColor(); } } if (numClick % 2 == 0) { start = n; } else { goal = n; FindPath(start, goal); } numClick++; }
public void MouseDownRightClick() { PathFinder.node thisNode = new PathFinder.node((int)transform.position.x, (int)transform.position.z); GameTable.m_instance.SetClick(thisNode); }