/// <summary> /// Called on every frame /// </summary> protected virtual void Update() { if (BombInfo != null) { var solveds = BombInfo.GetSolvedModuleNames(); var solvables = GetUnsolvedModuleNames(); bool complete = IgnoredModules == null ? solvables.Count <= 1 : solvables.All(IgnoredModules.Contains); if (solveds.Count > OldSolveds.Count) { var TempSolveds = solveds.ToList(); foreach (string module in OldSolveds) { TempSolveds.Remove(module); } OldSolveds = solveds; foreach (string module in TempSolveds) { if (WatchSolves && OnNewStage != null && (IgnoredModules == null || !IgnoredModules.Contains(module))) { OnNewStage(module, complete); } } } } if (TwitchID < 1) { TwitchID = GetTwitchID(); } }
/// <summary> /// Gets the names of the unsolved modules /// </summary> /// <returns>The list of unsolved module names</returns> /// <exception cref="ModuleException">There is no KMBombInfo component attached</exception> protected List <string> GetUnsolvedModuleNames() { if (BombInfo == null) { throw new ModuleException("There is no KMBombInfo component attached!"); } var AllModules = BombInfo.GetSolvableModuleNames(); foreach (string module in BombInfo.GetSolvedModuleNames()) { AllModules.Remove(module); } return(AllModules); }