public override void Initialize(string aInstanceId, EntityType aType) { health = maxHealth; inventory = new Inventory(this); OnEntityDamaged.AddListener(EntityDamaged); OnEntityDeath.AddListener(EntityDeath); base.Initialize(aInstanceId, aType); }
public virtual void TakeDamage(float aDamage) { if (health <= 0f) { return; } health -= aDamage; if (health <= 0f) { health = 0f; OnEntityDeath.Invoke(); } OnEntityDamaged.Invoke(aDamage); }