예제 #1
0
        public void Update(GameTime gameTime)
        {
            currentScreen.Update(gameTime);
            switch (screenTransitionState)
            {
                case ScreenTransitionState.Idle:
                    break;

                case ScreenTransitionState.CurrentScreenOut:

                    if (screenFadeState == ScreenFadeState.IdleBlack)
                    {
                        if (nextScreen == mapScreen && previousScreen == battleScreen)
                        {
                            currentScreen = nextScreen;
                            UnloadScreen(battleScreen);
                            previousScreen = battleScreen;
                            GameClass.CurrentGameCamera.Position = GlobalGameInfo.PreviousMapCameraPosition;
                            GlobalGameInfo.CurrentEnemyInBattle.CurrentAction = MapCharacterAction.Death;
                        }
                        else
                        {
                            UnloadScreen(currentScreen);
                            currentScreen = nextScreen;
                            currentScreen.LoadContent();
                        }
                        screenTransitionState = ScreenTransitionState.NewScreenIn;
                    }
                    break;

                case ScreenTransitionState.NewScreenIn:

                    if (ScreenManager.CurrentFadeState != ScreenFadeState.IdleFaded)
                    {
                        if (ScreenManager.CurrentFadeState != ScreenFadeState.FadeFromBlack)
                        {
                            ScreenManager.SetFade(ScreenFadeState.FadeFromBlack, fadeSpeed);
                        }
                    }
                    else
                    {
                            screenTransitionState = ScreenTransitionState.Idle;
                            if (currentScreen == mapScreen && previousScreen == battleScreen)
                            {
                                MapScreen.battleTriggered = false;
                                GameClass.SoundManager.PlaySoundEffect("Audio/enemyDeath");
                                GameClass.SoundManager.StopBackgroundMusic();
                                GameClass.SoundManager.SetBackgroundMusic(mapScreen.CurrentMapStageSection.BackgroundMusicFileName, true);
                                GameClass.SoundManager.PlayBackgroundMusic();
                            }
                    }
                    break;
            }

                switch (screenFadeState)
                {
                    case ScreenFadeState.FadeFromBlack:
                        if (alphaValue > 0.0f)
                        {
                            alphaValue -= fadeSpeed;
                        }
                        else
                        {
                            screenFadeState = ScreenFadeState.IdleFaded;
                        }
                        break;

                    case ScreenFadeState.FadeToBlack:
                        if (alphaValue < 1.0f)
                        {
                            alphaValue += fadeSpeed;
                        }
                        else
                        {
                            screenFadeState = ScreenFadeState.IdleBlack;
                        }
                        break;
                }

                fadeColor = new Color(new Vector4(1.0f, 1.0f, 1.0f, alphaValue));
        }
예제 #2
0
        public void ScreenTransition(ScreenIdentity newScreenID)
        {
            screenTransitionState = ScreenTransitionState.CurrentScreenOut;
            ScreenManager.SetFade(ScreenFadeState.FadeToBlack, fadeSpeed);

            previousScreen = currentScreen;
            switch (newScreenID)
            {
                case ScreenIdentity.Battle:
                    nextScreen = battleScreen;
                    break;
                case ScreenIdentity.Map:
                    nextScreen = mapScreen;
                    break;
                case ScreenIdentity.ThanksForPlaying:
                    nextScreen = thanksForPlayingScreen;
                    break;
            }
        }
예제 #3
0
 public void UnloadScreen(Screen screen)
 {
     switch(screen.ScreenID)
     {
         case ScreenIdentity.Battle:
             battleScreen = new BattleScreen();
             battleScreen.Initialise();
             nextScreen = battleScreen;
             break;
     }
 }
예제 #4
0
        public void Initialise()
        {
            mapScreen = new MapScreen();
            mapScreen.Initialise();
            battleScreen = new BattleScreen();
            battleScreen.Initialise();
            //thanksForPlayingScreen = new ThanksForPlayingScreen();
            //thanksForPlayingScreen.Initialise();

            currentScreen = mapScreen;
            screenTransitionState = ScreenTransitionState.NewScreenIn;
        }