private void DrawRoom(DTNode r) { int iMin = (int)(r.getNodePosition().x - r.getParentRoom().transform.localScale.x / 2 + 0.5f); int iMax = (int)(r.getNodePosition().x + r.getParentRoom().transform.localScale.x / 2 + 0.5f); int jMin = (int)(r.getNodePosition().y - r.getParentRoom().transform.localScale.y / 2 + 0.5f); int jMax = (int)(r.getNodePosition().y + r.getParentRoom().transform.localScale.y / 2 + 0.5f); for (int i = iMin; i < iMax; i++) { for (int j = jMin; j < jMax; j++) { if (i == iMin || i == iMax - 1 || j == jMin || j == jMax - 1) { if (CheckForTag(new Vector2(i, j), 0.1f, "Floor")) { continue; } else { InstantiateFromArray(wallTiles, i, j); } } else { InstantiateFromArray(floorTiles, i, j); } } } }
public void drawEdge(string name = "") { if (nodeA.getParentRoom() != null && nodeB.getParentRoom() != null) { if (theLine == null) { theLine = new GameObject().AddComponent <LineRenderer>(); theLine.name = "EdgeLine"; theLine.tag = "Line"; } if (name != "") { theLine = new GameObject().AddComponent <LineRenderer>(); theLine.name = name; if (name == "final tri") { theLine.startColor = new Color(255, 0, 0, 1); theLine.endColor = new Color(255, 0, 0, 1); } if (name == "path") { theLine.startColor = new Color(40, 255, 0, 1); theLine.endColor = new Color(40, 255, 0, 1); Debug.Log(theLine.name); Debug.Log(nodeA.getNodePosition().x + " " + nodeA.getNodePosition().y); Debug.Log(nodeB.getNodePosition().x + " " + nodeB.getNodePosition().y); } } theLine.startWidth = 0.7f; theLine.endWidth = 0.7f; //theLine.renderer.material.color = theDrawColor; theLine.startColor = theDrawColor; theLine.endColor = theDrawColor; theLine.positionCount = 2; theLine.SetPosition(0, new Vector3(nodeA.getNodePosition().x, nodeA.getNodePosition().y, -3)); theLine.SetPosition(1, new Vector3(nodeB.getNodePosition().x, nodeB.getNodePosition().y, -3)); } }