// Removes the stun status of the player after a set duration IEnumerator RemoveStun(float stunDuration) { yield return(new WaitForSeconds(stunDuration)); // Remove stun status currentState = combat.CurrentAction.move; // Visual / Audio if (stunEffect) { stunEffect.SetActive(false); } }
// Sets the player's state to be stunned, forcing it to skip its update step. Auto resolved by coroutine public void StunPlayer(float stunDuration) { if (currentState == combat.CurrentAction.stun) { return; } // Stun player StopPlayer(); currentState = combat.CurrentAction.stun; // Visual/Audio StartCoroutine(RemoveStun(stunDuration)); anim.SetTrigger("Stun"); if (stunEffect) { stunEffect.SetActive(true); } // Drop orb if they have it if (hasVictoryOrb) { RemoveVictoryOrb(); } }