//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* Derived Method: On Trigger
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    protected override void OnTrigger()
    {
        base.OnTrigger();

        if (m_rOwningPage != null)
        {
            m_rOwningPage.Disappear(false);
        }

        // Show Previous Scene/Note
        if (PreviousScene != null)
        {
            if (PreviousScene.IsSceneActive)
            {
                PreviousScene.ShowSceneVignette();
            }
            else
            {
                PreviousScene.ShowSubscene();
            }
        }
        if (PreviousNotePage != null)
        {
            PreviousNotePage.Reveal(false);
        }

        // Hide Vignette if no one is going to own it :/
        if (PreviousScene == null)
        {
            VignetteManager.TransitionVignette(0.0f, 0.25f);
        }
    }
        private RenderTarget2D GetSceneSnapshot()
        {
            GraphicsDevice.SetRenderTarget(_snapshotTarget);
            PreviousScene.Draw();
            GraphicsDevice.SetRenderTarget(null);

            return(_snapshotTarget);
        }
Example #3
0
    // Play mode change callback handles the scene load/reload.
    private static void OnPlayModeChanged(PlayModeStateChange state)
    {
        if (!LoadMasterOnPlay)
        {
            return;
        }

        if (!EditorApplication.isPlaying && EditorApplication.isPlayingOrWillChangePlaymode)
        {
            // User pressed play -- autoload master scene.
            for (int i = 0; i < EditorSceneManager.sceneCount; i++)
            {
                if (i == 0)
                {
                    PreviousScene = EditorSceneManager.GetSceneAt(i).path;
                }
                else
                {
                    PreviousScene += ":" + EditorSceneManager.GetSceneAt(i).path;
                }
            }
            if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
            {
                try
                {
                    EditorSceneManager.OpenScene(MasterScene);
                }
                catch
                {
                    Debug.LogError(string.Format("error: scene not found: {0}", MasterScene));
                    EditorApplication.isPlaying = false;
                }
            }
            else
            {
                // User cancelled the save operation -- cancel play as well.
                EditorApplication.isPlaying = false;
            }
        }

        // isPlaying check required because cannot OpenScene while playing
        if (!EditorApplication.isPlaying && !EditorApplication.isPlayingOrWillChangePlaymode)
        {
            // User pressed stop -- reload previous scene.
            try
            {
                char[] split = { ':' };
                foreach (var scene in PreviousScene.Split(split, StringSplitOptions.RemoveEmptyEntries))
                {
                    EditorSceneManager.OpenScene(scene, OpenSceneMode.Additive);
                }
            }
            catch
            {
                Debug.LogError(string.Format("error: scene not found: {0}", PreviousScene));
            }
        }
    }
        public static void OnPlayModeChanged(PlayModeStateChange state)
        {
            if (!loadMainMenuOnEditorPlay)
            {
                return;
            }


            if (state == PlayModeStateChange.ExitingEditMode)
            {
                // User pressed play -- autoload initials scene.
                if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
                {
                    List <string> paths = new List <string>();
                    for (int i = 0; i < EditorSceneManager.sceneCount; i++)
                    {
                        paths.Add(EditorSceneManager.GetSceneAt(i).path);
                    }

                    PreviousScene = string.Join(splitKeyS, paths);

                    string mainMenuScenePath = GameManagerSettings.instance.mainMenuScenePath;

                    try {
                        EditorSceneManager.OpenScene(mainMenuScenePath);
                    }
                    catch {
                        Debug.LogError("Error: scene not found: " + mainMenuScenePath);
                        loadMainMenuOnEditorPlay    = false;
                        EditorApplication.isPlaying = false;
                    }
                }
                else
                {
                    // User cancelled the save operation -- cancel play as well.
                    loadMainMenuOnEditorPlay    = false;
                    EditorApplication.isPlaying = false;
                }
            }
            // User pressed stop -- reload previous scene.
            else if (state == PlayModeStateChange.EnteredEditMode)
            {
                loadMainMenuOnEditorPlay = false;

                string[] scenes = PreviousScene.Split(splitKey);
                for (int i = 0; i < scenes.Length; i++)
                {
                    try     { EditorSceneManager.OpenScene(scenes[i], i == 0 ? OpenSceneMode.Single : OpenSceneMode.Additive); }
                    catch   { Debug.LogError("Error: scene not found: " + scenes[i]); }
                }
            }
        }
Example #5
0
    public void SelectThis()
    {
        if (Scene != null)
        {
            PreviousScene.SetActive(false);
            Scene.SetActive(true);
        }

        GameManager.OptionSelected(Event);
        GameManager.SetPanelActive(true);

        if (Scene.GetComponent <SceneSelection>() == null)
        {
            OptionPanel.SetActive(false);
        }
    }
        public virtual void Update(GameTime gameTime)
        {
            PreviousScene.Update(gameTime);

            _fadeTime = OrionMath.LinearInterpolate(0.0f, 1.0f, _elapsed);

            if (_elapsed <= 1.0f)
            {
                _elapsed += gameTime.ElapsedGameTime.Milliseconds / FadeDuration;
            }
            else
            {
                if (Elapsed != null)
                {
                    Elapsed(this, new EventArgs());
                }
            }
        }
 // Use this for initialization
 void Start()
 {
     // Set this as the GameHandler's LevelSelectHandler.
     var gameHandler = GameObject.FindGameObjectWithTag("GameHandler");
     if (gameHandler != null)
     {
         gameHandler.GetComponent<GameHandler>().BuilderHandler = this;
         prevScene = gameHandler.GetComponent<GameHandler>().GotoPrevScene;
         playersJoined = gameHandler.GetComponent<GameHandler>().GetPlayersJoined();
         ActivatePlayerAreas(playersJoined);
     }
     else
     {
         ActivatePlayerAreas(new [] {true, true, true, true});
     }
 }