SEToolbox.Interop.Asteroids.MyVoxelContentCell.CheckCellType C# (CSharp) Method

CheckCellType() private method

private CheckCellType ( ) : void
return void
        void CheckCellType()
        {
            //  Voxel cell content sum isn't in allowed range. Probably increased or descreased too much.
            Debug.Assert((this._voxelContentSum >= 0) && (this._voxelContentSum <= MyVoxelConstants.VOXEL_CELL_CONTENT_SUM_TOTAL));

            if (this._voxelContentSum == 0)
            {
                this.CellType = MyVoxelCellType.EMPTY;
                this._voxelFullCells = 0;
                this._voxelPartCells = 0;
                this._voxelEmptyCells = MyVoxelConstants.VOXEL_DATA_CELL_SIZE_IN_VOXELS_TOTAL;
            }
            else if (_voxelContentSum == MyVoxelConstants.VOXEL_CELL_CONTENT_SUM_TOTAL)
            {
                this.CellType = MyVoxelCellType.FULL;
                this._voxelFullCells = MyVoxelConstants.VOXEL_DATA_CELL_SIZE_IN_VOXELS_TOTAL;
                this._voxelPartCells = 0;
                this._voxelEmptyCells = 0;
            }
            else
            {
                this.CellType = MyVoxelCellType.MIXED;
            }

            //  If cell changed from MIXED to EMPTY or FULL, we will release it's cell content because it's not needed any more
            if (this.CellType == MyVoxelCellType.EMPTY || this.CellType == MyVoxelCellType.FULL)
            {
                this.Deallocate();
            }
        }