public void ApplyPowerUp(PowerUp.PowerUpType poweUpType) { switch (poweUpType) { case PowerUp.PowerUpType.BombCount: BombCount += 1; UIScript.ChangeText(1, BombCount.ToString()); break; case PowerUp.PowerUpType.Speed: PlayerSpeed = 4; UIScript.ChangeText(0, PlayerSpeed.ToString()); // trail.SetActive(true); break; case PowerUp.PowerUpType.BombDistance: BombDamageDistance += 1; UIScript.ChangeText(2, BombDamageDistance.ToString()); break; case PowerUp.PowerUpType.WallWalking: WallWalking = true; UIScript.ChangeText(3, ""); boardManager.ChangeCollapsingWallTransparency(); break; default: throw new ArgumentOutOfRangeException(nameof(poweUpType), poweUpType, null); } }
public override IEnumerator ReportBombStatus() { if (_gameroom.GetType() == _factoryStaticModeType) { IEnumerator baseIEnumerator = base.ReportBombStatus(); while (baseIEnumerator.MoveNext()) { yield return(baseIEnumerator.Current); } yield break; } InitializeOnLightsOn = false; TwitchBomb bombHandle = TwitchGame.Instance.Bombs[0]; bombHandle.BombName = _infiniteMode ? "Infinite bombs incoming" : $"{BombCount} bombs incoming"; yield return(new WaitUntil(() => GetBomb != null || bombHandle.Bomb.HasDetonated)); if (bombHandle.Bomb.HasDetonated && !_zenMode) { yield break; } float currentBombTimer = bombHandle.CurrentTimer + 5; int currentBombID = 1; while (GetBomb != null) { Object currentBomb = GetBomb; TimerComponent timerComponent = bombHandle.Bomb.GetTimer(); yield return(new WaitUntil(() => timerComponent.IsActive)); if (Math.Abs(currentBombTimer - bombHandle.CurrentTimer) > 1f) { yield return(null); InitializeGameModes(true); } bool enableCameraWall = OtherModes.TrainingModeOn && IRCConnection.Instance.State == IRCConnectionState.Connected && TwitchPlaySettings.data.EnableFactoryTrainingModeCameraWall; if (enableCameraWall != TwitchGame.ModuleCameras.CameraWallEnabled) { if (enableCameraWall) { TwitchGame.ModuleCameras.EnableCameraWall(); } else { TwitchGame.ModuleCameras.DisableCameraWall(); } } bombHandle.BombName = $"Bomb {currentBombID} of {(_infiniteMode ? "∞" : BombCount.ToString())}"; IRCConnection.SendMessage($"Bomb {currentBombID++} of {(_infiniteMode ? "∞" : BombCount.ToString())} is now live."); if (TwitchPlaySettings.data.EnableAutomaticEdgework) { bombHandle.FillEdgework(); } else { bombHandle.EdgeworkText.text = TwitchPlaySettings.data.BlankBombEdgework; } if (OtherModes.Unexplodable) { bombHandle.StrikeLimit += bombHandle.StrikeCount; } IEnumerator bombHold = bombHandle.HoldBomb(); while (bombHold.MoveNext()) { yield return(bombHold.Current); } Bomb bomb1 = (Bomb)_internalBombProperty.GetValue(currentBomb, null); yield return(new WaitUntil(() => { bool result = bomb1.HasDetonated || bomb1.IsSolved() || !TwitchGame.BombActive; if (!result || OtherModes.TimeModeOn) { currentBombTimer = bomb1.GetTimer().TimeRemaining; } return result; })); if (!TwitchGame.BombActive) { yield break; } IRCConnection.SendMessage(TwitchGame.Instance.GetBombResult(false)); TwitchPlaySettings.SetRetryReward(); foreach (TwitchModule handle in TwitchGame.Instance.Modules) { //If the camera is still attached to the bomb component when the bomb gets destroyed, then THAT camera is destroyed as wel. TwitchGame.ModuleCameras.UnviewModule(handle); } if (TwitchPlaySettings.data.EnableFactoryAutomaticNextBomb) { bombHold = bombHandle.LetGoBomb(); while (bombHold.MoveNext()) { yield return(bombHold.Current); } yield return(new WaitForSeconds(1.0f)); //If for some reason we are somehow still holding the bomb, then the Let go did not register. //Try again exactly one more time. if (currentBomb == GetBomb) { bombHold = bombHandle.HoldBomb(); while (bombHold.MoveNext()) { yield return(bombHold.Current); } yield return(new WaitForSeconds(0.10f)); bombHold = bombHandle.LetGoBomb(); while (bombHold.MoveNext()) { yield return(bombHold.Current); } } } //If we are still holding the bomb, wait for it to actually be put down manually, or by a Twitch plays Drop bomb command. while (currentBomb == GetBomb) { yield return(new WaitForSeconds(0.1f)); } bombHandle.StartCoroutine(DestroyBomb(currentBomb)); if (GetBomb == null) { continue; } Bomb bomb = (Bomb)_internalBombProperty.GetValue(GetBomb, null); InitializeBomb(bomb, true); } }
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); } }