public static bool HoldableCanEnterPipe(Entity entity, Direction direction) { Holdable holdable = entity?.Get <Holdable>(); if (holdable != null && !holdable.IsHeld) { Vector2 speed = holdable?.SpeedGetter() ?? Vector2.Zero; switch (direction) { case Direction.Left: return(speed.X > 0); case Direction.Right: return(speed.X < 0); case Direction.Up: return(speed.Y > 0); case Direction.Down: return(speed.Y < 0); default: return(false); } } return(false); }