public class PlayerControl : MonoBehaviour
{
float Speed = 125f;
void FixedUpdate()
{
transform.Rotate(0, 0, Speed * Time.deltaTime);
}
public void ChangeDirection()
{
Speed = -Speed;
}
public void PauseMovement() <---- Pointer Down
{
Speed = 0f;
}
public void Boost()
{
Speed = 330f * Mathf.Sign(Speed);
}
public void NormalSpeed() <----- Pointer Up
{
Speed = 125f * Mathf.Sign(Speed);
}
}
I press a button on a trigger event as pointer down, my player stops moving and when i release the button, it resumes as per normal. This works but not as how i intended, when i want my player to resume, i want it to resume the direction it last went. Like if it rotates to the left, it will continue on the left. Right now, it last rotates on the left, it continues on the right. Please advice?
FixedUpdate
to only Rotate when you are not paused or multiply it in your rotate function (0 for paused, 1 for not paused). \$\endgroup\$