public override void Update(GameTime gameTime)
        {
            if (InputMonitor.Instance.WasJustReleased(InputMonitor.PAUSE) || InputMonitor.Instance.WasJustReleased(InputMonitor.JUMP))
            {
                displayStartString = false;

                ScreenTransition sts = new ScreenTransition("Game", "Game", 0.01f, 0.01f, true, true);

                ScreenManager.Instance.Transition(sts);
            }

            base.Update(gameTime);
        }
 public void OnSpriteCollision(ISpriteCollideable objectCollidedWith)
 {
     if (objectCollidedWith == World.Player)
     {
         if (!playerColliding)
         {
             playerColliding = true;
             StoryboardScreen sbs = new StoryboardScreen("Test", "Game", @"StoryboardXML\TitleScreenStoryboard");
             ScreenManager.Instance.ScreenList.Add(sbs);
             ScreenTransition st = new ScreenTransition("Game", "Test", 0.2f, 0.2f, false, false);
             ScreenManager.Instance.Transition(st);
             World.Paused = true;
             World.RemoveWorldObject(this);
         }
     }
 }
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Time relative to the game</param>
        protected override void Update(GameTime gameTime)
        {
            if (InputMonitor.Instance.WasJustPressed("ToggleFullScreen"))
            {
                if (isFullScreen)
                {
                    isFullScreen = false;
                    ResolutionService.CurrentResolutionSettings = windowedSettings;
                }
                else
                {
                    isFullScreen = true;
                    ResolutionService.CurrentResolutionSettings = fullScreenSettings;
                }
            }

            if (transitionState != null)
            {
                transitionState.Update();

                if (transitionState.IsTransitionComplete)
                {
                    Screen s = (from sc in this.ScreenList
                                where sc.Name == transitionState.ToScreenName
                                select sc).FirstOrDefault();

                    s.TransitionComplete();

                    transitionState = null;
                }
            }

            base.Update(gameTime);
        }
        public void Transition(ScreenTransition transition)
        {
            Screen s = (from sc in this.ScreenList
                        where sc.Name == transition.FromScreenName
                        select sc).FirstOrDefault();

            if (s == null)
            {
                throw new ArgumentException("FromScreenName is not a known screen", "TransitionState.FromScreenName");
            }

            if (!this.Components.Contains(s))
            {
                throw new ArgumentException("FromScreenName is currently not being drawn to the screen", "TransitionState.FromScreenName");
            }

            s = (from sc in this.ScreenList
                 where sc.Name == transition.ToScreenName
                 select sc).FirstOrDefault();

            if (s == null)
            {
                throw new ArgumentException("ToScreenName is not a known screen", "TransitionState.ToScreenName");
            }

            if (!transition.ResetGame && this.Components.Contains(s))
            {
                throw new ArgumentException("ToScreenName is currently being drawn to the screen", "TransitionState.ToScreenName");
            }

            this.transitionState = transition;
        }
        public override void Update(GameTime gameTime)
        {
            // start the timer on the scene if its an automatic transition and its the first storyboard
            if (currentScene.Value.IsTransitionAutomatic && !currentScene.Value.IsTimerStarted)
            {
                currentScene.Value.StartTimer();
            }

            base.Update(gameTime);

            // tell the screen manager not to use the sprite batch service
            // we need to use SpriteBatchMode.Immediate to use HLSL
            ScreenManager.Instance.UseSpriteBatchService = false;

            if (transition != null) // if we currently have a transition happening
            {
                transition.Update(); // update the transition

                if (transition.IsTransitionComplete)
                {
                    // reset the transition and start the text timer
                    transition = null;
                    characterTimer.ResumeTimer();

                    // reset timer on the scene if its an automatic transition...coming from a previous transition
                    if (currentScene.Value.IsTransitionAutomatic && currentScene.Value.IsTimerStarted)
                    {
                        currentScene.Value.StopTimer();
                        currentScene.Value.StartTimer();
                    }
                }
            }

            // if there is input or it is an automatic transition and there is no transition happening
            if (((InputMonitor.Instance.WasJustPressed(InputMonitor.JUMP) || InputMonitor.Instance.WasJustPressed(InputMonitor.PAUSE)) && transition == null) ||
                (currentScene.Value.IsTransitionAutomatic && currentScene.Value.IsReadyToTransition && transition == null))
            {
                // user inputs in the middle of the text
                if (currentStoryBoardTextIndex < currentScene.Value.SceneText.Length)
                {
                    // display the rest of the text
                    currentStoryboardText = currentScene.Value.SceneText;
                    currentStoryBoardTextIndex = currentScene.Value.SceneText.Length;
                    characterTimer.ResetTimer();
                    characterTimer.PauseTimer();
                }
                // if we have another storyboard and the text is done on the current storyboard
                else if (currentStoryboardText == currentScene.Value.SceneText && currentScene != storyboards.Last)
                {
                    // transition to next story board
                    this.transition = new StoryboardTransition(this, 0.01f, 0.01f);

                    //fadeEffectDone = false;

                    // reset the timer
                    characterTimer.ResetTimer();
                    characterTimer.PauseTimer();

                    // reset the text being displayed
                    currentStoryboardText = String.Empty;
                    currentStoryBoardTextIndex = 0;

                    // if we have an automatic transition stop the timer
                    if (currentScene.Value.IsTransitionAutomatic && currentScene.Value.IsTimerStarted)
                    {
                        currentScene.Value.StopTimer();
                    }
                }
                // we are at the last storyboard
                else if (currentStoryboardText == currentScene.Value.SceneText && currentScene == storyboards.Last)
                {
                    // if we have an automatic transition
                    if (currentScene.Value.IsTransitionAutomatic && currentScene.Value.IsTimerStarted)
                    {
                        // stop the timer
                        currentScene.Value.StopTimer();
                    }

                    // we have reached our last story board, transition to the next screen
                    ScreenTransition sts = new ScreenTransition(this.Name, this.nextScreen, 0.01f, 0.01f, false, true);
                    ScreenManager.Instance.Transition(sts);
                    characterTimer.RemoveTimer();
                }
            }
        }