void TakeDamage(MapSystem.Tile _tile) { TileDamageEvent tileDamageEventInfo = new TileDamageEvent(); tileDamageEventInfo.Description = "Actorr] " + gameObject.name + " has taken damage."; tileDamageEventInfo.tile_go = gameObject; tileDamageEventInfo.FireEvent(); }
void OnTileDamaged(TileDamageEvent tileDamage) { Debug.Log("I hear " + tileDamage.tile_go.name + " has taken damage - Report from the DamageListener"); }
// Use this for initialization void Start() { PlayerDamageEvent.RegisterListener(OnPlayerDamaged); EnemyDamageEvent.RegisterListener(OnEnemyDamaged); TileDamageEvent.RegisterListener(OnTileDamaged); }
void OnDestroy() { PlayerDamageEvent.UnregisterListener(OnPlayerDamaged); EnemyDamageEvent.UnregisterListener(OnEnemyDamaged); TileDamageEvent.UnregisterListener(OnTileDamaged); }