コード例 #1
0
    private void Start()
    {
        enemyController.enabled = false;
        menuSystem.mainMenu_Play.onClick.AddListener(() =>
        {
            menuSystem.Hide();
            LoadFirstLevel();
        });

        menuSystem.levelComplete_Menu.onClick.AddListener(ShowMainMenu);
        menuSystem.gameComplete_Menu.onClick.AddListener(ShowMainMenu);
        menuSystem.gameOver_Menu.onClick.AddListener(ShowMainMenu);

        menuSystem.levelComplete_Next.onClick.AddListener(() =>
        {
            backGroundMusic.Play(backGroundMusic.None);
            menuSystem.Hide();
            menuSystem.ShowLevelStartInfo(maps[nextLevelIndex].name, nextLevelIndex + 1, LoadNextLevel);
        });

        menuSystem.mainMenu_Exit.onClick.AddListener(ExitGame);

        ShowMainMenu();

        maps = MapLoader.Load();
    }
コード例 #2
0
    // Initialize level (stored as scene), that has just been loaded.
    // Unsubscribe itself, so we don't keep initializing level, when not supposed to
    private void OnLevelSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        InitializeLevel();
        menuSystem.Hide();

        SceneManager.sceneLoaded -= OnLevelSceneLoaded;
    }