public void OnPostRender() { if (TileData == null || conversion == null) { return; } GLDrawUtil.Begin(); //GLDrawUtil.DrawLine(new Vector2(-5, -5), new Vector2(5, 5), Color.red); int mapSizeX = TileData.MapSize.x; int mapSizeY = TileData.MapSize.y; for (int x = 0; x < mapSizeX; x++) { Color colorForDrawRight = Color.black; if (x % 5 == 0) { colorForDrawRight = Color.red; } for (int y = 0; y < mapSizeY; y++) { Color colorForDrawDown = Color.black; if (y % 5 == 0) { colorForDrawDown = Color.red; } var tileHeight = TileData.TileHeightMap[x, y]; var startPos = conversion.GetCenterPosFromIdx(new Vector2Int(x, y), tileHeight); if (x < mapSizeX - 1) { var rightTileHeight = TileData.TileHeightMap[x + 1, y]; var rightPos = conversion.GetCenterPosFromIdx(new Vector2Int(x + 1, y), rightTileHeight); GLDrawUtil.DrawLine(startPos, rightPos, colorForDrawDown); // Debug.LogFormat("DrawTile X={0} Y={1} {2}:{3}", x, y, startPos, rightPos); } if (y < mapSizeY - 1) { var bottomTileHeight = TileData.TileHeightMap[x, y + 1]; var bottomPos = conversion.GetCenterPosFromIdx(new Vector2Int(x, y + 1), bottomTileHeight); GLDrawUtil.DrawLine(startPos, bottomPos, colorForDrawRight); // Debug.LogFormat("DrawTile X={0} Y={1} {2}:{3}", x, y, startPos, bottomPos); } } } GLDrawUtil.End(); }
public void OnPostRender() { var bottomLeft = GetWorldPos(new Vector3(0, 0, 0)); var bottomRight = GetWorldPos(new Vector3(Screen.width, 0, 0)); var topLeft = GetWorldPos(new Vector3(0, Screen.height, 0)); var topRight = GetWorldPos(new Vector3(Screen.width, Screen.height, 0)); bottomLeft += new Vector3(0, 10, 0); bottomRight += new Vector3(0, 10, 0); topLeft += new Vector3(0, 10, 0); topRight += new Vector3(0, 10, 0); GLDrawUtil.Begin(); GLDrawUtil.DrawLine(bottomLeft, topLeft, Color.yellow); GLDrawUtil.DrawLine(topLeft, topRight, Color.yellow); GLDrawUtil.DrawLine(topRight, bottomRight, Color.yellow); GLDrawUtil.DrawLine(bottomRight, bottomLeft, Color.yellow); GLDrawUtil.End(); }