public void Move()
{
//If mobile is falling or its actions are locked, dont move
if (IsFalling || Mobile.IsActionsLocked)
{
return;
}
//if user pressed left...
if (InputHandler.IsCKDown(Keys.Left))
{
//and is facing right...
if (Mobile.Facing == Facing.Right)
{
Mobile.Flip();
}
//and move to the left
if (IsAbleToMove)// && GameInformation.Instance.IsPlayerTurn)
{
MoveSideways(Mobile.Facing);
}
else
{
Mobile.ChangeFlipbookState(ActorFlipbookState.UnableToMove, true);
Mobile.PlayUnableToMoveSE();
return;
}
}
//if the user pressed right...
else if (InputHandler.IsCKDown(Keys.Right))
{
//and is facing left...
if (Mobile.Facing == Facing.Left)
{
Mobile.Flip();
}
if (IsAbleToMove)// && GameInformation.Instance.IsPlayerTurn)
{
MoveSideways(Mobile.Facing);
}
else
{
Mobile.ChangeFlipbookState(ActorFlipbookState.UnableToMove, true);
Mobile.PlayUnableToMoveSE();
return;
}
}
else
{
IsMoving = false;
}
if ((InputHandler.IsCKUp(Keys.Left) && InputHandler.IsCKUp(Keys.Right)) || !IsAbleToMove)
{
Mobile.ChangeFlipbookState(ActorFlipbookState.Stand);
}
}