public override IEnumerator WaitToDie(float time) { fadeMusic.StartFadeOut(fadeMusic.GetComponent <AudioSource>(), 3f); yield return(new WaitForSeconds(time / 2)); float pauseEndTime = Time.realtimeSinceStartup + time / 2; while (Time.realtimeSinceStartup < pauseEndTime) { float a = spriteRenderer.color.a - Time.deltaTime; spriteRenderer.color = new Color(originalColor.r, originalColor.g, originalColor.b, a); yield return(0); } PlayerData data = SaveSystem.LoadPlayer(); SaveSystem.SavePlayer(data.activePlayerIdData, data.currentSpawnPointIdData, data.healthData, data.maxHealthData, 0, data.obtainedPlayersNameData, data.doorsClosed); pm.GetComponent <PlayerManegerScript>().checkMana(); levelLoader.GetComponent <SceneManeger>().ReloadScene(); }
public void PlayButton() { fadeMusic.StartFadeOut(fadeMusic.GetComponent <AudioSource>(), 3f); StartCoroutine(PlayButtonCoroutine()); }