Esempio n. 1
0
        public void Link(string dreamFilePath, Color color, bool playSound = true, string spawnName = "")
        {
            GameSettings.CanControlPlayer = false;
            _canLink = false;

            int  shouldChangeTextureSetChance = RandUtil.Int(100);
            bool shouldChangeTextureSet       = shouldChangeTextureSetChance < ChangeTextureSetChance;

            if (playSound)
            {
                _source.PlayOneShot(_linkSound);
            }
            Fader.FadeIn(color, 1F, () =>
            {
                DreamDirector.SwitchDreamLevel(dreamFilePath, spawnName);
                if (shouldChangeTextureSet)
                {
                    DreamDirector.RefreshTextureSet(false);
                }
                GameSettings.CanControlPlayer = true;
                Fader.FadeOut(color, 1F, () =>
                {
                    _canLink = true;
                });
            });
        }
Esempio n. 2
0
        public void Update()
        {
            if (_playerController.isGrounded)
            {
                _fallTimer = 0;
                return;
            }

            _fallTimer += Time.deltaTime;
            if (!_canRotateCamera && _fallTimer > MAX_FALLING_TIME)
            {
                GameSettings.CanControlPlayer = false;
                _lookUpRotation = Quaternion.Euler(MAX_X_ROTATION, _targetCamera.transform.rotation.eulerAngles.y,
                                                   _targetCamera.transform.rotation.eulerAngles.z);
                DreamDirector.EndDreamFall();
                _canRotateCamera = true;
            }

            if (_canRotateCamera)
            {
                _targetCamera.transform.rotation = Quaternion.RotateTowards(_targetCamera.transform.rotation, _lookUpRotation,
                                                                            ROTATION_SPEED * Time.deltaTime);
            }
        }
Esempio n. 3
0
 public void StartButtonPressed()
 {
     DreamDirector.BeginDream();
 }
Esempio n. 4
0
        public static void ProcessConsoleCommand(string command)
        {
            List <string> commandFragments = SplitConsoleCommand(command);

            switch (commandFragments[0].ToLowerInvariant())
            {
            case "switchjournal":
            {
                DreamJournalManager.SwitchJournal(commandFragments[1]);
                break;
            }

            case "loadlevel":
            {
                string levelName = commandFragments[1];

                // if there is a journal specified switch to it
                if (commandFragments.Count > 2)
                {
                    DreamJournalManager.SwitchJournal(commandFragments[2]);
                }

                string levelPath = IOUtil.PathCombine(Application.streamingAssetsPath, "levels", DreamJournalManager.CurrentJournal, levelName + ".tmap");

                // check if the level exists before doing anything
                if (!File.Exists(levelPath))
                {
                    Debug.LogError("Level " + levelName + " does not exist");
                    break;
                }

                // if we're not in a dream begin one with the specified level
                if (!DreamDirector.CurrentlyInDream)
                {
                    DreamDirector.BeginDream(levelPath);
                    ConsoleUI.SetConsoleState(false);
                    break;
                }
                else
                {
                    // otherwise just swap out the level for the specified one
                    DreamDirector.SwitchDreamLevel(levelPath);
                    break;
                }
            }

            case "textureset":
            {
                int set = int.Parse(commandFragments[1], CultureInfo.InvariantCulture);
                Shader.SetGlobalInt("_TextureSet", set);
                Debug.Log("Switched texture set to " + (TextureSet)set);
                break;
            }

            case "enddream":
            {
                DreamDirector.EndDream();
                break;
            }

            case "greyman":
            {
                if (!DreamDirector.CurrentlyInDream)
                {
                    Debug.LogWarning("Not in dream!");
                    break;
                }

                GreymanController c = GameObject.FindGameObjectWithTag("GreymanController").GetComponent <GreymanController>();
                c.SpawnGreyman();
                break;
            }

            default:
            {
                Debug.LogWarning("Did not recognize command: " + commandFragments[0]);
                break;
            }
            }
        }
Esempio n. 5
0
 public void QuitToMenu()
 {
     DreamDirector.ExitDream();
 }