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)); }
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; } }
public void UnloadScreen(Screen screen) { switch(screen.ScreenID) { case ScreenIdentity.Battle: battleScreen = new BattleScreen(); battleScreen.Initialise(); nextScreen = battleScreen; break; } }
public void Initialise() { mapScreen = new MapScreen(); mapScreen.Initialise(); battleScreen = new BattleScreen(); battleScreen.Initialise(); //thanksForPlayingScreen = new ThanksForPlayingScreen(); //thanksForPlayingScreen.Initialise(); currentScreen = mapScreen; screenTransitionState = ScreenTransitionState.NewScreenIn; }