Example #1
0
        private void DetectWallInHorizontalDirectionOfTravel(float velocity)
        {
            bool onWall = false;

            Humper.Base.RectangleF detectionSpot = Box.Bounds;
            detectionSpot.Offset(velocity >= 0 ? 0.02f : -0.02f, 0f);


            var detection = this.World.Hit(Box.Bounds, detectionSpot, ignoreSelf);

            if (detection != null)
            {
                if (detection.Box.HasTag(HumperColliderTags.World))
                {
                    onWall = true;
                }
            }

            Owner.Collider.OnWall = onWall;
        }
Example #2
0
        private void DetectGroundUnderFeet()
        {
            bool onGround = false;

            Humper.Base.RectangleF detectionSpot = Box.Bounds;
            detectionSpot.Offset(0, -0.01f * Owner.Movement.GravityModifier);


            var detection = this.World.Hit(Box.Bounds, detectionSpot, ignoreSelf);

            if (detection != null)
            {
                if (detection.Box.HasTag(HumperColliderTags.World))
                {
                    onGround = true;
                }
            }

            Owner.Collider.OnGround = onGround;
        }