Example #1
0
        public override SpaceBuilder Align(IntVector2 direction, int amount)
        {
            if (direction == Directions.Up)
            {
                _top.Y      = amount;
                _alignment  = ShaftAlignment.StartFromTop; // We have to enforce this boundary
                _isUncapped = true;                        // We shouldn't spawn blocks here, as it may be clamped by another space or chunk
            }
            else if (direction == Directions.Right)
            {
                _bottom.X = amount - _width;
                _middle.X = amount - _width;
                _top.X    = amount - _width;
            }
            else if (direction == Directions.Down)
            {
                _bottom.Y  = amount;
                _alignment = ShaftAlignment.StartFromBottom; // We have to enforce this boundary
            }
            else if (direction == Directions.Left)
            {
                _bottom.X = amount;
                _middle.X = amount;
                _top.X    = amount;
            }

            Rebuild();

            return(this);
        }
Example #2
0
        public ShaftBuilder SetStartingPoint(IntVector2 startingPoint, ShaftAlignment alignment)
        {
            switch (alignment)
            {
            case ShaftAlignment.StartFromTop: _top = startingPoint; break;

            case ShaftAlignment.StartFromMiddle: _middle = startingPoint; break;

            case ShaftAlignment.StartFromBottom: _bottom = startingPoint; break;
            }

            _alignment = alignment;

            Rebuild();
            return(this);
        }