void OnUnitDied(EventInfo eventInfo) { // Change this eventinfo into what we need? UnitDeathEventInfo unitDeathInfo = (UnitDeathEventInfo)eventInfo; Debug.Log("Alerted about Unit death: " + unitDeathInfo.UnitDead.name); }
// Update is called once per frame void Update() { if (health <= 0) { UnitDeathEventInfo deathInfo = new UnitDeathEventInfo(); deathInfo.EventDescription = gameObject.name + " was killed by: " + DamagerName; deathInfo.UnitDead = this.gameObject; EventSystemManager.Instance.FireEvent(deathInfo); } }
void Die(EventInfo eventInfo) { UnitDeathEventInfo deathInfo = (UnitDeathEventInfo)eventInfo; if (deathInfo.UnitDead.name == gameObject.name) { if (!SendToPoolOnDeath && DistroyOnDeath) { GameObject.Destroy(this.gameObject); } else if (SendToPoolOnDeath && !DistroyOnDeath && PoolName != "") { //PoolManager.Instance.GetPool(PoolName).AddToPool(this.gameObject); } } }