public void PlayAttackAnimation(PlayerControl.AttackAnimationSetting[] attackArray, ref bool isCanAttack) { if (baseAI.isAttacking || baseAI.isUsingSpecialAttack) { return; } randomNumber = Random.Range(0, attackArray.Length); while (randomNumber == currentIndex) { randomNumber = Random.Range(0, attackArray.Length); } currentIndex = randomNumber; if (baseAI.isTakingDamage || baseAI.isTakingDamageBIG || baseAI.isDeath) { return; } if (baseAI.isBlockImpact || baseAI.isBlockImpactBIG || baseAI.isBlockImpactAIR || baseAI.isRolling || baseAI.isDodging) { return; } if (isCanAttack == false) { return; } if (!isThisTheBestTimeToAttack) { return; } if (baseAI.isBlocking) { baseAI.isBlocking = false; } if (baseAI.animator.GetLayerWeight(baseAI.animator.GetLayerIndex("Attack")) != 1.0f) { baseAI.animator.SetLayerWeight(baseAI.animator.GetLayerIndex("Attack"), 1.0f); } baseAI.animator.Play(attackArray[currentIndex].animationName); currentAnimation = attackArray[currentIndex]; if (currentAnimation.damageTiming2 != 0) { isFirstHit = true; isSecondHit = true; } else { isFirstHit = true; isSecondHit = false; } baseAI.isAttacking = true; sw.Restart(); damaging = true; }
public void PlayAttackAnimation(PlayerControl.AttackAnimationSetting animationName, ref bool isCanAttack) { if (baseAI.isAttacking || baseAI.isUsingSpecialAttack) { return; } if (baseAI.isTakingDamage || baseAI.isTakingDamageBIG || baseAI.isDeath) { return; } if (baseAI.isBlockImpact || baseAI.isBlockImpactBIG || baseAI.isBlockImpactAIR || baseAI.isRolling || baseAI.isDodging) { return; } if (isCanAttack == false) { return; } if (!isThisTheBestTimeToAttack) { return; } if (baseAI.isBlocking) { baseAI.isBlocking = false; } if (baseAI.animator.GetLayerWeight(baseAI.animator.GetLayerIndex("Attack")) != 1.0f) { baseAI.animator.SetLayerWeight(baseAI.animator.GetLayerIndex("Attack"), 1.0f); } baseAI.animator.Play(animationName.animationName); currentAnimation = animationName; if (currentAnimation.damageTiming2 != 0) { isFirstHit = true; isSecondHit = true; } else { isFirstHit = true; isSecondHit = false; } baseAI.isAttacking = true; sw.Restart(); damaging = true; }
public void PlayTimer(PlayerControl.AttackAnimationSetting animationInfo) { currentAnimation = animationInfo; if (currentAnimation.damageTiming2 != 0) { isFirstHit = true; isSecondHit = true; } else { isFirstHit = true; isSecondHit = false; } damaging = true; sw.Restart(); baseAI.isAttacking = true; }