예제 #1
0
        public override void Update(GameTime gameTime)
        {
            KeyboardState state = Keyboard.GetState();

            // Pause/Unpause and pause/resume music
            if (state.IsKeyDown(Keys.P) && PState.IsKeyUp(Keys.P))
            {
                IsPaused = !IsPaused;
                SLocator.AManager.PauseOrResume();
            }

            // Check of we faded an start sound effect play
            if (IsFaded && !IsSoundOver)
            {
                IsSoundOver = true;
                SLocator.AManager.Play(SongTypes.LAUGH);
            }

            if (IsFaded && !IsSongStart && !SLocator.AManager.IsSoundPlaying)
            {
                IsSongStart = true;
                SLocator.AManager.Play(SongTypes.INGAME);
            }

            this.PState = state;

            // If not paused, update world
            if (!IsPaused)
            {
                WCore.Update(gameTime);
            }

            //If player is dead start fade out
            if (!WCore.IsPlayerAlive)
            {
                StartFade();
            }

            // switch to dead screen if faded
            if (!WCore.IsPlayerAlive && IsFaded)
            {
                SManager.SwitchScreen(ScreenTypes.DEAD, WCore.PSCore);
            }
        }
예제 #2
0
        public override void Update(GameTime gameTime)
        {
            KeyboardState state = Keyboard.GetState();

            // Start fading out
            if (state.IsKeyDown(Keys.Space) && PState.IsKeyUp(Keys.Space) && IsFaded)
            {
                StartFade();
                IsReady = true;
            }

            // switch to game screen when pressed
            if (IsReady && IsFaded)
            {
                SManager.SwitchScreen(ScreenTypes.GAME);
            }
            else if (IsReady && !IsFaded)
            {
                SLocator.AManager.Mute(FadeRatio);
            }

            this.PState = state;
        }