public override void Death() { base.Death(); gameObject.SetActive(false); if (activeEnemies.Count == 0 && Player.currentDangerArea != null) { Player.currentDangerArea.IsDefeated = true; } AudioClip deathSound = GameManager.GetSingleton <AudioManager>().deathSounds[Random.Range(0, GameManager.GetSingleton <AudioManager>().deathSounds.Length)]; SoundEffect soundEffect = GameManager.GetSingleton <AudioManager>().PlaySoundEffect(GameManager.GetSingleton <AudioManager>().deathSoundEffectPrefab, new SoundEffect.Settings(deathSound)); DeathSoundEffect deathSoundEffect = soundEffect as DeathSoundEffect; deathSoundEffect.killer = GameManager.GetSingleton <Player>(); }
public override void Death() { base.Death(); GameManager.paused = true; AudioClip deathSound = GameManager.GetSingleton <AudioManager>().deathSounds[Random.Range(0, GameManager.GetSingleton <AudioManager>().deathSounds.Length)]; SoundEffect soundEffect = GameManager.GetSingleton <AudioManager>().PlaySoundEffect(GameManager.GetSingleton <AudioManager>().deathSoundEffectPrefab, new SoundEffect.Settings(deathSound)); DeathSoundEffect deathSoundEffect = soundEffect as DeathSoundEffect; deathSoundEffect.killer = GameManager.GetSingleton <Enemy>(); // for (int i = 0; i < EventManager.events.Count; i ++) // EventManager.events[i].time = Mathf.Infinity; EventManager.events.Clear(); Enemy.enemiesInArea = new Enemy[0]; Trap.trapsInArea = new Trap[0]; ConveyorBelt.conveyorBeltsInArea = new ConveyorBelt[0]; SaveAndLoadManager.lastUniqueId = SaveAndLoadManager.INIT_LAST_UNIQUE_ID; GameManager.GetSingleton <GameOverScreen>().Open(); }