private void OnGameStateChanged(GameStateChanged newState) { LevelManager.GameState state = newState.state; if (state == LevelManager.GameState.Running || state == LevelManager.GameState.ShowingUnlockedParts || state == LevelManager.GameState.Building) { this.LoadState(); } }
void GameStateEntered(LevelManager.GameState newGameState, LevelManager.GameState oldGameState) { switch (newGameState) { case LevelManager.GameState.Pregame: PreGameConfiguration(); break; case LevelManager.GameState.Playing: PlayGameConfiguration(); break; } }
private void ChangeLevelGameState(LevelManager.GameState state, bool newState) { if (state != LevelManager.GameState.Completed) { if (state == LevelManager.GameState.CakeRaceCompleted) { this.SwitchCondition(ComplexVisibilityManager.Condition.CakeRaceCompleteScreen, newState); } } else { this.SwitchCondition(ComplexVisibilityManager.Condition.LevelCompleteScreen, newState); } }
private void ReceiveGameStateChanged(GameStateChanged data) { LevelManager.GameState state = data.state; switch (state) { case LevelManager.GameState.Running: { GameObject gameObject; gameObject = this.commonAudio.InFlightMusic; this.StartMusic(gameObject.GetComponent <AudioSource>(), 0f, 0.2f, MusicManager.MusicStartOption.StartFromBeginning); break; } default: if (state != LevelManager.GameState.Building) { if (state == LevelManager.GameState.CakeRaceCompleted) { this.FadeOutMusic(0.5f); } } else { GameObject gameObject2; gameObject2 = this.commonAudio.BuildMusic; AudioSource component = gameObject2.GetComponent <AudioSource>(); if (this.m_musicPrefab && this.m_musicPrefab.name != gameObject2.name) { this.FadeOutMusic(0.5f); this.StartMusic(component, 0.7f, 0.2f, MusicManager.MusicStartOption.StartFromPreviousPosition); } else { this.StartMusic(component, 0f, 0.2f, MusicManager.MusicStartOption.StartFromPreviousPosition); } } break; case LevelManager.GameState.Completed: this.FadeOutMusic(0.5f); break; } this.CheckNativeMusicPlayer(); }
public void UIMode(LevelManager.GameState state) { switch (state) { case LevelManager.GameState.MENU: break; case LevelManager.GameState.DEFLECT: deflectUI.SetActive(true); comboUI.SetActive(false); break; case LevelManager.GameState.COMBO: deflectUI.SetActive(false); comboUI.SetActive(true); comboCountdown = countdownSlider.maxValue; break; } }
void GameStateEntered(LevelManager.GameState newGameState, LevelManager.GameState oldGameState) { switch (newGameState) { case LevelManager.GameState.Paused: break; case LevelManager.GameState.Playing: spawnerComponent.countDownTypeParam1 = totalHaggises; spawnerComponent.StartSpawning(); break; case LevelManager.GameState.Disabled: case LevelManager.GameState.Lost: case LevelManager.GameState.Won: case LevelManager.GameState.Pregame: break; } }
private void ReceiveGameStateChange(GameStateChanged uiEvent) { LevelManager.GameState state = uiEvent.state; if (state == LevelManager.GameState.Building) { this.hideThisSession = false; RewardVideoManager.TimeToReward = 2; if (RewardVideoManager.AddTimeRewardOnLevelStart) { RewardVideoManager.AddTimeRewardOnLevelStart = false; RewardVideoManager.HadRewardAlready = true; RewardVideoManager.AddTimeRewardCounterOnLevelStart = true; if (GameTime.IsPaused()) { GameTime.Pause(false); } this.AddTime(); } else if (!base.gameObject.activeInHierarchy && this.IsAllowedToShow()) { this.ShowButton(); } } }
public void OpenPartList() { if (this.constructionUI != null) { this.constructionUI.SetEnabled(false, false); } if (this.partListing == null) { this.CreatePartListing(); } LevelManager levelManager = UnityEngine.Object.FindObjectOfType <LevelManager>(); LevelManager.GameState previousState = LevelManager.GameState.Building; if (levelManager != null) { previousState = levelManager.gameState; levelManager.SetGameState(LevelManager.GameState.CustomizingPart); } this.partListing.CenterOnPart(this.centerPart); this.partListing.Open(delegate { if (this.constructionUI != null) { this.constructionUI.SetEnabled(true, true); levelManager.SetGameState(previousState); } this.UpdateNewTagState(); }); if (this.customizeMenu == null) { this.customizeMenu = base.gameObject.AddComponent <CustomizePartUI>(); } this.customizeMenu.customPartWidget = this; this.customizeMenu.InitButtons(this.partListing, this.onPartListClose); this.centerPart = BasePart.PartType.Unknown; }
void GameStateEntered(LevelManager.GameState newGameState, LevelManager.GameState oldGameState) { switch (newGameState) { case LevelManager.GameState.Paused: OnPause(true); break; case LevelManager.GameState.Playing: if (isPaused) { OnPause(false); } SetActive(true); break; case LevelManager.GameState.Disabled: case LevelManager.GameState.Lost: case LevelManager.GameState.Won: case LevelManager.GameState.Pregame: SetActive(false); break; } }
private void ReceiveUIEvent(UIEvent data) { if (this.HandleUIEvent(data)) { return; } switch (data.type) { case UIEvent.Type.Building: if (this.resourceUnloadTimer > 600f) { this.resourceUnloadTimer = 0f; Resources.UnloadUnusedAssets(); } if (this.levelManager.m_sandbox && this.levelManager.ConstructionUI.UnlockedParts.Count > 0) { this.StopRunningContraption(); this.levelManager.SetGameState(LevelManager.GameState.ShowingUnlockedParts); } else { this.levelManager.SetGameState(LevelManager.GameState.Building); } break; case UIEvent.Type.Play: if (!this.levelManager.ConstructionUI.IsDragging()) { this.levelManager.CheckForLevelStartAchievements(); LevelManager.GameState gameState = (this.levelManager.gameState != LevelManager.GameState.Building) ? LevelManager.GameState.Continue : LevelManager.GameState.Running; if (this.levelManager.gameState == LevelManager.GameState.Building) { Debug.Log("Path: " + System.IO.Directory.GetCurrentDirectory()); Singleton <AudioManager> .Instance.Play2dEffect((AudioClip)Resources.Load("AudioAdd" + Path.DirectorySeparatorChar + "ui_button_back")); //Singleton<AudioManager>.Instance.Play2dEffect(Resources.Load<AudioClip>(Application.dataPath + Path.DirectorySeparatorChar + "AudioClip" + Path.DirectorySeparatorChar + "ui_button_back.wav"))); //Resources.Load<AudioClip>("Sounds/whatever_audio_fx"); } this.levelManager.SetGameState(gameState); } break; case UIEvent.Type.LevelSelection: this.levelManager.SetGameState(LevelManager.GameState.Undefined); if (Singleton <GameManager> .Instance.CurrentEpisode != string.Empty) { Singleton <GameManager> .Instance.LoadLevelSelection(Singleton <GameManager> .Instance.CurrentEpisode, true); } else { Singleton <GameManager> .Instance.LoadEpisodeSelection(true); } break; case UIEvent.Type.NextLevel: this.levelManager.SetGameState(LevelManager.GameState.Undefined); Singleton <GameManager> .Instance.LoadNextLevel(); break; case UIEvent.Type.Preview: { LevelManager.GameState gameState2 = (this.levelManager.gameState != LevelManager.GameState.Running) ? LevelManager.GameState.PreviewWhileBuilding : LevelManager.GameState.PreviewWhileRunning; this.levelManager.SetGameState(gameState2); break; } case UIEvent.Type.Clear: this.levelManager.ConstructionUI.ClearContraption(); break; case UIEvent.Type.Pause: { LevelManager.GameState gameState3 = (this.levelManager.gameState != LevelManager.GameState.Running) ? LevelManager.GameState.PausedWhileBuilding : LevelManager.GameState.PausedWhileRunning; this.levelManager.SetGameState(gameState3); break; } case UIEvent.Type.ReplayLevel: this.levelManager.SetGameState(LevelManager.GameState.Undefined); if (this.levelManager.m_darkLevel) { LightManager.enabledLightPositions = new List <Vector3>(); PointLightSource[] array = UnityEngine.Object.FindObjectsOfType <PointLightSource>(); for (int i = 0; i < array.Length; i++) { if (array[i].isEnabled) { LightManager.enabledLightPositions.Add(array[i].transform.position); } } } Singleton <GameManager> .Instance.ReloadCurrentLevel(true); break; case UIEvent.Type.ActivateRockets: { Rocket[] componentsInChildren = this.ContraptionRunning.GetComponentsInChildren <Rocket>(); foreach (Rocket rocket in componentsInChildren) { rocket.ProcessTouch(); } break; } case UIEvent.Type.ActivateEngines: { Engine[] componentsInChildren2 = this.ContraptionRunning.GetComponentsInChildren <Engine>(); if (componentsInChildren2.Length > 0) { componentsInChildren2[0].ProcessTouch(); } else { this.ContraptionRunning.m_pig.ProcessTouch(); } break; } case UIEvent.Type.BackFromPreview: { LevelManager.GameState gameState4 = (this.levelManager.gameState != LevelManager.GameState.PreviewWhileRunning) ? LevelManager.GameState.Building : LevelManager.GameState.Continue; this.levelManager.SetGameState(gameState4); break; } case UIEvent.Type.ContinueFromPause: { LevelManager.GameState gameState5 = (this.levelManager.gameState != LevelManager.GameState.PausedWhileRunning) ? LevelManager.GameState.Building : LevelManager.GameState.Continue; this.levelManager.SetGameState(gameState5); break; } case UIEvent.Type.ReplayFlight: this.StopRunningContraption(); this.levelManager.SetGameState(LevelManager.GameState.Running); break; case UIEvent.Type.QuestModeBuild: this.levelManager.PlaceBuildArea(); this.levelManager.SetGameState(LevelManager.GameState.Building); break; case UIEvent.Type.OpenTutorial: this.levelManager.StateBeforeTutorial = this.levelManager.gameState; this.levelManager.SetGameState(LevelManager.GameState.TutorialBook); Singleton <AudioManager> .Instance.Play2dEffect(this.gameData.commonAudioCollection.tutorialIn); GameProgress.IncreaseTutorialBookOpenCount(); this.tutorialBookOpened = true; break; case UIEvent.Type.CloseTutorial: Singleton <AudioManager> .Instance.Play2dEffect(this.gameData.commonAudioCollection.tutorialOut); if (this.levelManager.HasCompleted) { this.levelManager.SetGameState(LevelManager.GameState.Completed); this.levelManager.InGameGUI.LevelCompleteMenu.ResumeAnimations(); } else { this.levelManager.SetGameState(this.levelManager.StateBeforeTutorial); } break; case UIEvent.Type.Snapshot: this.levelManager.SetGameState(LevelManager.GameState.Snapshot); break; case UIEvent.Type.EpisodeSelection: Singleton <GameManager> .Instance.LoadEpisodeSelection(true); break; case UIEvent.Type.ApplySuperGlue: if (this.levelManager.m_SuperGlueAllowed) { int num = GameProgress.SuperGlueCount(); if (num > 0 || this.ContraptionProto.HasRegularGlue) { num += ((!this.ContraptionProto.HasRegularGlue) ? -1 : 1); GameProgress.SetSuperGlueCount(num); GameProgress.Save(); if (this.ContraptionProto.HasRegularGlue) { this.ContraptionProto.RemoveSuperGlue(); if (this.ContraptionProto.HasPart(BasePart.PartType.Egg, BasePart.PartTier.Legendary)) { this.ContraptionProto.ApplySuperGlue(Glue.Type.Alien); } } else { this.ContraptionProto.ApplySuperGlue(Glue.Type.Regular); } EventManager.Send(new InGameBuildMenu.ApplySuperGlueEvent(num, this.ContraptionProto.HasRegularGlue)); } else { this.levelManager.ShowPurchaseDialog(IapManager.InAppPurchaseItemType.SuperGlueSingle); } } break; case UIEvent.Type.ApplySuperMagnet: if (this.levelManager.m_SuperMagnetAllowed) { int num2 = GameProgress.SuperMagnetCount(); if (num2 > 0 || this.ContraptionProto.HasSuperMagnet) { num2 += ((!this.ContraptionProto.HasSuperMagnet) ? -1 : 1); GameProgress.SetSuperMagnetCount(num2); GameProgress.Save(); this.ContraptionProto.HasSuperMagnet = !this.ContraptionProto.HasSuperMagnet; EventManager.Send(new InGameBuildMenu.ApplySuperMagnetEvent(num2, this.ContraptionProto.HasSuperMagnet)); } else { this.levelManager.ShowPurchaseDialog(IapManager.InAppPurchaseItemType.SuperMagnetSingle); } } break; case UIEvent.Type.ApplyTurboCharge: if (this.levelManager.m_TurboChargeAllowed) { int num3 = GameProgress.TurboChargeCount(); if (num3 > 0 || this.ContraptionProto.HasTurboCharge) { num3 += ((!this.ContraptionProto.HasTurboCharge) ? -1 : 1); GameProgress.SetTurboChargeCount(num3); GameProgress.Save(); this.ContraptionProto.HasTurboCharge = !this.ContraptionProto.HasTurboCharge; EventManager.Send(new InGameBuildMenu.ApplyTurboChargeEvent(num3, this.ContraptionProto.HasTurboCharge)); } else { this.levelManager.ShowPurchaseDialog(IapManager.InAppPurchaseItemType.TurboChargeSingle); } } break; case UIEvent.Type.LoadContraptionSlot1: this.LoadContraptionFromSlot(0); break; case UIEvent.Type.LoadContraptionSlot2: this.LoadContraptionFromSlot(1); break; case UIEvent.Type.LoadContraptionSlot3: this.LoadContraptionFromSlot(2); break; case UIEvent.Type.ApplyNightVision: if (this.levelManager.m_darkLevel && this.levelManager.LightManager != null) { int num4 = GameProgress.NightVisionCount(); if (num4 > 0 || this.ContraptionProto.HasNightVision) { num4 += ((!this.ContraptionProto.HasNightVision) ? -1 : 1); GameProgress.SetNightVisionCount(num4); GameProgress.Save(); this.ContraptionProto.HasNightVision = !this.ContraptionProto.HasNightVision; EventManager.Send(new InGameBuildMenu.ApplyNightVisionEvent(num4, this.ContraptionProto.HasNightVision)); } else if (this.ContraptionProto.HasNightVision) { this.levelManager.ConstructionUI.ApplyNightVision(false); num4++; GameProgress.SetNightVisionCount(num4); GameProgress.Save(); EventManager.Send(new InGameBuildMenu.ApplyNightVisionEvent(num4, this.ContraptionProto.HasNightVision)); } else { this.levelManager.ShowPurchaseDialog(IapManager.InAppPurchaseItemType.NightVisionSingle); } } break; } }
public abstract LevelManager.GameState SetGameState(LevelManager.GameState currentState, LevelManager.GameState newState);
public GameStateChanged(LevelManager.GameState state, LevelManager.GameState prevState) { this.state = state; this.prevState = prevState; }
public override LevelManager.GameState SetGameState(LevelManager.GameState currentState, LevelManager.GameState newState) { LevelManager.GameState gameState = currentState; switch (newState) { case LevelManager.GameState.Building: if (GameTime.IsPaused()) { GameTime.Pause(false); } if (currentState == LevelManager.GameState.Running || currentState == LevelManager.GameState.PausedWhileRunning) { base.StopRunningContraption(); this.retries++; if (this.retries == 3 && !this.levelManager.m_sandbox && !this.tutorialBookOpened) { int num = GameProgress.GetInt("Tutorial_Promotion_Count", 0, GameProgress.Location.Local, null); if (num < 3 && !GameProgress.IsLevelCompleted(Singleton <GameManager> .Instance.CurrentSceneName) && GameProgress.GetInt(this.TutorialPromotionCount, 0, GameProgress.Location.Local, null) == 0) { this.openTutorial = true; num++; GameProgress.SetInt("Tutorial_Promotion_Count", num, GameProgress.Location.Local); GameProgress.SetInt(this.TutorialPromotionCount, 1, GameProgress.Location.Local); } } bool @bool = GameProgress.GetBool(Singleton <GameManager> .Instance.CurrentSceneName + "_autobuild_available", false, GameProgress.Location.Local, null); bool bool2 = GameProgress.GetBool("PermanentBlueprint", false, GameProgress.Location.Local, null); if (!this.levelManager.m_sandbox && this.retries % 5 == 0 && AdvertisementHandler.GetRewardNativeTexture() != null) { int @int = GameProgress.GetInt("branded_reward_gifts_today", 0, GameProgress.Location.Local, null); int num2 = 2; if (Singleton <GameConfigurationManager> .IsInstantiated() && Singleton <GameConfigurationManager> .Instance.HasValue("branded_reward_gift_count", "count")) { num2 = Singleton <GameConfigurationManager> .Instance.GetValue <int>("branded_reward_gift_count", "count"); } if (@int < num2) { if (!GameProgress.HasKey("branded_reward_gift_time", GameProgress.Location.Local, null)) { GameProgress.SetInt("branded_reward_gift_time", Singleton <TimeManager> .Instance.CurrentEpochTime, GameProgress.Location.Local); } GameProgress.SetInt("branded_reward_gifts_today", @int + 1, GameProgress.Location.Local); this.openMechanicGift = true; } } } if (this.levelManager.m_toolboxOpenUponShopActivation) { this.levelManager.InGameGUI.BuildMenu.ToolboxButton.OnPressed(); } this.levelManager.SetupDynamicObjects(); base.ContraptionProto.SetVisible(true); if (this.levelManager.ConstructionUI) { this.levelManager.ConstructionUI.SetEnabled(true, true); } if (GameProgress.GetString("REPLAY_LEVEL", string.Empty, GameProgress.Location.Local, null) == SceneManager.GetActiveScene().name&& LightManager.enabledLightPositions != null && LightManager.enabledLightPositions.Count > 0) { PointLightSource[] array = UnityEngine.Object.FindObjectsOfType <PointLightSource>(); for (int i = 0; i < array.Length; i++) { if (LightManager.enabledLightPositions.Contains(array[i].transform.position)) { array[i].isEnabled = true; } } GameProgress.SetString("REPLAY_LEVEL", string.Empty, GameProgress.Location.Local); } break; case LevelManager.GameState.Preview: this.levelManager.m_previewSpeed = 1f; this.levelManager.m_previewTime = 0f; base.ContraptionProto.SetVisible(false); if (this.levelManager.ConstructionUI) { this.levelManager.ConstructionUI.SetEnabled(false, true); } break; case LevelManager.GameState.PreviewMoving: this.levelManager.m_previewTime = 0f; base.ContraptionProto.SetVisible(false); if (this.levelManager.ConstructionUI) { this.levelManager.ConstructionUI.SetEnabled(false, true); } this.levelManager.SetupDynamicObjects(); break; case LevelManager.GameState.PreviewWhileBuilding: if (this.levelManager.EggRequired) { this.levelManager.InGameGUI.PreviewMenu.SetGoal(base.gameData.m_eggTransportGoal); } else if (this.levelManager.PumpkinRequired) { this.levelManager.InGameGUI.PreviewMenu.SetGoal(base.gameData.m_pumpkinTransportGoal); } else { this.levelManager.InGameGUI.PreviewMenu.SetGoal(base.gameData.m_basicGoal); } this.levelManager.InGameGUI.PreviewMenu.SetChallenges(this.levelManager.Challenges); if (this.levelManager.ConstructionUI) { this.levelManager.ConstructionUI.SetEnabled(false, true); } this.levelManager.PreviewCenter = base.ContraptionProto.transform.position; this.levelManager.m_previewDragging = false; break; case LevelManager.GameState.PreviewWhileRunning: this.levelManager.PreviewCenter = base.ContraptionRunning.transform.position; GameTime.Pause(true); this.levelManager.m_previewDragging = false; break; case LevelManager.GameState.Running: if (GameTime.IsPaused()) { GameTime.Pause(false); } this.levelManager.TimeElapsed = 0f; this.levelManager.PartsInGoal.Clear(); this.levelManager.TimeStarted = false; this.levelManager.PigStartPosition = base.ContraptionProto.FindPig().transform.position; if (this.levelManager.ConstructionUI) { this.levelManager.ConstructionUI.SetEnabled(false, false); } base.ContraptionRunning = base.ContraptionProto.Clone(); base.ContraptionProto.SetVisible(false); if (base.ContraptionProto.HasRegularGlue) { if (!base.ContraptionProto.HasGluedParts) { GameProgress.AddSuperGlue(1); } base.ContraptionProto.RemoveSuperGlue(); } if (base.ContraptionProto.HasSuperMagnet) { base.ContraptionProto.HasSuperMagnet = false; } if (base.ContraptionProto.HasNightVision) { this.levelManager.LightManager.ToggleNightVision(); base.ContraptionProto.HasNightVision = false; } base.ContraptionRunning.StartContraption(); if (base.ContraptionProto.HasTurboCharge) { base.ContraptionProto.HasTurboCharge = false; } base.ContraptionRunning.SaveContraption(base.GetCurrentContraptionName()); break; case LevelManager.GameState.Continue: if (GameTime.IsPaused()) { GameTime.Pause(false); } if (gameState == LevelManager.GameState.Building || gameState == LevelManager.GameState.PausedWhileBuilding) { newState = LevelManager.GameState.Building; } else if (gameState == LevelManager.GameState.CustomizingPart) { newState = LevelManager.GameState.CustomizingPart; } else if (!this.levelManager.HasCompleted && gameState == LevelManager.GameState.LootCrateOpening) { newState = LevelManager.GameState.Running; } else { newState = ((!this.levelManager.HasCompleted) ? LevelManager.GameState.Running : LevelManager.GameState.Completed); } break; case LevelManager.GameState.Completed: this.levelManager.InGameGUI.ShowCurrentMenu(false); base.ContraptionRunning.TurnOffAllPoweredParts(); this.levelManager.PlayVictorySound(); if (this.levelManager.EggRequired) { this.levelManager.InGameGUI.LevelCompleteMenu.SetGoal(base.gameData.m_eggTransportGoal); } else if (this.levelManager.PumpkinRequired) { this.levelManager.InGameGUI.LevelCompleteMenu.SetGoal(base.gameData.m_pumpkinTransportGoal); } else { this.levelManager.InGameGUI.LevelCompleteMenu.SetGoal(base.gameData.m_basicGoal); } this.levelManager.InGameGUI.LevelCompleteMenu.SetChallenges(this.levelManager.Challenges); break; case LevelManager.GameState.PausedWhileRunning: GameTime.Pause(true); break; case LevelManager.GameState.PausedWhileBuilding: GameTime.Pause(true); break; case LevelManager.GameState.AutoBuilding: this.levelManager.StartAutoBuild(this.levelManager.m_oneStarContraption); break; case LevelManager.GameState.ShowingUnlockedParts: GameTime.Pause(false); this.levelManager.UnlockedParts = new List <ConstructionUI.PartDesc>(this.levelManager.ConstructionUI.UnlockedParts); this.levelManager.UnlockedPartIndex = -1; this.levelManager.PartShowTimer = 0f; break; case LevelManager.GameState.Snapshot: GameTime.Pause(true); this.levelManager.InGameGUI.ShowCurrentMenu(false); WPFMonoBehaviour.ingameCamera.TakeSnapshot(new Action(this.levelManager.HandleSnapshotFinished)); break; case LevelManager.GameState.SuperAutoBuilding: this.levelManager.StartAutoBuild(this.levelManager.m_threeStarContraption[this.levelManager.CurrentSuperBluePrint]); if (Singleton <SocialGameManager> .IsInstantiated()) { Singleton <SocialGameManager> .Instance.ReportAchievementProgress("grp.CHIPS_FOR_WHIPS", 100.0); } break; } currentState = newState; return(currentState); }
private void UpdatePosition() { LevelManager.GameState gameState = LevelManager.GameState.Building; if (WPFMonoBehaviour.levelManager) { gameState = WPFMonoBehaviour.levelManager.gameState; } this.currentPos = base.transform.position; this.currentFOV = this.m_camera.orthographicSize; switch (gameState) { case LevelManager.GameState.Building: if (this.m_state != IngameCamera.CameraState.Building) { this.StopTransitionToPreview(); } this.m_state = IngameCamera.CameraState.Building; this.UpdateGameCamera(ref this.currentPos, ref this.currentFOV); break; case LevelManager.GameState.Preview: this.currentPos = this.m_cameraPreview.ControlPoints[0].position; this.currentFOV = this.m_cameraPreview.ControlPoints[0].zoom; break; case LevelManager.GameState.PreviewMoving: this.m_cameraPreview.UpdateCameraPreview(ref this.currentPos, ref this.currentFOV); if (this.m_cameraPreview.Done) { WPFMonoBehaviour.levelManager.CameraPreviewDone(); } break; case LevelManager.GameState.PreviewWhileBuilding: if (this.m_state == IngameCamera.CameraState.Building) { this.m_state = IngameCamera.CameraState.Preview; base.StartCoroutine("EnablePreviewMode"); } this.UpdateGameCamera(ref this.currentPos, ref this.currentFOV); break; case LevelManager.GameState.PreviewWhileRunning: this.m_state = IngameCamera.CameraState.Preview; this.UpdateGameCamera(ref this.currentPos, ref this.currentFOV); break; case LevelManager.GameState.Running: if (!WPFMonoBehaviour.levelManager.ContraptionRunning.m_cameraTarget || GameTime.DeltaTime == 0f) { return; } if (this.m_state != IngameCamera.CameraState.Follow) { this.m_state = IngameCamera.CameraState.Follow; this.m_freeCameraMode = false; this.m_autoZoomAmount = 0f; this.m_autoZoomEnabled = true; this.panPosition = Vector3.zero; this.m_mouseZoomDelta = 0f; this.m_birdsCache = null; } this.UpdateGameCamera(ref this.currentPos, ref this.currentFOV); this.currentFOV = Mathf.Clamp(this.currentFOV, 2f, 20f); break; case LevelManager.GameState.Completed: this.UpdateGameCamera(ref this.currentPos, ref this.currentFOV); this.currentFOV = Mathf.Clamp(this.currentFOV, 2f, 20f); break; case LevelManager.GameState.ShowingUnlockedParts: if (this.m_state != IngameCamera.CameraState.Building) { this.StopTransitionToPreview(); } this.m_state = IngameCamera.CameraState.Building; this.UpdateGameCamera(ref this.currentPos, ref this.currentFOV); break; } this.EnforceCameraLimits(ref this.currentPos, ref this.currentFOV); if (!float.IsNaN(this.currentPos.x) && !float.IsNaN(this.currentPos.y) && !float.IsNaN(this.currentPos.z)) { base.transform.position = this.currentPos; } this.m_camera.orthographicSize = this.currentFOV; }