示例#1
0
        public IEnumerator LoadDream(Dream dream)
        {
            Debug.Log($"Loading dream '{dream.Name}'");

            if (MusicSource != null && MusicSource.isPlaying)
            {
                MusicSource.Stop();
            }

            TextureSetSystem.DeregisterAllMaterials();

            string currentScene = SceneManager.GetActiveScene().name;

            OnLevelPreLoad.Raise();

            SceneManager.LoadScene(DreamScene.ScenePath);
            yield return(null);

            ResourceManager.ClearLifespan("scene");

            CurrentDream = dream;

            // then instantiate the LBD if it has one
            if (dream.Type == DreamType.Legacy)
            {
                LBDLoader.LoadLBD(dream.LBDFolder, dream.LegacyTileMode, dream.TileWidth);
            }

            // load the manifest if it has one
            if (!string.IsNullOrEmpty(dream.Level))
            {
                string levelPath = PathUtil.Combine(Application.streamingAssetsPath, dream.Level);
                LevelLoader.LoadLevel(levelPath);
            }

            ApplyEnvironment(dream.ChooseEnvironment(GameSave.CurrentJournalSave.DayNumber));

            SettingsSystem.CanControlPlayer = true;
            SettingsSystem.CanMouseLook     = true;

            OnLevelLoad.Raise();

            MusicSource = MusicSystem.PlayRandomSongFromDirectory(PathUtil.Combine(Application.streamingAssetsPath,
                                                                                   JournalLoader.Current.MusicFolder));
            OnSongChange.Raise();

            // reenable pausing
            PauseSystem.CanPause = true;

            ToriiCursor.Hide();

            ToriiFader.Instance.FadeOut(1F, () => _currentlyTransitioning = false);
        }
示例#2
0
        public void Update()
        {
            if (Controls.Current.Actions.Run.WasPressed)
            {
                OnCreditsEnd.Raise();
                _creditsFinished = true;
            }

            if (!_creditsFinished && UISectionContainer.anchoredPosition.y > UISectionContainer.rect.height + 500)
            {
                OnCreditsEnd.Raise();
                _creditsFinished = true;
            }
        }
示例#3
0
        public IEnumerator ReturnToTitle()
        {
            Debug.Log("Loading title screen");

            if (MusicSource != null && MusicSource.isPlaying)
            {
                MusicSource.Stop();
            }

            var asyncLoad = SceneManager.LoadSceneAsync(TitleScene.ScenePath);

            while (!asyncLoad.isDone)
            {
                yield return(null);
            }

            ResourceManager.ClearLifespan("scene");

            OnReturnToTitle.Raise();

            yield return(null);

            ToriiCursor.Show();

            ToriiFader.Instance.FadeOut(1F);
        }
示例#4
0
 public void Start()
 {
     if (!GameLoadSystem.GameLoaded)
     {
         OnGameLaunch.Raise();
     }
 }
        public IEnumerator LoadGameCoroutine()
        {
            // do game startup stuff here

            TResourceManager.RegisterHandler(new LBDHandler());
            TResourceManager.RegisterHandler(new TIXHandler());
            TResourceManager.RegisterHandler(new Texture2DHandler());
            TResourceManager.RegisterHandler(new MOMHandler());
            TResourceManager.RegisterHandler(new ToriiAudioClipHandler());
            TResourceManager.RegisterHandler(new TIXTexture2DHandler());

            Screenshotter.Instance.Init();

            // set the sort order for the fader so the version text appears on top during fades
            ToriiFader.Instance.SetSortOrder(0);

            Shader.SetGlobalFloat("_FogStep", 0.08F);
            Shader.SetGlobalFloat("AffineIntensity", 0.5F);

            // okay, it's a fake loading screen LOL
            // it used to be real but it's been optimised away and I liked the animation too much
            if (!Application.isEditor)
            {
                yield return(new WaitForSeconds(3));
            }
            else
            {
                yield return(null);
            }

            GameLoaded = true;

            OnGameDataLoaded.Raise();
        }
示例#6
0
 public void Unpause()
 {
     Time.timeScale = 1;
     OnGameUnpaused.Raise();
     Settings.CanMouseLook = true;
     ToriiCursor.Hide();
 }
 public void Update()
 {
     if (Controls.Current.Actions.Start.WasReleased)
     {
         ToTrigger.Raise();
     }
 }
示例#8
0
        public void Pause()
        {
            if (!CanPause)
            {
                return;
            }

            Time.timeScale = 0;
            OnGamePaused.Raise();
            Settings.CanMouseLook = false;
            ToriiCursor.Show();
        }
示例#9
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            GUI.enabled = Application.isPlaying;

            ToriiEvent e = target as ToriiEvent;

            if (GUILayout.Button("Raise"))
            {
                e.Raise();
            }
        }
示例#10
0
        public void SetVisible(bool visible)
        {
            CommandInputField.text = string.Empty;

            _visible = visible;
            gameObject.SetActive(visible);

            if (visible)
            {
                StartCoroutine(updateScrollRect());
                selectInputField();
                OnConsoleOpen.Raise();
            }
            else
            {
                OnConsoleClose.Raise();
            }
        }
示例#11
0
        public IEnumerator LoadGameCoroutine()
        {
            // do game startup stuff here

            GameSettings.Initialize();

            TResourceManager.RegisterHandler(new LBDHandler());
            TResourceManager.RegisterHandler(new TIXHandler());
            TResourceManager.RegisterHandler(new Texture2DHandler());
            TResourceManager.RegisterHandler(new MaterialHandler());

            ControlSchemeManager.Initialize();

            DreamJournalManager.Initialize();

            MapReader.MapScaleFactor = 1F;

            GameSettings.LoadSettings();

            Shader.SetGlobalFloat("_FogStep", 0.08F);
            Shader.SetGlobalFloat("AffineIntensity", 0.5F);

            PsxVram.Initialize();

            if (Application.isEditor)
            {
                // if we're running inside the editor, we want to have the mouse!
                GameSettings.SetCursorViewState(true);
            }

            yield return(LBDTilePool.InitialiseCoroutine());

            // TODO
            //SaveGameManager.LoadGame();

            OnGameDataLoaded.Raise();
        }
示例#12
0
 public void SpawnPlayer(GameObject player)
 {
     Player = player.transform;
     OnPlayerSpawned.Raise();
 }