示例#1
0
    void OnDrawGizmos()
    {
        if (drawCellOutlines)
        {
            Gizmos.color = new Color(0f, 0f, 1f, 0.5f); //semi-transparent blue

            foreach (Vector3Int cell in hash.GetCells())
            {
                Vector3 centre = new Vector3((cell.x * cellSizeX) + (cellSizeX / 2),
                                             (cell.y * cellSizeY) + (cellSizeY / 2),
                                             (cell.z * cellSizeZ) + (cellSizeZ / 2));

                Gizmos.DrawWireCube(centre, cellSize);
            }
        }

        if (drawCellCentres)
        {
            Gizmos.color = new Color(0f, 0f, 1f, 0.8f);

            foreach (Vector3Int cell in hash.GetCells())
            {
                Vector3 centre = new Vector3((cell.x * cellSizeX) + (cellSizeX / 2),
                                             (cell.y * cellSizeY) + (cellSizeY / 2),
                                             (cell.z * cellSizeZ) + (cellSizeZ / 2));

                Gizmos.DrawSphere(centre, 0.25f);
            }
        }

        if (highlightActiveCells)
        {
            Gizmos.color = Color.cyan;

            foreach (Vector3Int cell in hash.GetNonEmptyCells())
            {
                Vector3 centre = new Vector3((cell.x * cellSizeX) + (cellSizeX / 2),
                                             (cell.y * cellSizeY) + (cellSizeY / 2),
                                             (cell.z * cellSizeZ) + (cellSizeZ / 2));

                Gizmos.DrawWireCube(centre, cellSize);
            }
        }
    }
示例#2
0
    void OnRenderObject()
    {
        if (logNumObjsInHash)
        {
            Debug.Log(hash.DEBUG_GetIncludedObjsCount());
        }

        //if (drawCellOutlines && highlightActiveCells) //draw empty cells in blue, draw non-empty cells in cyan
        if (ControlInputs.Instance.drawCellOutlines && ControlInputs.Instance.highlightActiveCells)
        {
            foreach (Vector3Int cell in hash.GetEmptyCells())
            {
                DrawWireCube(GetCellVertices(cell), Color.blue);
            }
            foreach (Vector3Int cell in hash.GetNonEmptyCells())
            {
                DrawWireCube(GetCellVertices(cell), Color.cyan);
            }
        }
        //else if (drawCellOutlines) //draw all cells (empty or non-empty) in blue
        else if (ControlInputs.Instance.drawCellOutlines)
        {
            foreach (Vector3Int cell in hash.GetCells())
            {
                DrawWireCube(GetCellVertices(cell), Color.blue);
            }
        }
        //else if (highlightActiveCells) //draw non-empty cells in cyan
        else if (ControlInputs.Instance.highlightActiveCells)
        {
            foreach (Vector3Int cell in hash.GetNonEmptyCells())
            {
                DrawWireCube(GetCellVertices(cell), Color.cyan);
            }
        }
    }