Ejemplo n.º 1
0
        /// <summary>
        /// Gizmo for debuging a cell.
        /// </summary>
        /// <param name="index">The index of the cell.</param>
        /// <param name="grid">The grid it belongs</param>
        /// <param name="color">Color of the gizmo.</param>
        /// <param name="offsetSize"> The scale amount add to the grid size cell.</param>
        public static void DebugCell(Vector3Int index, Grid3D grid, Color color, float offsetSize = 0.01f)
        {
            if (grid == null)
            {
                return;
            }
            Gizmos.color = color;
            TypeGrid3D typegrid = grid.GetTypeGrid();

            switch (typegrid)
            {
            case TypeGrid3D.Cube:
            {
                Gizmos.DrawWireCube(grid.GetPositionCell(index), Vector3.one * (grid.SizeCell + offsetSize));
            }
            break;

            case TypeGrid3D.Hexagonal:
            {
                Gizmos.DrawMesh(ProceduralMesh.GetHexagonMesh(), grid.GetPositionCell(index), Quaternion.identity, Vector3.one * (grid.SizeCell + offsetSize));
            }
            break;

            default:
                throw new ArgumentException("No type implemented " + typegrid.ToString() + " inherit Grid3D");
            }
        }