private void OnDrawGizmos() { if (map == null || meshGenerator == null) { return; } SquareGrid squareGrid = meshGenerator.GetSquareGrid(); for (int y = 0; y < squareGrid.height; y++) { for (int x = 0; x < squareGrid.width; x++) { int configuration = squareGrid.GetSquare(x, y).GetConfiguration(); if (squaresDebug) { Gizmos.color = Color.black; if (configuration == configurationNumber) { Gizmos.color = Color.red; } Gizmos.DrawSphere(squareGrid.GetSquare(x, y).GetPosition(), 0.1f); } if (controlNodesDebug) { Gizmos.color = squareGrid.GetSquare(x, y).TopLeft.value == 0 ? Color.white : Color.black; Gizmos.DrawCube(squareGrid.GetSquare(x, y).TopLeft.GetPosition(), Vector3.one * 0.4f); Gizmos.color = squareGrid.GetSquare(x, y).TopRight.value == 0 ? Color.white : Color.black; Gizmos.DrawCube(squareGrid.GetSquare(x, y).TopRight.GetPosition(), Vector3.one * 0.4f); Gizmos.color = squareGrid.GetSquare(x, y).BottomRight.value == 0 ? Color.white : Color.black; Gizmos.DrawCube(squareGrid.GetSquare(x, y).BottomRight.GetPosition(), Vector3.one * 0.4f); Gizmos.color = squareGrid.GetSquare(x, y).BottomLeft.value == 0 ? Color.white : Color.black; Gizmos.DrawCube(squareGrid.GetSquare(x, y).BottomLeft.GetPosition(), Vector3.one * 0.4f); } if (sideNodesDebug) { Gizmos.color = Color.green; Gizmos.DrawCube(squareGrid.GetSquare(x, y).TopCenter.GetPosition(), Vector3.one * 0.1f); Gizmos.DrawCube(squareGrid.GetSquare(x, y).RightCenter.GetPosition(), Vector3.one * 0.1f); Gizmos.DrawCube(squareGrid.GetSquare(x, y).BottomCenter.GetPosition(), Vector3.one * 0.1f); Gizmos.DrawCube(squareGrid.GetSquare(x, y).LeftCenter.GetPosition(), Vector3.one * 0.1f); } } } }
private void GenerateConfigurationNumberDebug() { SquareGrid squareGrid = meshGenerator.GetSquareGrid(); for (int y = 0; y < squareGrid.height; y++) { for (int x = 0; x < squareGrid.width; x++) { int configuration = squareGrid.GetSquare(x, y).GetConfiguration(); Vector3 position = squareGrid.GetSquare(x, y).GetPosition(); GameObject go = Instantiate(DebugNumberPrefab, position, Quaternion.Euler(new Vector3(90, 0, 0))); go.GetComponent <TextMesh> ().text = configuration.ToString(); } } }
public MeshGenerator(Map map) { squareGrid = new SquareGrid(map); }