private void CreateDebugTile(Vector3 worldPos, Color32 color, Node node = null) { GameObject debugTile = Instantiate(debugTilePrefab, worldPos, Quaternion.identity); if (node != null) { DebugTile tmp = debugTile.GetComponent <DebugTile>(); tmp.G.text += node.G; tmp.H.text += node.H; tmp.F.text += node.F; } debugTile.GetComponent <SpriteRenderer>().color = color; }
private void CreateDebugTIle(Vector3 worldPos, Color32 color, Node node = null) //set to null to make it optional { GameObject debugTile = Instantiate(debugTilePrefab, worldPos, Quaternion.identity); if (node != null) { DebugTile tmp = debugTile.GetComponent <DebugTile>(); //only have to get debug tile component once to save resources tmp.G.text += node.G; tmp.H.text += node.H; tmp.F.text += node.F; } debugTile.GetComponent <SpriteRenderer>().color = color; }
/// <summary> /// Creates a debug tile in the world /// </summary> /// <param name="worldPos">The tile's world position</param> /// <param name="color">The color of the tile</param> /// <param name="node">The actual node</param> private void CreateDebugTile(Vector3 worldPos, Color32 color, Node node = null) { //Instantiates a debug tile GameObject debugTile = (GameObject)Instantiate(debugTilePrefab, worldPos, Quaternion.identity); if (node != null)//If the tile has a node { //Then we need to calculate all the values DebugTile tmp = debugTile.GetComponent <DebugTile>(); tmp.G.text += node.G; tmp.H.text += node.H; tmp.F.text += node.F; } //Sets the color of the tile debugTile.GetComponent <SpriteRenderer>().color = color; }