IEnumerator HandleLight() { int flickerIndex = 0; while (!isDisabled) { if (!lightsAreOn) { // Pause the timer if the lights turn off. if (isLive) { float time = bombModule.GetNeedyTimeRemaining(); bombModule.SetNeedyTimeRemaining((float)Math.Round(time)); } currentScreenColor.a = __flicker[flickerIndex++] * 2.0f; } else { currentScreenColor.a = 1.0f - __flicker[flickerIndex++]; } mainScreen.color = currentScreenColor; flickerIndex %= __flicker.Length; yield return(new WaitForSeconds(0.1f)); } }
protected bool spin() { if (needy.GetNeedyTimeRemaining() > 40) { needy.SetNeedyTimeRemaining(needy.GetNeedyTimeRemaining() + 0); } if ((needy.GetNeedyTimeRemaining() < 40)) { needy.SetNeedyTimeRemaining(needy.GetNeedyTimeRemaining() + 2); } Debug.Log(needy.CountdownTime); return(false); }
IEnumerator ModifyNeedyTimer() { yield return(null); var timer = transform.Find("NeedyTimer(Clone)"); if (timer != null) { var timerScript = timer.GetComponent("NeedyTimer"); if (timerScript != null) { timerScript.SetValue("WarnTime", 50f); } } while (isActive) { yield return(null); needySelf.SetNeedyTimeRemaining(timeLeftManaged * 9.9f); int[] heightCounts = new int[10]; for (int x = 0; x < colorIdxBoard.GetLength(0); x++) { for (int y = 0; y < colorIdxBoard.GetLength(1); y++) { heightCounts[x] += colorIdxBoard[x, y] != 0 ? 1 : 0; } } if (heightCounts.Max() < 15) { timeLeftManaged = Mathf.Min(10f, timeLeftManaged + Time.deltaTime); } } }
// Update is called once per frame void Update() { //Debug.Log("Please F**k me"); if (NeedyActive) { //This keeps the timer number set to the selected number if (Needy.GetNeedyTimeRemaining().ToString() != SelectedNumber.ToString()) { Needy.SetNeedyTimeRemaining(SelectedNumber); } } //This calls the Coroutine to evaluate if the last solve was correct if (Solves != _Bomb.GetSolvedModuleNames().Count()) { MostRecent = GetLatestSolve(_Bomb.GetSolvedModuleNames(), SolveList); SolveList.Add(MostRecent); MostRecent = SolveList[Solves]; Solves = _Bomb.GetSolvedModuleNames().Count(); if (NeedyActive) { LastSolveEvaluation(); return; } else { return; } } }
IEnumerator timeGlitchiness() { while (!moduleSolved) { int displayedtimeremaining = Convert.ToInt32(Math.Floor(module.GetNeedyTimeRemaining())); yield return(new WaitForSeconds(0.25f)); while (solvedPercentage - module.GetNeedyTimeRemaining() >= 2) { yield return(null); module.SetNeedyTimeRemaining(module.GetNeedyTimeRemaining() + 1); yield return(new WaitForSeconds(0.25f)); } module.SetNeedyTimeRemaining(solvedPercentage); } }
protected void AddTime() { float time = NeedyModule.GetNeedyTimeRemaining(); if (time > 0) { NeedyModule.SetNeedyTimeRemaining(Mathf.Min(time + timeGain, timeMax)); } }
private static IEnumerator KeepUnsupportedNeedySilent(KMNeedyModule needyModule) { while (true) { yield return(null); needyModule.SetNeedyTimeRemaining(99f); } }
protected bool AddTime() { float time = NeedyModule.GetNeedyTimeRemaining(); if (time > 0) { NeedyModule.SetNeedyTimeRemaining(Mathf.Min(time + timeGain, timeMax)); } return(false); }
void ButtonPressed(int buttonIndex) { KMSelectable button = holdableButtons[buttonIndex]; Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, button.transform); button.AddInteractionPunch(); if (isEnded || filedIndexes.Contains(buttonIndex)) { return; } int expectedIndex = sortedIndexes[waitingFor]; Audio.PlaySoundAtTransform("FilingSFX", transform); if (!foldersAnimating[waitingFor].isNone && foldersAnimating[waitingFor].OriginalPosition.z != 0f) { foldersAnimating[waitingFor].folder.transform.localPosition = foldersAnimating[waitingFor].OriginalPosition; } AnimatingFolder aFold = new AnimatingFolder(folders[waitingFor], finalNames[buttonIndex][0]); foldersAnimating[waitingFor] = aFold; bool isCorrect = buttonIndex == expectedIndex; Debug.LogFormat("[Bomb Corp. Filing #{0}] {1} filed, {2} expected. Correct: {3}, Index: {4}", _moduleId, finalNames[buttonIndex][0], finalNames[expectedIndex][0], isCorrect ? "y" : "n", buttonIndex); MeshRenderer renderer = button.GetComponent <MeshRenderer>(); if (isCorrect) { float time = NeedyModule.GetNeedyTimeRemaining(); if (time > 0) { NeedyModule.SetNeedyTimeRemaining(time + 2f); } renderer.material = buttonCorrectMat; filedIndexes.Add(buttonIndex); waitingFor++; } else { renderer.material = buttonWrongMat; StartCoroutine(RemoveWrongMat(renderer)); Strike(); } if (waitingFor == 6) { Solve(); } }
void AssignValue() { needySelf.SetNeedyTimeRemaining(Mathf.Max(needySelf.CountdownTime - 2 * currentStreak, 30)); string serialNo = bombInfo.GetSerialNumber(); if (currentStreak == 0) { curCol = char.IsDigit(serialNo[2]) ? int.Parse(serialNo[2].ToString()) : serialNo[2] - 'A' + 1; curRow = char.IsDigit(serialNo[5]) ? int.Parse(serialNo[5].ToString()) : serialNo[5] - 'A' + 1; QuickLog(string.Format("Starting position: Row {0}, Col {1}", curRow, curCol)); } int randomDirection = uernd.Range(0, 4); switch (randomDirection) { case 3: curCol--; goto default; case 2: curRow++; goto default; case 1: curCol++; goto default; case 0: curRow--; goto default; default: curCol = (curCol + 10) % 10; curRow = (curRow + 10) % 10; break; } QuickLog(string.Format("The {0} arrow is shown at {1} streak.", baseDirections[randomDirection], currentStreak)); QuickLog(string.Format("Current Position after moving based on display: Row {0}, Col {1}", curRow, curCol)); QuickLog(string.Format("The desired arrow to press is the {0} arrow for this instance.", baseDirections[directionIDxTable[curRow, curCol]])); isActive = true; StartCoroutine(TypeText(displayDirections[randomDirection].ToString())); isanimating = true; }
// Use this for initialization void Start() { needyModule.OnNeedyActivation += delegate { if (forceDisable) { needyModule.HandlePass(); return; } isActive = true; List <int> tempSegmentsID = segmentIDs.ToList(); curSegmentPos.Clear(); while (tempSegmentsID.Count > 0) { int valueToAdd = tempSegmentsID[Random.Range(0, tempSegmentsID.Count)]; curSegmentPos.Add(valueToAdd); tempSegmentsID.Remove(valueToAdd); } UpdateSegments(); Debug.LogFormat("[Faulty Seven Segment Display #{0}]: The set of the seven segments scrambled for {1} needy activation(s) are:", curModID, activationCount); LogSegments(curSegmentPos.ToArray()); TPDetected = TwitchPlaysActive; if (TPDetected) { needyModule.SetNeedyTimeRemaining(needyModule.GetNeedyTimeRemaining() * 2); } }; needyModule.OnNeedyDeactivation += delegate { isActive = false; }; needyModule.OnTimerExpired += delegate { isActive = false; Debug.LogFormat("[Faulty Seven Segment Display #{0}]: The current set of the seven segments when the time ran out for {1} needy activation(s):", curModID, activationCount++); LogSegments(curSegmentPos.ToArray()); if (!curSegmentPos.SequenceEqual(segmentIDs.ToList())) { needyModule.HandleStrike(); needyModule.SetResetDelayTime(15f, 40f); } else { needyModule.SetResetDelayTime(60f, 160f); } }; foreach (GameObject objCom in segmentObjects) { localPosSeg.Add(objCom.transform.localPosition); localRotSeg.Add(objCom.transform.localEulerAngles); } for (int x = 0; x < segmentSelectables.Length; x++) { int temp = x; segmentSelectables[x].OnInteract += delegate { segmentSelectables[temp].AddInteractionPunch(); audioSelf.PlaySoundAtTransform("tick", transform); if (curSegmentPos.Count > 0) { bool isSelected = false; int idxSelected = -1; for (int u = 0; u < segmentSelectables.Length; u++) { var selectable = segmentSelectables[u]; if (selectable.Highlight.GetComponent <MeshRenderer>().enabled) { isSelected = true; idxSelected = u; } } if (!isSelected) { segmentSelectables[temp].Highlight.GetComponent <MeshRenderer>().enabled = true; } else { SwapSegments(temp, idxSelected); foreach (KMSelectable selectable in segmentSelectables) { selectable.Highlight.GetComponent <MeshRenderer>().enabled = false; } } } return(false); }; } curModID = modID++; Debug.LogFormat("[Faulty Seven Segment Display #{0}]: The correct set of the seven segments are logged as the following:", curModID); LogSegments(); }
// Use this for initialization void Start() { curModID = modID++; for (int x = 0; x < 10; x++) { int y = x; buttonDigitsSelectables[x].OnInteract += delegate { StartCoroutine(HandleButtonAnim(buttonDigitsSelectables[y].gameObject)); audioHandler.PlaySoundAtTransform("keyStroke", buttonDigitsSelectables[y].transform); if (inputText.text.Length < 6 && isActivated) { inputText.text += y; } return(false); }; } clrButtonSelectable.OnInteract += delegate { StartCoroutine(HandleButtonAnim(clrButtonSelectable.gameObject)); audioHandler.PlaySoundAtTransform("keyStroke", clrButtonSelectable.transform); if (isActivated) { if (inputText.text.Length > 0) { inputText.text = ""; } else { float timeLeft = needyHandler.GetNeedyTimeRemaining(); if (timeLeft - 5 > 0.5f && digitsHidden > 0) { needyHandler.SetNeedyTimeRemaining(timeLeft - 5f); revealAnim = HandleRerevealDelay(digitsHidden * 1); StartCoroutine(revealAnim); } } } return(false); }; subButtonSelectable.OnInteract += delegate { StartCoroutine(HandleButtonAnim(subButtonSelectable.gameObject)); audioHandler.PlaySoundAtTransform("keyStroke", subButtonSelectable.transform); if (isActivated) { int givenValue = 0; if (inputText.text.Length > 0 && int.TryParse(inputText.text, out givenValue)) { int goalValue = currentValue - valueToSubtract; if (givenValue == goalValue) { currentValue = givenValue; debugValInput++; if (currentValue < 10) { audioHandler.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform); IncreaseStreak(); } else { audioHandler.PlaySoundAtTransform("correct", transform); digitsHidden = Mathf.Min(digitsHidden + 1, 2); needyHandler.SetNeedyTimeRemaining(needyHandler.GetNeedyTimeRemaining() + (TwitchPlaysActive ? 8f : 5f)); } } else { QuickLog(string.Format("Strike! {0} was incorrectly entered when {1} was expected for the {2} input.", inputText.text, goalValue, debugPositionalNums[debugValInput])); ResetStreak(); needyHandler.HandlePass(); } inputText.text = ""; } } return(false); }; needyHandler.OnActivate += delegate { PrepValues(); }; needyHandler.OnNeedyActivation += delegate { if (forceDisable) { needyHandler.HandlePass(); return; } digitsHidden = 0; valueToSubtract = curStreak > 3 ? streakValues.Last() : streakValues[curStreak]; currentValue = Random.Range(85, 100); QuickLog(string.Format("Starting Value: {0}", currentValue)); List <int> debugValues = new List <int>(); for (int logValue = currentValue - valueToSubtract; logValue > 0; logValue -= valueToSubtract) { debugValues.Add(logValue); if (logValue < 10) { break; } } QuickLog(string.Format("Answers to submit at {1} streak: [ {0} ]", debugValues.Join(", "), curStreak >= 3 ? "3+" : curStreak.ToString())); isActivated = true; if (TwitchPlaysActive) { needyHandler.SetNeedyTimeRemaining(35f); } }; needyHandler.OnTimerExpired += delegate { QuickLog("Letting the needy timer run out was not a good idea after all."); ResetStreak(); }; needyHandler.OnNeedyDeactivation += delegate { isActivated = false; StopAllCoroutines(); }; inputText.text = ""; for (var x = 0; x < progressRenderers.Length; x++) { progressRenderers[x].material.color = Color.green; progressRenderers[x].enabled = false; } displayText.text = ""; }
void FixedUpdate() { if (active) { timeOnRoad = timeOnRoad + Time.fixedDeltaTime; if ((int)(timeOnRoad * 81) % 81 >= 54) { roadNumber = 2; } else if ((int)(timeOnRoad * 81) % 81 >= 27) { roadNumber = 1; } else { roadNumber = 0; } if (!specialPhase) //transform.Rotate(Vector3.up * needy.GetNeedyTimeRemaining()); { if (timeOnRoad >= 28800) //28800 { //Wow, you kept the bus going for eight hours! score++; if (score > 99) { score = 99; } specialPhase = true; roadLane.enabled = false; laneMarker.enabled = false; removeDigits(); showSpecial(); needy.SetNeedyTimeRemaining(60.1f); timeOnRoad = 0; dashboard.material.mainTexture = dashTitleSpecial[2]; } else if (needy.GetNeedyTimeRemaining() < 75.1 && roadPosition == 1) { roadPosition = 2; needy.SetNeedyTimeRemaining(75.1f); sphere.transform.localPosition = new Vector3(handlePosition(), .015f, 0); roadLane.material.mainTexture = roadPos[roadPosition]; laneMarker.material.mainTexture = roadNum[((roadPosition * 3) + roadNumber)]; } else if (needy.GetNeedyTimeRemaining() < 30.1 && roadPosition == 2) { GetComponent <KMAudio>().PlayGameSoundAtTransformWithRef(KMSoundOverride.SoundEffect.NeedyActivated, transform); roadPosition = 3; needy.SetNeedyTimeRemaining(30.1f); sphere.transform.localPosition = new Vector3(handlePosition(), .015f, 0); roadLane.material.mainTexture = roadPos[roadPosition]; laneMarker.material.mainTexture = roadNum[((roadPosition * 3) + roadNumber)]; } doClock(); doMiles(); laneMarker.material.mainTexture = roadNum[((roadPosition * 3) + roadNumber)]; } else { if (timeOnRoad >= 60) { //needed to press start in 60 seconds, so you get a strike :( needy.OnStrike(); active = false; removeSpecial(); needy.HandlePass(); specialPhase = false; timeOnRoad = 0; } } } }