Nez.Portable/ECS/Components/Physics/TiledMapMover.cs
/// <summary>
/// gets a collision rect for the given side expanded to take into account motion
/// </summary>
/// <returns>The rect for side.</returns>
/// <param name="side">Side.</param>
/// <param name="motion">Motion.</param>
gets a collision rect for the given side expanded to take into account motion
gets a collision rect for the given side expanded to take into account motion
Rectangle collisionRectForSide(Edge side, int motion)
        {
            Rectangle bounds;
            if (side.isHorizontal())
                bounds = _boxColliderBounds.getRectEdgePortion(side);
            else
                bounds = _boxColliderBounds.getHalfRect(side);
            if (side.isVertical())
                RectangleExt.contract(ref bounds, colliderHorizontalInset, 0);
            else
                RectangleExt.contract(ref bounds, 0, colliderVerticalInset);
            RectangleExt.expandSide(ref bounds, side, motion);
            return bounds;
        }
Rectangle collisionRectForSide ( Edge side , int motion ) { Rectangle bounds ; if ( side . isHorizontal ( ) ) bounds = _boxColliderBounds . getRectEdgePortion ( side ) ; else bounds = _boxColliderBounds . getHalfRect ( side ) ; if ( side . isVertical ( ) ) RectangleExt . contract ( ref bounds , colliderHorizontalInset , 0 ) ; else RectangleExt . contract ( ref bounds , 0 , colliderVerticalInset ) ; RectangleExt . expandSide ( ref bounds , side , motion ) ; return bounds ; }
gets a collision rect for the given side expanded to take into account motion
gets a collision rect for the given side expanded to take into account motion
// for horizontal collision checks we use just a sliver for our bounds. Vertical gets the half rect so that it can properly push // up when intersecting a slope which is ignored when moving horizontally. // we contract horizontally for vertical movement and vertically for horizontal movement // finally expand the side in the direction of movement
The rect for side.
The rect for side .
side
Edge
None
motion
int
None