private IEnumerator CriticalHitRoutine() { WerewolfAnimator.ReceiveHitMedium(); WerewolfSoundBank.PlayCriticalHitSound(Random.Range(0.8f, 1.0f)); AiController.Wait(1.0f); yield return(new WaitForSeconds(0.5f)); _protectiveMode = true; WerewolfAnimator.StartProtecting(); var wasRunning = Motor.IsRunning; if (wasRunning) { Motor.Walk(); } yield return(new WaitForSeconds(4.0f)); WerewolfAnimator.StopProtecting(); _protectiveMode = false; if (wasRunning) { Motor.Run(); } }
public override void ReceiveHit(Damage damage) { if (_protectiveMode) { damage.Reduce(ProtectiveModifier); } base.ReceiveHit(damage); if (HitPoints > 0) { if (damage.Total < CriticalHitThreshold) { WerewolfAnimator.ReceiveHitLight(); WerewolfSoundBank.PlayHitSound(); } else { StartCoroutine(CriticalHitRoutine()); } } }