/// <summary> /// Aktualisiert den FadingProgress des Switchings. /// </summary> public void Switch(Savegame pSavegame, ref SceneData pScene, Hansel pHansel, Gretel pGretel, Camera pCamera, TwoDRenderer pRenderer) { AIManager.Instance.ClearAgents(); FadingProgress += EngineSettings.Time.ElapsedGameTime.Milliseconds; pHansel.MoveManually(LeaveHansel, 1f, pScene); pGretel.MoveManually(LeaveGretel, 1f, pScene); if (FadingProgress >= FadingDuration) { //Switch pHansel.MoveInteractiveObject(DestinationHansel - pHansel.SkeletonPosition); pGretel.MoveInteractiveObject(DestinationGretel - pGretel.SkeletonPosition); pSavegame.SceneId = DestinationScene; pScene = pSavegame.Scenes[DestinationScene]; pCamera.GameScreen = pScene.GamePlane; pScene.SetupRenderList(pHansel, pGretel); pRenderer.AmbientLight = pScene.SceneAmbientLight; //Show on new Scene FadingProgress = 0; CurrentState = State.Entering; GameReferenzes.Level = pScene; AIManager.Instance.ChangeMap(pCamera.GameScreen, pScene.MoveArea); // Für alle weiteren Felder die nicht betreten werden können. AIManager.Instance.SetInterActiveObjects(pScene.InteractiveObjects); AIManager.Instance.SetAgents(pScene.Enemies); GameReferenzes.SceneID = DestinationScene; SoundHandler.Instance.ResetTime(); FmodMediaPlayer.Instance.SetBackgroundSong(GameReferenzes.GetBackgroundMusic()); GameReferenzes.IsSceneSwitching = false; } }
public void Enter(SceneData pScene, Hansel pHansel, Gretel pGretel, Savegame pSavegame) { bool TmpEnterFinished = true; foreach (Waypoint wp in pScene.Waypoints) { if (wp.CollisionBox.Intersects(pHansel.CollisionBox) || wp.CollisionBox.Intersects(pGretel.CollisionBox)) { TmpEnterFinished = false; pHansel.MoveManually(wp.MovementOnEnter, 1f, pScene, false, false, true); pGretel.MoveManually(wp.MovementOnEnter, 1f, pScene, false, false, true); } } if (TmpEnterFinished) { CurrentState = State.Idle; //Spiel speichern wenn Spieler in der Scene angekommen sind und ein Kreidefelsen in ihr steht. foreach (int i in Hardcoded.Scene_Waystone) { if (GameReferenzes.SceneID == i) { Savegame.Save(pSavegame, pHansel, pGretel); } } /* * if (GameReferenzes.SceneID == 3 | GameReferenzes.SceneID == 6 | GameReferenzes.SceneID == 12 | GameReferenzes.SceneID == 15) * Savegame.Save(pSavegame, pHansel, pGretel); * foreach (InteractiveObject iObj in pScene.InteractiveObjects) * { * if (iObj.Name == Hardcoded.Scene_Waystone_IObjName) * { * Savegame.Save(pSavegame, pHansel, pGretel); * } * } */ } }