示例#1
0
    IEnumerator ReloadGame(float delay)
    {
        yield return(new WaitForSecondsRealtime(1f));

        BGMPlayer.ClearAll();
        canTakeDamage = false;
        prestarted    = false;

        Destroy(currentLevel);
        currentLevel   = Instantiate(menuScene);
        currentLevelNo = -1;

        FindObjectOfType <ProgressManager>().ClearProgress();
        FindObjectOfType <interactManager>().Clear();

        yield return(new WaitForSecondsRealtime(delay));

        mainCamera.SetActive(false);
        rb2D.gameObject.SetActive(false);
        rb2D.gameObject.SetActive(true);
        rb2D.position             = menuStartPos;
        rb2D.bodyType             = RigidbodyType2D.Kinematic;
        confiner.m_BoundingVolume = currentLevel.GetComponent <LevelHolder>().confiner3d;
        mainCamera.SetActive(true);

        title.GetComponent <Animator>().SetBool("open", true);
        startText.SetActive(true);
        //BGMPlayer.PlaySpecifiedBGM("B08", 0.1f, 0.1f);
        move.RestartGame();
        move.SetActive(true);
        animPlayer.SetBool("started", false);
        animPlayer.SetTrigger("fall");
        startTime      = Time.realtimeSinceStartup;
        Time.timeScale = 0.5f;
        black.GetComponent <Animator>().SetBool("black", false);
    }