static void DrawMap(VoxelBuilder target) { var nowHeight = target.GetNowFlowerHeight(); var original = target.transform.position + nowHeight; //畫點 var offsetX = 0.5f * Vector3.right * VoxelBuilder.xUnit; var offsetY = 0.5f * Vector3.forward * VoxelBuilder.yUnit; var offsetXY = offsetX + offsetY; var nowFloorIndex = target.GetNowFloorIndex(); if (!target.IsValidatedFloorIndex(nowFloorIndex)) { return; } var CountY = target.CountY(); var CountX = target.CountX(); for (var y = 0; y < CountY; ++y) { var from = original + offsetXY + offsetY * y; for (var x = 0; x < CountX; ++x) { ChoseColor(target, nowFloorIndex, y, x); Gizmos.DrawSphere(from, PointR); from = from + offsetX; } } }
static void DrawGrid(VoxelBuilder target) { var X = target.GetX(); var Y = target.GetY(); var nowHeight = target.GetNowFlowerHeight(); var original = target.transform.position + nowHeight; //畫直線 var yLine = Y * VoxelBuilder.yUnit * Vector3.forward; var offset = VoxelBuilder.xUnit * Vector3.right; var from = original; for (var x = 1; x <= X + 1; ++x) { Gizmos.DrawLine(from, from + yLine); from = from + offset; } //畫橫線 offset = VoxelBuilder.yUnit * Vector3.forward; var xLine = X * VoxelBuilder.xUnit * Vector3.right;; from = original; for (var y = 1; y <= Y + 1; ++y) { Gizmos.DrawLine(from, from + xLine); from = from + offset; } }