IEnumerator DodgeRoll() { playerCombat.DodgeAttackCancel(); //Cancel attacks with dodgeRoll DisableMove(); abilityUI.StartCooldown(dodgeCD); playerCombat.canAttack = false; //in case of AttackCancel playerCombat.isAttacking = false; m_rolling = true; playerCombat.canStunPlayer = false; animator.SetBool("isRolling", true); animator.SetTrigger("Roll"); rb.velocity = new Vector2(m_facingDirection * m_rollForce, rb.velocity.y); allowDodge = Time.time + dodgeCD; //setting cooldown yield return(new WaitForSeconds(dodgeTime)); //dodge duration EnableMove(); animator.SetBool("isRolling", false); playerCombat.canAttack = true; //in case of AttackCancel m_rolling = false; //DELETE: if still using AE_ResetRoll in animation event playerCombat.canStunPlayer = true; }
IEnumerator Parry() // stop player movement during animation { if (movement.isGrounded) { movement.canMove = false; } animator.SetBool("isAttacking", true); isAttacking = true; ParryAttack(); // hit enemies and check if they can be parried movement.rb.velocity = new Vector2(0, 0); AltAttacking = true; allowAltAttack = Time.time + altAttackCD; abilityUI.StartCooldown(altAttackCD); yield return(new WaitForSeconds(altAttackTime)); // parry attack time movement.canMove = true; isAttacking = false; animator.SetBool("isAttacking", false); }