public MysteryWidgetShim(TwitchModule module) : base(module, "widgetModule") { ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType()); module.StartCoroutine(WaitForMysteryWidget()); }
public static IEnumerator Show(TwitchModule module, object yield) { IEnumerator focusCoroutine = module.Bomb.Focus(module.Selectable, module.FocusDistance, module.FrontFace); while (focusCoroutine.MoveNext()) { yield return(focusCoroutine.Current); } yield return(new WaitForSeconds(0.5f)); yield return(yield is float delay ? new WaitForSecondsWithCancel(delay, false, module.Solver) : yield); if (CoroutineCanceller.ShouldCancel) { module.StartCoroutine(module.Bomb.Defocus(module.Selectable, module.FrontFace)); yield break; } IEnumerator defocusCoroutine = module.Bomb.Defocus(module.Selectable, module.FrontFace); while (defocusCoroutine.MoveNext()) { yield return(defocusCoroutine.Current); } yield return(new WaitForSeconds(0.5f)); }
public static IEnumerator Zoom(TwitchModule module, SuperZoomData zoomData, object yield) { var zoomCoroutine = TwitchGame.ModuleCameras?.ZoomCamera(module, zoomData, 1); if (zoomCoroutine != null) { while (zoomCoroutine.MoveNext()) { yield return(zoomCoroutine.Current); } } yield return(yield is float delay ? new WaitForSecondsWithCancel(delay, false, module.Solver) : yield); if (CoroutineCanceller.ShouldCancel) { module.StartCoroutine(TwitchGame.ModuleCameras?.UnzoomCamera(module, zoomData, 0)); yield break; } var unzoomCoroutine = TwitchGame.ModuleCameras?.UnzoomCamera(module, zoomData, 1); if (unzoomCoroutine != null) { while (unzoomCoroutine.MoveNext()) { yield return(unzoomCoroutine.Current); } } }
public ClaimTime(float points, TwitchModule module) : base(points) { this.module = module; module.StartCoroutine(TrackModule()); needyComponent = module.BombComponent.GetComponent <NeedyComponent>(); }
public TurnTheKeyComponentSolver(TwitchModule module) : base(module) { _lock = (MonoBehaviour)LockField.GetValue(Module.BombComponent.GetComponent(ComponentType)); ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "Turn the key at specified time with !{0} turn 8:29"); module.StartCoroutine(ReWriteTurnTheKey()); module.BombComponent.GetComponent <KMBombModule>().OnActivate = OnActivate; SkipTimeAllowed = true; }
public static void BombTurnAround(TwitchModule module) { if (!module.Solver.TurnQueued) { module.Solver.TurnQueued = true; module.StartCoroutine(module.Solver.TurnBombOnSolve()); } IRCConnection.SendMessageFormat(TwitchPlaySettings.data.TurnBombOnSolve, module.Code, module.HeaderText); }
public Deactivations(float points, TwitchModule module) : base(points) { if (module == null) { return; } this.module = module; module.StartCoroutine(TrackModule()); }
public static void Take(TwitchModule module, string user, bool isWhisper) { if (isWhisper) { IRCConnection.SendMessageFormat("Sorry {0}, taking modules is not allowed in whispers.", user); } else if (TwitchPlaySettings.data.AnarchyMode) { IRCConnection.SendMessageFormat("Sorry {0}, taking modules is not allowed in anarchy mode.", user); } // Attempt to take over from another user else if (module.PlayerName != null && user != module.PlayerName) { module.AddToClaimQueue(user); if (module.TakeInProgress == null) { IRCConnection.SendMessageFormat(TwitchPlaySettings.data.TakeModule, module.PlayerName, user, module.Code, module.HeaderText); module.TakeInProgress = module.TakeModule(); module.StartCoroutine(module.TakeInProgress); } else { IRCConnection.SendMessageFormat(TwitchPlaySettings.data.TakeInProgress, user, module.Code, module.HeaderText); } } // Module is already claimed by the same user else if (module.PlayerName != null) { if (!module.PlayerName.Equals(user)) { module.AddToClaimQueue(user); } IRCConnection.SendMessageFormat(TwitchPlaySettings.data.ModuleAlreadyOwned, user, module.Code, module.HeaderText); } // Module is not claimed at all: just claim it else { IRCConnection.SendMessage(module.ClaimModule(user).Second); } }
public static void Take(TwitchModule module, string user, bool isWhisper) { if (isWhisper) { IRCConnection.SendMessage($"@{user}, taking modules is not allowed in whispers."); } else if (TwitchPlaySettings.data.AnarchyMode) { IRCConnection.SendMessage($"@{user}, taking modules is not allowed in anarchy mode."); } // Module is already claimed by the same user else if (module.PlayerName == user) { IRCConnection.SendMessageFormat(TwitchPlaySettings.data.ModuleAlreadyOwned, user, module.Code, module.HeaderText); } // Module is not claimed at all: just claim it else if (module.PlayerName == null) { IRCConnection.SendMessage(module.TryClaim(user).Message); } // Attempt to take over from another user else { module.AddToClaimQueue(user); if (module.TakeInProgress != null) { IRCConnection.SendMessageFormat(TwitchPlaySettings.data.TakeInProgress, user, module.Code, module.HeaderText); } else { IRCConnection.SendMessageFormat(TwitchPlaySettings.data.TakeModule, module.PlayerName, user, module.Code, module.HeaderText); module.TakeUser = user; module.TakeInProgress = module.StartCoroutine(module.ProcessTakeover()); } } }
public static IEnumerator Tilt(TwitchModule module, object yield, string direction) { float easeCubic(float t) { return(3 * t * t - 2 * t * t * t); } Dictionary <string[], int> directionNames = new Dictionary <string[], int>() { { new[] { "up", "u", "top", "t" }, 0 }, { new[] { "upright", "rightup", "ur", "ru", "topright", "righttop", "tr", "rt" }, 45 }, { new[] { "right", "r" }, 90 }, { new[] { "downright", "rightdown", "dr", "rd", "bottomright", "rightbottom", "br", "rb" }, 135 }, { new[] { "down", "d", "bottom", "b" }, 180 }, { new[] { "downleft", "leftdown", "dl", "ld", "bottomleft", "leftbottom", "bl", "lb" }, 255 }, { new[] { "left", "l" }, 270 }, { new[] { "upleft", "leftup", "ul", "lu", "topleft", "lefttop", "tl", "lt" }, 315 }, }; var targetRotation = 180; if (!string.IsNullOrEmpty(direction)) { var nameAngle = directionNames.Where(pair => pair.Key.Contains(direction)).Select(pair => pair.Value); if (nameAngle.Any()) { targetRotation = nameAngle.First(); } else if (int.TryParse(direction, out int directionAngle)) { targetRotation = directionAngle; } else { yield break; } } IEnumerator focusCoroutine = module.Bomb.Focus(module.Selectable, module.FocusDistance, module.FrontFace, false); while (focusCoroutine.MoveNext()) { yield return(focusCoroutine.Current); } yield return(new WaitForSeconds(0.5f)); var targetAngle = Quaternion.Euler(new Vector3(-Mathf.Cos(targetRotation * Mathf.Deg2Rad), 0, Mathf.Sin(targetRotation * Mathf.Deg2Rad)) * (module.FrontFace ? 60 : -60)); foreach (float alpha in 1f.TimedAnimation()) { var lerp = Quaternion.Lerp(Quaternion.identity, targetAngle, easeCubic(alpha)); var bombLerp = module.FrontFace ? lerp : Quaternion.Euler(Vector3.Scale(lerp.eulerAngles, new Vector3(1, 1, -1))); module.Bomb.RotateByLocalQuaternion(bombLerp); TwitchBomb.RotateCameraByLocalQuaternion(module.BombComponent.gameObject, lerp); yield return(null); } yield return(yield is float delay ? new WaitForSecondsWithCancel(delay, false, module.Solver) : yield); if (CoroutineCanceller.ShouldCancel) { var angle = Quaternion.identity; var bombAngle = module.FrontFace ? angle : Quaternion.Euler(Vector3.Scale(angle.eulerAngles, new Vector3(1, 1, -1))); module.Bomb.RotateByLocalQuaternion(bombAngle); TwitchBomb.RotateCameraByLocalQuaternion(module.BombComponent.gameObject, angle); module.StartCoroutine(module.Bomb.Defocus(module.Selectable, module.FrontFace, false)); yield break; } foreach (float alpha in 1f.TimedAnimation()) { var lerp = Quaternion.Lerp(targetAngle, Quaternion.identity, easeCubic(alpha)); var bombLerp = module.FrontFace ? lerp : Quaternion.Euler(Vector3.Scale(lerp.eulerAngles, new Vector3(1, 1, -1))); module.Bomb.RotateByLocalQuaternion(bombLerp); TwitchBomb.RotateCameraByLocalQuaternion(module.BombComponent.gameObject, lerp); yield return(null); } IEnumerator defocusCoroutine = module.Bomb.Defocus(module.Selectable, module.FrontFace, false); while (defocusCoroutine.MoveNext()) { yield return(defocusCoroutine.Current); } yield return(new WaitForSeconds(0.5f)); }
public Deactivations(float points, TwitchModule module) : base(points) { this.module = module; module.StartCoroutine(TrackModule()); }
public AppreciateArtComponentSolver(TwitchModule module) : base(module) { ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "Zoom the module ('!{0} zoom 60') to appreciate the art."); module.StartCoroutine(HandleInteraction()); }