WithState() public method

public WithState ( SlabState state ) : Slab
state SlabState
return Slab
Example #1
0
        private void SmoothSlope(int x, int y)
        {
            MarbleBiome.Slab slab = this._slabs[x, y];
            if (!slab.IsSolid)
            {
                return;
            }
            bool isSolid  = this._slabs[x, y - 1].IsSolid;
            bool flag     = this._slabs[x, y + 1].IsSolid;
            bool isSolid1 = this._slabs[x - 1, y].IsSolid;
            bool flag1    = this._slabs[x + 1, y].IsSolid;

            switch ((isSolid ? 1 : 0) << 3 | (flag ? 1 : 0) << 2 | (isSolid1 ? 1 : 0) << 1 | (flag1 ? 1 : 0))
            {
            case 4:
            {
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.HalfBrick));
                return;
            }

            case 5:
            {
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.BottomRightFilled));
                return;
            }

            case 6:
            {
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.BottomLeftFilled));
                return;
            }

            case 7:
            case 8:
            {
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.Solid));
                return;
            }

            case 9:
            {
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.TopRightFilled));
                return;
            }

            case 10:
            {
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.TopLeftFilled));
                return;
            }

            default:
            {
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.Solid));
                return;
            }
            }
        }
Example #2
0
        private void SmoothSlope(int x, int y)
        {
            MarbleBiome.Slab slab = this._slabs[x, y];
            if (!slab.IsSolid)
            {
                return;
            }
            switch ((this._slabs[x, y - 1].IsSolid ? 1 : 0) << 3 | (this._slabs[x, y + 1].IsSolid ? 1 : 0) << 2 | (this._slabs[x - 1, y].IsSolid ? 1 : 0) << 1 | (this._slabs[x + 1, y].IsSolid ? 1 : 0))
            {
            case 4:
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.HalfBrick));
                break;

            case 5:
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.BottomRightFilled));
                break;

            case 6:
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.BottomLeftFilled));
                break;

            case 9:
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.TopRightFilled));
                break;

            case 10:
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.TopLeftFilled));
                break;

            default:
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.Solid));
                break;
            }
        }
Example #3
0
        // Token: 0x06000FAE RID: 4014 RVA: 0x003F7584 File Offset: 0x003F5784
        private void SmoothSlope(int x, int y)
        {
            MarbleBiome.Slab slab = this._slabs[x, y];
            if (!slab.IsSolid)
            {
                return;
            }
            bool arg_6B_0 = this._slabs[x, y - 1].IsSolid;
            bool isSolid  = this._slabs[x, y + 1].IsSolid;
            bool isSolid2 = this._slabs[x - 1, y].IsSolid;
            bool isSolid3 = this._slabs[x + 1, y].IsSolid;

            switch ((arg_6B_0 ? 1 : 0) << 3 | (isSolid ? 1 : 0) << 2 | (isSolid2 ? 1 : 0) << 1 | (isSolid3 ? 1 : 0))
            {
            case 4:
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.HalfBrick));
                return;

            case 5:
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.BottomRightFilled));
                return;

            case 6:
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.BottomLeftFilled));
                return;

            case 9:
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.TopRightFilled));
                return;

            case 10:
                this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.TopLeftFilled));
                return;
            }
            this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.Solid));
        }