public static void DrawCubeField(CubeField cubeField) { var xCount = cubeField.points.GetLength(0); var yCount = cubeField.points.GetLength(1); var zCount = cubeField.points.GetLength(2); var xStart = -(xCount / 2f) + 0.5f; var yStart = -(yCount / 2f) + 0.5f; var zStart = -(zCount / 2f) + 0.5f; var gizmoColour = Color.white; var nodeValMinMax = cubeField.GetNodeMinMaxValues(); var nodeValMin = nodeValMinMax[0]; var nodeValMax = nodeValMinMax[1]; for (int x = 0; x < xCount; x++) { for (int y = 0; y < yCount; y++) { for (int z = 0; z < zCount; z++) { var point = cubeField.points[x, y, z]; if (point >= cubeField.GroundLevel) { var clampedValue = Mathf.InverseLerp(nodeValMin, nodeValMax, point); gizmoColour = new Color(clampedValue, clampedValue, clampedValue); Gizmos.color = gizmoColour; Gizmos.DrawSphere(new Vector3(xStart + x, yStart + y, zStart + z), cubeFieldNodeRadius); } } } } }
private void OnDrawGizmos() { if (soloCubeField == null) { soloCubeField = new CubeField(); } GizmoRenderer.DrawCubeField(soloCubeField); }
public override void InitDreamscape() { dreamscape = new CubeField(structure); dreamscape.gameObject.transform.parent = this.gameObject.transform; }
public CubeNode(CubeField parent, float value) { Parent = parent; Value = value; }
public CubeFieldAI(CubeField c) : base(c) { cubeField = c; }