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); } }
private void HandleOnCountdownEnd() { PlayerInputManager.SetCanReadInput(true); levelManager.GetPlayer().GetHealthController().SetCanLoseHealth(true); ui.ToggleMenu(MenuType.Game); SpeedrunManager.StartTimer?.Invoke(); }
public override void Exit() { UIMenu_LevelSelection.OnLevelSelected -= HandleLevelSelected; SceneManager.sceneLoaded -= OnSceneLoaded; uiManager.ToggleMenu(MenuType.None); context.gameManager.GetSoundManager().StopMusic(); }
private void HandleOnCountdownEnd() { PlayerInputManager.SetCanReadInput(true); lvl.GetPlayer().GetHealthController().SetCanLoseHealth(true); ui.ToggleMenu(MenuType.Game); if (SpeedrunManager.StartTimer != null) { SpeedrunManager.StartTimer(); } }
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; } }
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(); } }
private void OnSceneLoaded(Scene _scene, LoadSceneMode _mode) { uiManager = context.gameManager.FindUIManager(); uiManager.ToggleMenu(MenuType.MainMenu); context.gameManager.GetSoundManager().PlayMainMenuMnusic(); }