Beispiel #1
0
    private void Start()
    {
        ui = FindObjectOfType <UI_ManagerBase>();
        GameManager gm = FindObjectOfType <GameManager>();

        lvl      = FindObjectOfType <LevelManager>();
        soundMng = GetComponent <SoundManager>();
        if (gm == null && lvl != null)
        {
            instance = this;
            ui.Setup(gm);
            soundMng.Init();
            lvl.Init(ui, speedrunMode);
            if (speedrunMode)
            {
                PlayerInputManager.SetCanReadInput(false);
                lvl.GetPlayer().GetHealthController().SetCanLoseHealth(false);

                ui.GetGameplayManager().GetCountdownPanel().OnCountdownEnd += HandleOnCountdownEnd;
                ui.ToggleMenu(MenuType.Countdown);
            }
            else
            {
                PlayerInputManager.SetCanReadInput(true);
                ui.ToggleMenu(MenuType.Game);
            }
        }
        else
        {
            DestroyImmediate(gameObject);
        }
    }
Beispiel #2
0
        private void HandleOnCountdownEnd()
        {
            PlayerInputManager.SetCanReadInput(true);
            levelManager.GetPlayer().GetHealthController().SetCanLoseHealth(true);

            ui.ToggleMenu(MenuType.Game);

            SpeedrunManager.StartTimer?.Invoke();
        }
Beispiel #3
0
 public override void Exit()
 {
     UIMenu_LevelSelection.OnLevelSelected -= HandleLevelSelected;
     SceneManager.sceneLoaded -= OnSceneLoaded;
     uiManager.ToggleMenu(MenuType.None);
     context.gameManager.GetSoundManager().StopMusic();
 }
Beispiel #4
0
    private void HandleOnCountdownEnd()
    {
        PlayerInputManager.SetCanReadInput(true);
        lvl.GetPlayer().GetHealthController().SetCanLoseHealth(true);
        ui.ToggleMenu(MenuType.Game);

        if (SpeedrunManager.StartTimer != null)
        {
            SpeedrunManager.StartTimer();
        }
    }
Beispiel #5
0
        public override void Enter()
        {
            UIMenu_LevelSelection.OnLevelSelected += HandleLevelSelected;

            if (SceneManager.GetActiveScene().name == "MainMenu")
            {
                uiManager = context.gameManager.FindUIManager();
                uiManager.ToggleMenu(MenuType.MainMenu);
                context.gameManager.GetSoundManager().PlayMainMenuMnusic();
            }
            else
            {
                context.gameManager.GetUIManager().ToggleMenu(MenuType.Loading);
                SceneManager.LoadScene("MainMenu");
                SceneManager.sceneLoaded += OnSceneLoaded;
            }
        }
Beispiel #6
0
        private void OnSceneLoaded(Scene _scene, LoadSceneMode _mode)
        {
            uiManager = context.gameManager.FindUIManager();
            LevelManager levelManager = FindObjectOfType <LevelManager>();

            levelManager.Init(uiManager, context.gameManager.GetLevelsManager().GetMode());
            videoStream = levelManager.GetVideoStream();
            if (videoStream != null)
            {
                videoStream.OnVideoLoad += HandleVideoLoaded;
                videoStream.LoadVideo();
            }
            else
            {
                uiManager.ToggleMenu(MenuType.None);
                context.OnLevelSetupCallback();
            }
        }
Beispiel #7
0
 private void OnSceneLoaded(Scene _scene, LoadSceneMode _mode)
 {
     uiManager = context.gameManager.FindUIManager();
     uiManager.ToggleMenu(MenuType.MainMenu);
     context.gameManager.GetSoundManager().PlayMainMenuMnusic();
 }