Exemple #1
0
        public override void Exit()
        {
            if (videoStream != null)
            {
                videoStream.OnVideoEnd -= SetupStartGame;
            }

            ui.GetGameplayManager().GetCountdownPanel().OnCountdownEnd -= HandleOnCountdownEnd;
            context.gameManager.GetUIManager().ToggleMenu(MenuType.None);
            context.gameManager.GetSoundManager().StopMusic();
        }
Exemple #2
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);
        }
    }
Exemple #3
0
 private void OnDisable()
 {
     ui.GetGameplayManager().GetCountdownPanel().OnCountdownEnd -= HandleOnCountdownEnd;
 }
Exemple #4
0
    /// <summary>
    /// Inizializzazione elementi del livello (verrà chiamata dalla SM)
    /// </summary>
    public void Init(UI_ManagerBase _uiManager, bool _speedrunMode)
    {
        instance  = this;
        pause     = false;
        uiManager = _uiManager.GetGameplayManager();

        //Init
        poolMng = GetComponent <PoolManager>();
        if (poolMng != null)
        {
            poolMng.Init();
        }

        stickyMng = GetComponent <StickyObjectManager>();
        if (stickyMng != null)
        {
            stickyMng.Init();
        }

        enemyMng = GetComponent <EnemyManager>();
        if (enemyMng != null)
        {
            enemyMng.Init();
        }

        platformMng = GetComponent <PlatformManager>();
        if (platformMng != null)
        {
            platformMng.Init(uiManager.GetGameplayManager());
        }

        speedMng = GetComponent <SpeedrunManager>();
        if (speedMng != null)
        {
            speedMng.Init(_speedrunMode);
        }

        checkpointMng = GetComponent <CheckpointManager>();
        if (checkpointMng != null)
        {
            checkpointMng.Init(speedMng);
        }

        poopCtrl = FindObjectOfType <PoopController>();
        if (poopCtrl != null)
        {
            poopCtrl.Init();
        }

        tokenMng = GetComponent <TokenManager>();
        if (tokenMng != null)
        {
            tokenMng.Init(speedMng);
        }

        player = FindObjectOfType <Player>();
        if (player != null)
        {
            player.Init(enemyMng, platformMng, tokenMng);
        }

        tutorialMng = GetComponent <TutorialManager>();
        if (tutorialMng != null)
        {
            tutorialMng.Init(enemyMng, player);
        }

        cameraMng = GetComponent <CameraManager>();
        if (cameraMng != null)
        {
            cameraMng.Init();
        }

        doorsMng = GetComponent <DoorsButtonsManager>();
        if (doorsMng != null)
        {
            doorsMng.Init();
        }

        videoStream = FindObjectOfType <StreamVideo>();

        //Setup
        enemyMng.EnemiesSetup();

        //Iscrizione Eventi
        PlayerInputManager.OnPausePressed += HandlePlayerPauseButtonPressed;
        player.OnPlayerDeath += HandlePlayerDeath;
        OnGamePause          += GamePause;
        OnGameUnPause        += GameUnPause;
    }