public void EnemyDie() { EnemyDeathEvent enemyDeathEventInfo = new EnemyDeathEvent(); enemyDeathEventInfo.Description = "Actor " + gameObject.name + " has died."; enemyDeathEventInfo.enemy_go = gameObject; enemyDeathEventInfo.FireEvent(); Destroy(gameObject); }
void OnDestroy() { PlayerDeathEvent.UnregisterListener(OnPlayerDeath); EnemyDeathEvent.UnregisterListener(OnEnemyDeath); TileDeathEvent.UnregisterListener(OnTileDeath); }
void OnEnemyDeath(EnemyDeathEvent enemyDeath) { //When the enemy dies a new crystal is spawned Instantiate(CrystalToSpawn, enemyDeath.enemy_go.transform.position, Quaternion.identity); }
// Use this for initialization void Start() { PlayerDeathEvent.RegisterListener(OnPlayerDeath); EnemyDeathEvent.RegisterListener(OnEnemyDeath); TileDeathEvent.RegisterListener(OnTileDeath); }