Dodging stops working once I take a hit


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.

It has nothing to do with using AppleOS vs Windows…

It’s likely that when you’ve been hit, you’ve entered another state, at which point you’re returned to the FreeLook or Targetting State. You should be able at that point to press the dodge key again.

I found that I subscribed OnDoge to TargetingEvent instead of DodgeEvent. How stupid I am!
Thanks always!

Hardly stupid. These sorts of things happen all the time.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.