示例#1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.layer == LayerMask.NameToLayer("Player") || other.gameObject.layer == LayerMask.NameToLayer("PlayerImmunity"))
        {
            Time.timeScale = 0f;

            if (GameManager.Exist())
            {
                if (GameManager.instance.GetLevelsManager().GetMode())
                {
                    OptionsManager     optionsMng     = GameManager.instance.GetOptionsManager();
                    SpeedrunManager    speedRunMng    = LevelManager.instance.GetSpeedrunManager();
                    dreamloLeaderBoard leaderBoardMng = GameManager.instance.GetLeaderboard();
                    leaderBoardMng.AddScore(optionsMng.GetUserName(), speedRunMng.GetTimer());
                }

                GameManager.instance.GetSoundManager().StopMusic();
            }
            PlayerInputManager.SetCanReadInput(false);
            LevelManager.instance.GetUIGameplayManager().ToggleMenu(MenuType.EndGame);

            LevelManager.OnPlayerEndLevel?.Invoke();
            soundCtrl.PlayClip();
        }
    }
示例#2
0
        public override void Enable()
        {
            if (GameManager.Exist())
            {
                nameText.text = GameManager.instance.GetOptionsManager().GetUserName();
            }

            SpeedrunManager speedrunMng = LevelManager.instance.GetSpeedrunManager();

            if (speedrunMng.GetIsActive())
            {
                speedRunPanel.SetActive(true);
                normalPanel.SetActive(false);
                speedRunTimerText.text = "Time: " + speedrunMng.GetTimer().ToString("0.00");
            }
            else
            {
                normalPanel.SetActive(true);
                speedRunPanel.SetActive(false);
                tokenText.text = "Tokens: " + LevelManager.instance.GetTokenManager().GetTokensCount().ToString();
            }

            base.Enable();
        }