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; }
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; }