private IEnumerator CheckForBomb() { yield return(new WaitUntil(() => SceneManager.Instance.GameplayState.Bombs != null && SceneManager.Instance.GameplayState.Bombs.Count > 0)); var bombs = SceneManager.Instance.GameplayState.Bombs; try { ModuleCameras = Instantiate(moduleCamerasPrefab); } catch (Exception ex) { DebugHelper.LogException(ex, "Failed to instantiate the module camera system due to an exception:"); ModuleCameras = null; } if (GameRoom.GameRoomTypes.Where((t, i) => t() != null && GameRoom.CreateRooms[i](FindObjectsOfType(t()), out GameRoom.Instance)).Any()) { GameRoom.Instance.InitializeBombs(bombs); } ModuleCameras?.ChangeBomb(Bombs[0]); try { GameRoom.Instance.InitializeBombNames(); } catch (Exception ex) { DebugHelper.LogException(ex, "An exception has occurred while setting the bomb names"); } StartCoroutine(GameRoom.Instance.ReportBombStatus()); StartCoroutine(GameRoom.Instance.InterruptLights()); try { if (GameRoom.Instance.HoldBomb) { TwitchPlaysService.Instance.CoroutineQueue.AddToQueue(BombCommands.Hold(Bombs[0])); } } catch (Exception ex) { DebugHelper.LogException(ex, "An exception has occurred attempting to hold the bomb."); } for (int i = 0; i < 4; i++) { NotesDictionary[i] = (OtherModes.ZenModeOn && i == 3) ? TwitchPlaySettings.data.ZenModeFreeSpace : TwitchPlaySettings.data.NotesSpaceFree; ModuleCameras?.SetNotes(i, NotesDictionary[i]); } if (EnableDisableInput()) { TwitchModule.SolveUnsupportedModules(true); } while (OtherModes.ZenModeOn) { foreach (var bomb in Bombs) { if (bomb.Bomb.GetTimer() != null && bomb.Bomb.GetTimer().GetRate() > 0) { bomb.Bomb.GetTimer().SetRateModifier(-bomb.Bomb.GetTimer().GetRate()); } } yield return(null); } }
private IEnumerator CheckForBomb() { yield return(new WaitUntil(() => SceneManager.Instance.GameplayState.Bombs != null && SceneManager.Instance.GameplayState.Bombs.Count > 0)); yield return(null); var bombs = SceneManager.Instance.GameplayState.Bombs; try { ModuleCameras = Instantiate(moduleCamerasPrefab); } catch (Exception ex) { DebugHelper.LogException(ex, "Failed to instantiate the module camera system due to an exception:"); ModuleCameras = null; } if (GameRoom.GameRoomTypes.Where((t, i) => t() != null && GameRoom.CreateRooms[i](FindObjectsOfType(t()), out GameRoom.Instance)).Any()) { GameRoom.Instance.InitializeBombs(bombs); } ModuleCameras?.ChangeBomb(Bombs[0]); try { GameRoom.Instance.InitializeBombNames(); } catch (Exception ex) { DebugHelper.LogException(ex, "An exception has occurred while setting the bomb names"); } StartCoroutine(GameRoom.Instance.ReportBombStatus()); StartCoroutine(GameRoom.Instance.InterruptLights()); try { if (GameRoom.Instance.HoldBomb) { StartCoroutine(BombCommands.Hold(Bombs[0])); } } catch (Exception ex) { DebugHelper.LogException(ex, "An exception has occurred attempting to hold the bomb."); } NotesDictionary.Clear(); CommandQueue.Clear(); ModuleCameras?.SetNotes(); if (EnableDisableInput()) { TwitchModule.SolveUnsupportedModules(true); } // Set up some stuff for the !unclaimed command. GameCommands.unclaimedModules = Modules.Where(h => h.CanBeClaimed).Shuffle().ToList(); GameCommands.unclaimedModuleIndex = 0; while (OtherModes.Unexplodable) { foreach (var bomb in Bombs) { if (bomb.Bomb.GetTimer() != null && bomb.Bomb.GetTimer().GetRate() > 0) { bomb.Bomb.GetTimer().SetRateModifier(-bomb.Bomb.GetTimer().GetRate()); } } yield return(null); } TwitchPlaysService.Instance.UpdateUiHue(); }
private IEnumerator CheckForBomb() { yield return(new WaitUntil(() => (SceneManager.Instance.GameplayState.Bombs != null && SceneManager.Instance.GameplayState.Bombs.Count > 0))); List <Bomb> bombs = SceneManager.Instance.GameplayState.Bombs; for (int i = 0; i < GameRoom.GameRoomTypes.Length; i++) { if (GameRoom.GameRoomTypes[i]() != null && GameRoom.CreateRooms[i](FindObjectsOfType(GameRoom.GameRoomTypes[i]()), out GameRoom.Instance)) { GameRoom.Instance.InitializeBombs(bombs); break; } } try { GameRoom.Instance.InitializeBombNames(); } catch (Exception ex) { DebugHelper.LogException(ex, "An exception has occured while setting the bomb names"); } StartCoroutine(GameRoom.Instance.ReportBombStatus()); try { if (GameRoom.Instance.HoldBomb) { _coroutineQueue.AddToQueue(BombHandles[0].OnMessageReceived(BombHandles[0].nameText.text, "red", "bomb hold"), _currentBomb); } } catch (Exception ex) { DebugHelper.LogException(ex, "An exception has occured attempting to hold the bomb."); } try { moduleCameras = Instantiate <ModuleCameras>(moduleCamerasPrefab); } catch (Exception ex) { DebugHelper.LogException(ex, "Failed to Instantiate the module camera system due to an exception:"); moduleCameras = null; } moduleCameras?.ChangeBomb(BombCommanders[0]); for (int i = 0; i < 4; i++) { _notesDictionary[i] = (OtherModes.ZenModeOn && i == 3) ? TwitchPlaySettings.data.ZenModeFreeSpace : TwitchPlaySettings.data.NotesSpaceFree; moduleCameras?.SetNotes(i, _notesDictionary[i]); } if (EnableDisableInput()) { TwitchComponentHandle.SolveUnsupportedModules(true); } while (OtherModes.ZenModeOn) { foreach (BombCommander bomb in BombCommanders) { if (bomb.timerComponent == null || bomb.timerComponent.GetRate() < 0) { continue; } bomb.timerComponent.SetRateModifier(-bomb.timerComponent.GetRate()); } yield return(null); } }