예제 #1
0
 void EnableOrDisableMenu(bool menu_is_on)
 {
     menu_is_shown = menu_is_on;
     menu.SetActive(menu_is_shown);
     if (menu_is_shown)
     {
         DungeonMaster.Pause();
     }
     else
     {
         DungeonMaster.Resume();
     }
 }
예제 #2
0
    public IEnumerator FadeToBlackAndRestart(int level)
    {
        AudioSource audio = GetComponent <AudioSource>();

        audio.Play(); // why doesn't this work inside the coroutine?

        float start_t = Time.realtimeSinceStartup;
        float end_t   = GetComponent <AudioSource>().clip.length + start_t;

        while (Time.realtimeSinceStartup < end_t)
        {
            screen_canvas.GetComponent <Image>().color = Color.Lerp(Color.clear, Color.black, Time.realtimeSinceStartup - start_t);
            yield return(null);
        }
        DungeonMaster.Resume();
        SceneManager.LoadScene(level);
    }