コード例 #1
0
    // Cross-initialize.
    void Start()
    {
        // If this hasn't run yet.
        if (instance == null)
        {
            instance = this;

            // Load the main (required) scene if it is not loaded.
            if (!GameStateLoader.IsLoaded("main"))
            {
                GameStateLoader.LoadSceneAsync("main");
            }
            // Else if it is loaded and it's the only scene loaded.
            else if (SceneManager.sceneCount == 1)
            {
                // Load the title scene.
                GameStateLoader.LoadSceneAsync("title");
            }
        }
        else
        {
            // Destroy this game object.
            Destroy(gameObject);
        }
    }
コード例 #2
0
    public void OnClickPlay()
    {
        // Unload the title scene.
        GameStateLoader.UnloadSceneAsync("title");

        // Load the game scene.
        GameStateLoader.LoadSceneAsync("game");
    }
コード例 #3
0
    public void OnClickMenu()
    {
        // Resume.
        Resume();

        // Quit to the main menu.
        GameStateLoader.UnloadSceneAsync("pause-menu");
        GameStateLoader.UnloadSceneAsync("game");
        GameStateLoader.LoadSceneAsync("title");
    }
コード例 #4
0
 public void OnClickMenu()
 {
     // Open the menu and pause the game.
     GameStateLoader.LoadSceneAsync("pause-menu");
 }