Beispiel #1
0
        public IEnumerator DoTakeDamage(ICombatAggressor aggressor, float delay = 0)
        {
            yield return(new WaitForSecondsRealtime(delay));

            Health.RemovePoints(aggressor.GetDamage().value);
            if (Health.CurrentPoints == 0 && _capsuleCollider != null)
            {
                animatorController.OnDie();
                _capsuleCollider.enabled = false;
            }
        }
 public void TakeDamage(ICombatAggressor aggressor)
 {
     animatorController.OnTakeDamage();
     Health.RemovePoints(aggressor.GetDamage().value);
     if (Health.CurrentPoints == 0)
     {
         animatorController.OnDie();
         var parent = transform.parent;
         parent.GetComponent <NpcMainScript>().enabled            = false;
         parent.GetComponent <NavMeshAgent>().enabled             = false;
         parent.GetChild(0).GetComponent <MeshCollider>().enabled = false;
     }
 }