private void CreateBombHandleForBomb(MonoBehaviour bomb, int id) { TwitchBombHandle _bombHandle = Instantiate <TwitchBombHandle>(twitchBombHandlePrefab); _bombHandle.bombID = id; _bombHandle.bombCommander = BombCommanders[BombCommanders.Count - 1]; _bombHandle.coroutineQueue = _coroutineQueue; BombHandles.Add(_bombHandle); BombCommanders[BombCommanders.Count - 1].twitchBombHandle = _bombHandle; }
private void CreateBombHandleForBomb(MonoBehaviour bomb, int id) { TwitchBombHandle _bombHandle = Instantiate <TwitchBombHandle>(twitchBombHandlePrefab); _bombHandle.bombID = id; _bombHandle.ircConnection = _ircConnection; _bombHandle.bombCommander = _bombCommanders[_bombCommanders.Count - 1]; _bombHandle.coroutineQueue = _coroutineQueue; _bombHandle.coroutineCanceller = _coroutineCanceller; _bombHandles.Add(_bombHandle); }
private void ToggleEmergencyLights(bool on, TwitchBombHandle handle) { if (_emergencyLightsState == on) { return; } _emergencyLightsState = on; if (!on) { handle.StopCoroutine(_emergencyLightsRoutine); _emergencyLightsRoutine = null; _roomLight.GetComponent <Light>().color = new Color(0.5f, 0.5f, 0.5f); } else { _emergencyLightsRoutine = (IEnumerator)_redLightsMethod.Invoke(_room, null); handle.StartCoroutine(_emergencyLightsRoutine); } }
public override IEnumerator ReportBombStatus() { IEnumerator baseIEnumerator = base.ReportBombStatus(); while (baseIEnumerator.MoveNext()) { yield return(baseIEnumerator.Current); } ValidEdgeworkRegex = new[] { $"^edgework((?: right| left| back| r| l| b)?)$" }; TwitchBombHandle bombHandle = BombMessageResponder.Instance.BombHandles[0]; TimerComponent timerComponent = bombHandle.bombCommander.timerComponent; yield return(new WaitUntil(() => timerComponent.IsActive)); BombMessageResponder.Instance.OnLightsChange(true); _elevatorRoom.PacingActions.RemoveAll(action => action.EventType == PaceEvent.OneMinuteLeft); while (!bombHandle.bombCommander.Bomb.HasDetonated) { if (Input.GetKey(KeyCode.Escape)) { IEnumerator bombDrop = bombHandle.OnMessageReceived(bombHandle.nameText.text, "red", "bomb drop"); while (bombDrop.MoveNext()) { yield return(bombDrop.Current); } } if (bombHandle.bombCommander.Bomb.IsSolved()) { yield break; } ToggleEmergencyLights(SceneManager.Instance.GameplayState.Mission.PacingEventsEnabled && bombHandle.bombCommander.CurrentTimer < 60f && !bombHandle.bombCommander.Bomb.IsSolved()); yield return(null); } }
public override IEnumerator ReportBombStatus() { if (_gameroom.GetType() == _factoryStaticModeType) { IEnumerator baseIEnumerator = base.ReportBombStatus(); while (baseIEnumerator.MoveNext()) { yield return(baseIEnumerator.Current); } yield break; } InitializeOnLightsOn = false; TwitchBombHandle bombHandle = BombMessageResponder.Instance.BombHandles[0]; bombHandle.nameText.text = _infiniteMode ? "Infinite bombs incoming" : $"{BombCount} bombs incoming"; yield return(new WaitUntil(() => GetBomb != null || bombHandle.bombCommander.Bomb.HasDetonated)); if (bombHandle.bombCommander.Bomb.HasDetonated && !_zenMode) { yield break; } float currentBombTimer = bombHandle.bombCommander.timerComponent.TimeRemaining + 5; int currentBombID = 1; while (GetBomb != null) { int reward = TwitchPlaySettings.GetRewardBonus(); UnityEngine.Object currentBomb = GetBomb; TimerComponent timerComponent = bombHandle.bombCommander.timerComponent; yield return(new WaitUntil(() => timerComponent.IsActive)); if (Math.Abs(currentBombTimer - bombHandle.bombCommander.timerComponent.TimeRemaining) > 1f) { yield return(null); InitializeGameModes(true); } bombHandle.nameText.text = $"Bomb {currentBombID} of {(_infiniteMode ? "∞" : BombCount.ToString())}"; IRCConnection.Instance.SendMessage("Bomb {0} of {1} is now live.", currentBombID++, _infiniteMode ? "∞" : BombCount.ToString()); if (OtherModes.ZenModeOn && IRCConnection.Instance.State == IRCConnectionState.Connected && TwitchPlaySettings.data.EnableFactoryZenModeCameraWall) { BombMessageResponder.Instance.OnMessageReceived("Bomb Factory", "!enablecamerawall"); BombMessageResponder.Instance.OnMessageReceived("Bomb Factory", "!modules"); BombMessageResponder.Instance.OnMessageReceived("Bomb Factory", "!modules"); } else { BombMessageResponder.Instance.OnMessageReceived("Bomb Factory", "!disablecamerawall"); } if (TwitchPlaySettings.data.EnableAutomaticEdgework) { bombHandle.bombCommander.FillEdgework(); } else { bombHandle.edgeworkText.text = TwitchPlaySettings.data.BlankBombEdgework; } if (OtherModes.ZenModeOn) { bombHandle.bombCommander.StrikeLimit += bombHandle.bombCommander.StrikeCount; } IEnumerator bombHold = bombHandle.OnMessageReceived("Bomb Factory", "red", "bomb hold"); while (bombHold.MoveNext()) { yield return(bombHold.Current); } Bomb bomb1 = (Bomb)_internalBombProperty.GetValue(currentBomb, null); yield return(new WaitUntil(() => { bool result = bomb1.HasDetonated || bomb1.IsSolved() || !BombMessageResponder.BombActive; if (!result || OtherModes.TimeModeOn) { currentBombTimer = bomb1.GetTimer().TimeRemaining; } return result; })); if (!BombMessageResponder.BombActive) { yield break; } IRCConnection.Instance.SendMessage(BombMessageResponder.Instance.GetBombResult(false)); TwitchPlaySettings.SetRewardBonus(reward); foreach (TwitchComponentHandle handle in BombMessageResponder.Instance.ComponentHandles) { //If the camera is still attached to the bomb component when the bomb gets destroyed, then THAT camera is destroyed as wel. BombMessageResponder.moduleCameras.DetachFromModule(handle.bombComponent); } if (TwitchPlaySettings.data.EnableFactoryAutomaticNextBomb) { bombHold = bombHandle.OnMessageReceived("Bomb Factory", "red", "bomb drop"); while (bombHold.MoveNext()) { yield return(bombHold.Current); } } while (currentBomb == GetBomb) { yield return(new WaitForSeconds(0.10f)); if (currentBomb != GetBomb || !TwitchPlaySettings.data.EnableFactoryAutomaticNextBomb) { continue; } bombHold = bombHandle.OnMessageReceived("Bomb Factory", "red", "bomb hold"); while (bombHold.MoveNext()) { yield return(bombHold.Current); } yield return(new WaitForSeconds(0.10f)); bombHold = bombHandle.OnMessageReceived("Bomb Factory", "red", "bomb drop"); while (bombHold.MoveNext()) { yield return(bombHold.Current); } } bombHandle.StartCoroutine(DestroyBomb(currentBomb)); if (GetBomb == null) { continue; } Bomb bomb = (Bomb)_internalBombProperty.GetValue(GetBomb, null); InitializeBomb(bomb); } }