public IEnumerator ToEndScene() { var time = 0f; while (time < fadeDuration) { fade.color = Color.Lerp(Color.clear, Color.black, time / fadeDuration); yield return(null); time += Time.deltaTime; } fade.color = Color.black; yield return(generator.trees.ClearTrees()); yield return(generator.ClearDungeon()); dialogue.SetDialogue(endEng, endJpn, endStates); dialogue.ending = true; dialogue.gameObject.SetActive(true); gameplayViz.SetActive(false); time = 0f; while (time < fadeDuration) { fade.color = Color.Lerp(Color.black, Color.clear, time / fadeDuration); yield return(null); time += Time.deltaTime; } fade.color = Color.clear; gameplay.gameObject.SetActive(false); gameplayViz.SetActive(true); fade.raycastTarget = false; }