I don’t know why but the dodging doesn’t work after I take a hit by the enemy.
This is very weird bug. I think I wrote the same code as the instructor did.
And the code actually works perfectly until I am hit.
I tried to debug by adding debuggers here and there.
What I found is once I take a hit, the code never goes into the following logic (though the remainingDodgeTime is greater than 0.)
private Vector3 CalculateMovement(float deltaTime)
{
Vector3 movement = new Vector3();
if (remainingDodgeTime > 0f)
{
movement += stateMachine.transform.right * dodgingDirectionInput.x * stateMachine.DodgeLength / stateMachine.DodgeDuration;
movement += stateMachine.transform.forward * dodgingDirectionInput.y * stateMachine.DodgeLength / stateMachine.DodgeDuration;
remainingDodgeTime = Mathf.Max(remainingDodgeTime - deltaTime, 0f);
}
… omitted
I recently switched to Apple Silicon from Windows. Could this have to do with this issue??
Looking forward to your advice. Thanks in advance.