private Vector2F velocityPrev; // The player's velocity on the previous frame.

        #endregion Fields

        #region Constructors

        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public PlayerMoveComponent(Player player)
        {
            this.player = player;

            // Default settings.
            autoAccelerate			= false;
            moveSpeedScale			= 1.0f;
            moveCondition			= PlayerMoveCondition.FreeMovement;
            canLedgeJump			= true;
            canJump					= true;
            isStrafing				= false;

            // Internal.
            allowMovementControl	= true;
            moveAxes				= new bool[] { false, false };
            motion					= Vector2F.Zero;
            isMoving				= false;
            velocityPrev			= Vector2F.Zero;
            moveAngle				= Angles.South;
            mode					= new PlayerMotionType();

            // Controls.
            analogMode		= false;
            analogStick		= GamePad.GetStick(Buttons.LeftStick);
            analogAngle		= 0.0f;
            moveButtons		= new InputControl[4];
            moveButtons[Directions.Up]		= Controls.Up;
            moveButtons[Directions.Down]	= Controls.Down;
            moveButtons[Directions.Left]	= Controls.Left;
            moveButtons[Directions.Right]	= Controls.Right;

            // Normal movement.
            moveModeNormal = new PlayerMotionType();
            moveModeNormal.MoveSpeed			= 1.0f;
            moveModeNormal.CanLedgeJump			= true;
            moveModeNormal.CanRoomChange		= true;

            // Slow movement.
            moveModeSlow = new PlayerMotionType();
            moveModeSlow.MoveSpeed				= 0.5f;
            moveModeSlow.CanLedgeJump			= true;
            moveModeSlow.CanRoomChange			= true;

            // Ice movement.
            moveModeIce = new PlayerMotionType();
            moveModeIce.MoveSpeed				= 1.0f;
            moveModeIce.CanLedgeJump			= true;
            moveModeIce.CanRoomChange			= true;
            moveModeIce.IsSlippery				= true;
            moveModeIce.Acceleration			= 0.02f;
            moveModeIce.Deceleration			= 0.05f;
            moveModeIce.MinSpeed				= 0.05f;
            moveModeIce.DirectionSnapCount		= 32;

            // Air/jump movement.
            moveModeAir = new PlayerMotionType();
            moveModeAir.IsStrafing				= true;
            moveModeAir.MoveSpeed				= 1.0f;
            moveModeAir.CanLedgeJump			= false;
            moveModeAir.CanRoomChange			= false;
            moveModeAir.IsSlippery				= true;
            moveModeAir.Acceleration			= 0.1f;
            moveModeAir.Deceleration			= 0.0f;
            moveModeAir.MinSpeed				= 0.05f;
            moveModeAir.DirectionSnapCount		= 8;//32;

            // Water/swim movement.
            moveModeWater = new PlayerMotionType();
            moveModeWater.MoveSpeed				= 0.5f;
            moveModeWater.CanLedgeJump			= true;
            moveModeWater.CanRoomChange			= true;
            moveModeWater.IsSlippery			= true;
            moveModeWater.Acceleration			= 0.08f;
            moveModeWater.Deceleration			= 0.05f;
            moveModeWater.MinSpeed				= 0.05f;
            moveModeWater.DirectionSnapCount	= 32;

            mode = moveModeNormal;
        }
        private PlayerMotionType moveModeWater;                         // For swimming.


        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------

        public PlayerMoveComponent(Player player)
        {
            this.player = player;

            // Default settings.
            autoAccelerate   = false;
            moveSpeedScale   = 1.0f;
            moveCondition    = PlayerMoveCondition.FreeMovement;
            canLedgeJump     = true;
            canJump          = true;
            canPush          = true;
            canUseWarpPoint  = true;
            isStrafing       = false;
            isSprinting      = false;
            sprintTimer      = 0;
            sprintSpeedScale = 1.5f;

            // Internal.
            allowMovementControl = true;
            moveAxes             = new bool[] { false, false };
            motion               = Vector2F.Zero;
            isMoving             = false;
            velocityPrev         = Vector2F.Zero;
            moveAngle            = Angles.South;
            mode                 = new PlayerMotionType();
            jumpStartTile        = -Point2I.One;
            isCapeDeployed       = false;
            doomedToFallInHole   = false;
            holeTile             = null;
            holeDoomTimer        = 0;
            holeSlipVelocity     = Vector2F.Zero;
            fallingInHole        = false;
            isOnColorBarrier     = false;
            isOnSideScrollLadder = false;
            climbCollisionBox    = new Rectangle2F(-1, -7, 2, 9);

            // Controls.
            analogMode  = false;
            analogStick = GamePad.GetStick(Buttons.LeftStick);
            analogAngle = 0.0f;
            moveButtons = new InputControl[4];
            moveButtons[Directions.Up]    = Controls.Up;
            moveButtons[Directions.Down]  = Controls.Down;
            moveButtons[Directions.Left]  = Controls.Left;
            moveButtons[Directions.Right] = Controls.Right;

            // Normal movement.
            moveModeNormal               = new PlayerMotionType();
            moveModeNormal.MoveSpeed     = 1.0f;
            moveModeNormal.CanLedgeJump  = true;
            moveModeNormal.CanRoomChange = true;

            // Slow movement.
            moveModeSlow           = new PlayerMotionType(moveModeNormal);
            moveModeSlow.MoveSpeed = 0.5f;

            // Grass movement.
            moveModeGrass           = new PlayerMotionType(moveModeNormal);
            moveModeGrass.MoveSpeed = 0.75f;

            // Ice movement.
            moveModeIce                    = new PlayerMotionType();
            moveModeIce.MoveSpeed          = 1.0f;
            moveModeIce.CanLedgeJump       = true;
            moveModeIce.CanRoomChange      = true;
            moveModeIce.IsSlippery         = true;
            moveModeIce.Acceleration       = 0.02f;
            moveModeIce.Deceleration       = 0.05f;
            moveModeIce.MinSpeed           = 0.05f;
            moveModeIce.DirectionSnapCount = 32;

            // Air/jump movement.
            moveModeAir                    = new PlayerMotionType();
            moveModeAir.IsStrafing         = true;
            moveModeAir.MoveSpeed          = 1.0f;
            moveModeAir.CanLedgeJump       = false;
            moveModeAir.CanRoomChange      = false;
            moveModeAir.IsSlippery         = true;
            moveModeAir.Acceleration       = 0.1f;
            moveModeAir.Deceleration       = 0.0f;
            moveModeAir.MinSpeed           = 0.05f;
            moveModeAir.DirectionSnapCount = 8;                     //32;

            // Water/swim movement.
            moveModeWater                    = new PlayerMotionType();
            moveModeWater.MoveSpeed          = 0.5f;
            moveModeWater.CanLedgeJump       = true;
            moveModeWater.CanRoomChange      = true;
            moveModeWater.IsSlippery         = true;
            moveModeWater.Acceleration       = 0.08f;
            moveModeWater.Deceleration       = 0.05f;
            moveModeWater.MinSpeed           = 0.05f;
            moveModeWater.DirectionSnapCount = 32;

            mode = moveModeNormal;
        }
        private Vector2F velocityPrev; // The player's velocity on the previous frame.

        #endregion Fields

        #region Constructors

        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public PlayerMoveComponent(Player player)
        {
            this.player = player;

            // Default settings.
            autoAccelerate			= false;
            moveSpeedScale			= 1.0f;
            moveCondition			= PlayerMoveCondition.FreeMovement;
            canLedgeJump			= true;
            canJump					= true;
            canPush					= true;
            canUseWarpPoint			= true;
            isStrafing				= false;
            isSprinting				= false;
            sprintTimer				= 0;
            sprintSpeedScale		= 1.5f;

            // Internal.
            allowMovementControl	= true;
            moveAxes				= new bool[] { false, false };
            motion					= Vector2F.Zero;
            isMoving				= false;
            velocityPrev			= Vector2F.Zero;
            moveAngle				= Angles.South;
            mode					= new PlayerMotionType();
            jumpStartTile			= -Point2I.One;
            isCapeDeployed			= false;
            doomedToFallInHole		= false;
            holeTile				= null;
            holeDoomTimer			= 0;
            holeSlipVelocity		= Vector2F.Zero;
            fallingInHole			= false;
            isOnColorBarrier		= false;
            isOnSideScrollLadder	= false;
            climbCollisionBox		= new Rectangle2F(-1, -7, 2, 9);

            // Controls.
            analogMode		= false;
            analogStick		= GamePad.GetStick(Buttons.LeftStick);
            analogAngle		= 0.0f;
            moveButtons		= new InputControl[4];
            moveButtons[Directions.Up]		= Controls.Up;
            moveButtons[Directions.Down]	= Controls.Down;
            moveButtons[Directions.Left]	= Controls.Left;
            moveButtons[Directions.Right]	= Controls.Right;

            // Normal movement.
            moveModeNormal = new PlayerMotionType();
            moveModeNormal.MoveSpeed			= 1.0f;
            moveModeNormal.CanLedgeJump			= true;
            moveModeNormal.CanRoomChange		= true;

            // Slow movement.
            moveModeSlow = new PlayerMotionType(moveModeNormal);
            moveModeSlow.MoveSpeed = 0.5f;

            // Grass movement.
            moveModeGrass = new PlayerMotionType(moveModeNormal);
            moveModeGrass.MoveSpeed = 0.75f;

            // Ice movement.
            moveModeIce = new PlayerMotionType();
            moveModeIce.MoveSpeed				= 1.0f;
            moveModeIce.CanLedgeJump			= true;
            moveModeIce.CanRoomChange			= true;
            moveModeIce.IsSlippery				= true;
            moveModeIce.Acceleration			= 0.02f;
            moveModeIce.Deceleration			= 0.05f;
            moveModeIce.MinSpeed				= 0.05f;
            moveModeIce.DirectionSnapCount		= 32;

            // Air/jump movement.
            moveModeAir = new PlayerMotionType();
            moveModeAir.IsStrafing				= true;
            moveModeAir.MoveSpeed				= 1.0f;
            moveModeAir.CanLedgeJump			= false;
            moveModeAir.CanRoomChange			= false;
            moveModeAir.IsSlippery				= true;
            moveModeAir.Acceleration			= 0.1f;
            moveModeAir.Deceleration			= 0.0f;
            moveModeAir.MinSpeed				= 0.05f;
            moveModeAir.DirectionSnapCount		= 8;//32;

            // Water/swim movement.
            moveModeWater = new PlayerMotionType();
            moveModeWater.MoveSpeed				= 0.5f;
            moveModeWater.CanLedgeJump			= true;
            moveModeWater.CanRoomChange			= true;
            moveModeWater.IsSlippery			= true;
            moveModeWater.Acceleration			= 0.08f;
            moveModeWater.Deceleration			= 0.05f;
            moveModeWater.MinSpeed				= 0.05f;
            moveModeWater.DirectionSnapCount	= 32;

            mode = moveModeNormal;
        }