Beispiel #1
0
        private void OnTriggerEnter(Collider other)
        {
            DamageDealer damage = other.gameObject.GetComponent <DamageDealer>();

            if (damage != null)
            {
                HP.ApplyChange(-damage.DamageAmount);
            }
        }
        private void OnTriggerEnter(Collider other)
        {
            DamageDealer damage = other.gameObject.GetComponent <DamageDealer>();

            if (damage != null)
            {
                HP.ApplyChange(-damage.DamageAmount);
                DamageEvent.Invoke();
            }

            if (HP.Value <= 0.0f)
            {
                DeathEvent.Invoke();
            }
        }