void HandleDamage(GameObject obj, int amount) { Damageable dam = obj.GetComponent <Damageable>(); if (dam) { dam.ChangeHealth(-amount); } else { Debug.Log(obj.name + " was scheduled for damage calculations but doesn't have a damageable component."); } }
void HandleDamage(GameObject obj, int amount) { Damageable dam = obj.GetComponent <Damageable>(); if (obj.gameObject.name == "Player") { app.NotifyAnimation(AnimationMessage.TRIGGER, obj, "damage"); } if (dam) { dam.ChangeHealth(-amount); } else { Debug.Log(obj.name + " was scheduled for damage calculations but doesn't have a damageable component."); } }