void OperatorPress(KMSelectable operatorButton) { if (moduleSolved || operatorAdded || firstPress == null || !clockOn) { return; } GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform); operatorButton.AddInteractionPunch(); if (operatorButton.GetComponentInChildren <TextMesh>().text == "+") { selectedOperation = "+"; } else if (operatorButton.GetComponentInChildren <TextMesh>().text == "−") { selectedOperation = "−"; } else if (operatorButton.GetComponentInChildren <TextMesh>().text == "×") { selectedOperation = "×"; } else if (operatorButton.GetComponentInChildren <TextMesh>().text == "÷") { selectedOperation = "÷"; } operatorAdded = true; operatorButton.GetComponentInChildren <TextMesh>().color = textColours[1]; }
void ButtonPress(KMSelectable button) { button.AddInteractionPunch(); Debug.LogFormat("[Red Buttons #{0}] You pressed " + button.GetComponentInChildren <TextMesh>().text, moduleId); Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, button.transform); if (moduleSolved) { return; } if (button.GetComponentInChildren <TextMesh>().text != final.ToString()) { wrong = true; } stage++; if (stage == 100) { stage = 0; if (wrong) { StartCoroutine(Strike()); Debug.LogFormat("[Red Buttons #{0}] the sequence was incorrect! Strike!.", moduleId); } else { moduleSolved = true; StartCoroutine(Solve()); Debug.LogFormat("[Red Buttons #{0}] the sequence was correct! Module solved.", moduleId); } } else { Start(); } }
void toggleColor(KMSelectable button) { turnOffKey(); button.GetComponentInChildren <MeshRenderer>().material = materials[1]; button.GetComponentInChildren <TextMesh>().color = Color.black; prevButton = button; }
// Method for acting upon any button pressed void buttonPress(KMSelectable button) { if (moduleSolved || flashing) { //If the module is solved, or resetting, ignore any further button presses return; } Debug.LogFormat("[Caesar's Maths #{0}] Button {1} pressed.", moduleId, button.GetComponentInChildren <TextMesh>().text); // Interaction punch, and sound button.AddInteractionPunch(); GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonPress, transform); // When module is solved: if (button.GetComponentInChildren <TextMesh>().text == correctAnswer.ToString()) { moduleSolved = true; GetComponent <KMBombModule>().HandlePass(); Debug.LogFormat("[Caesar's Maths #{0}] Module solved.", moduleId); flashing = true; StartCoroutine(Solve()); } else { //If module strikes: GetComponent <KMBombModule>().HandleStrike(); Debug.LogFormat("[Caesar's Maths #{0}] Strike! That is not the correct answer.", moduleId); flashing = true; StartCoroutine(Strike()); } }
void ResponsePress(KMSelectable pressedResponse) { if (moduleSolved) { return; } pressedResponse.AddInteractionPunch(.5f); Audio.PlaySoundAtTransform("send", transform); selectedResponse = pressedResponse.GetComponentInChildren <ResponseEmojiName>().emojiName; mrsBobsMessage.text = ""; responseEmojiObject.SetActive(true); selectedTexture = pressedResponse.GetComponentInChildren <Renderer>().material.mainTexture; responseEmoji.material.mainTexture = selectedTexture; if (selectedResponse == correctAnswer) { unreadMessage.SetActive(false); OnNeedyDeactivation(); Debug.LogFormat("[Needy Mrs Bob #{0}] Message sent: {1}. That is correct. Needy deactivated.", moduleId, selectedResponse); } else { unreadMessage.SetActive(false); GetComponent <KMNeedyModule>().HandleStrike(); OnNeedyDeactivation(); Debug.LogFormat("[Needy Mrs Bob #{0}] Strike! Message sent: {1}. That is not correct. Needy deactivated.", moduleId, selectedResponse); } }
void pressDigit(KMSelectable digit) { if (!moduleSolved && interaction) { digit.AddInteractionPunch(.5f); Debug.LogFormat("[D-CODE #{0}] You pressed the {1} glyph at {2}.", moduleid, glyphpos[Array.IndexOf(digits, digit)], bomb.GetFormattedTime()); if (Math.Floor(bomb.GetTime() % 60 % 10) != int.Parse(digit.GetComponentInChildren <TextMesh>().text)) { Debug.LogFormat("[D-CODE #{0}] That was incorrect. Strike.", moduleid); module.HandleStrike(); } else { Debug.LogFormat("[D-CODE #{0}] That was correct.", moduleid); digit.Highlight.gameObject.SetActive(false); digit.GetComponentInChildren <TextMesh>().text = ""; switch (stageCounter) { case 3: sound.PlaySoundAtTransform("SolveSound", transform); Debug.LogFormat("[D-CODE #{0}] Module solved.", moduleid); module.HandlePass(); moduleSolved = true; break; default: sound.PlaySoundAtTransform("StageSound", transform); stageCounter++; break; } } } }
void OnButtonPressed(KMSelectable button) { Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform); button.AddInteractionPunch(0.5f); button.GetComponentInChildren <Animator>().SetTrigger("PushTrigger"); if (AcceptsInput) { if (button == SubmitButton) { ModuleLog("Submitting {0}...", DisplayText.text); if (Answer.ToString() == DisplayText.text) { ModuleLog("Correct! Module disarmed."); AcceptsInput = false; Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform); Module.HandlePass(); } else { ModuleLog("Strike! Incorrect answer."); Module.HandleStrike(); } } else if (button == ClearButton) { DisplayText.text = (DisplayText.text.Length == 0) ? "-" : ""; } else if (DisplayText.text.Length < 6) { DisplayText.text += button.GetComponentInChildren <TextMesh>().text; } } StartCoroutine(PlayReleaseAfterDelay()); }
void turnOffKey() { if (prevButton != null) { prevButton.GetComponentInChildren <MeshRenderer>().material = materials[0]; prevButton.GetComponentInChildren <TextMesh>().color = Color.white; prevButton = null; } }
void buttonPress(KMSelectable button, int indv) { if (moduleSolved || nowOnStrike || buttonPressed[indv]) { return; } button.AddInteractionPunch(); GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform); Debug.LogFormat("[Siffron #{0}] You pressed {1}.", moduleId, button.GetComponentInChildren <TextMesh>().text); if (blueWordsIndex.Contains(button.GetComponentInChildren <TextMesh>().text)) { button.GetComponentInChildren <TextMesh>().color = fontColours[buttonNumbers[indv] + 2]; buttonPressed[indv] = true; } else { GetComponent <KMBombModule>().HandleStrike(); Debug.LogFormat("[Siffron #{0}] Strike! You pressed wrong button.", moduleId); for (int i = 0; i < 4; i++) { buttons[i].GetComponentInChildren <TextMesh>().color = fontColours[0]; buttonPressed[i] = false; } blueWordsIndex.Clear(); sortedButtonBValue.Clear(); applyVar = false; StartCoroutine(Strike(indv)); return; } for (int i = 0; i < 4; i++) { if (blueWordsIndex.Contains(buttonStrings[i])) { ansCount++; } if (buttonPressed[i] == true) { buttonCount++; } } if (ansCount == buttonCount) { moduleSolved = true; GetComponent <KMBombModule>().HandlePass(); Debug.LogFormat("[Siffron #{0}] All correct button pressed, Module solved.", moduleId); GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform); StartCoroutine(Solved()); } ansCount = 0; buttonCount = 0; }
void Start() { pickYears(); pickZodiacs(); year.GetComponentInChildren <TextMesh>().text = yearOptions[0]; zodiac.GetComponentInChildren <TextMesh>().text = zodiacOptions[0]; Debug.LogFormat("[Chinese Zodiac #{0}] The year options are {1}, {2}, {3}, {4}, and {5}.", moduleID, yearOptions[0], yearOptions[1], yearOptions[2], yearOptions[3], yearOptions[4]); Debug.LogFormat("[Chinese Zodiac #{0}] The zodiac options are {1}, {2}, {3}, {4}, and {5}.", moduleID, logZodiac(zodiacOptions[0]), logZodiac(zodiacOptions[1]), logZodiac(zodiacOptions[2]), logZodiac(zodiacOptions[3]), logZodiac(zodiacOptions[4])); Debug.LogFormat("[Chinese Zodiac #{0}] The correct year is {1}", moduleID, correctYear); Debug.LogFormat("[Chinese Zodiac #{0}] The correct zodiac is {1}", moduleID, logZodiac(correctZodiac)); }
void MixButtons() { var cl = Enumerable.Range(0, 6).ToList(); cl.Shuffle(); leftButton.GetComponent <MeshRenderer>().material.color = color[cl[0]].Color; rightButton.GetComponent <MeshRenderer>().material.color = color[cl[1]].Color; leftButton.GetComponentInChildren <TextMesh>().text = cl[0] <= 3 ? "YES" : "NO"; rightButton.GetComponentInChildren <TextMesh>().text = cl[0] > 3 ? "YES" : "NO"; leftButton.GetComponentInChildren <TextMesh>().color = cl[0] <= 3 ? color.First(col => col.ColorName == "green").Color : color.First(col => col.ColorName == "red").Color; rightButton.GetComponentInChildren <TextMesh>().color = cl[0] > 3 ? color.First(col => col.ColorName == "green").Color : color.First(col => col.ColorName == "red").Color; }
void keypadPress(KMSelectable number) { GetComponent <KMSelectable>().AddInteractionPunch(0.5f); Audio.PlaySoundAtTransform("keyStroke", transform); if (moduleSolved) { return; } if (screenInput.text.Length < 3) { screenInput.text += number.GetComponentInChildren <TextMesh>().text; keyPressTotal += number.GetComponentInChildren <ButtonValues>().buttonValue; pressedColours.Add(number.GetComponent <Renderer>().material); } }
void Awake() { moduleId = moduleIdCounter++; foreach (KMSelectable letter in keyboard) { KMSelectable pressedLetter = letter; letter.OnInteract += delegate() { letterPress(pressedLetter.GetComponentInChildren <TextMesh>().text); return(false); }; } moduleSolved = false; if (ignoredModules == null) { ignoredModules = GetComponent <KMBossModule>().GetIgnoredModules("Forget Enigma", new string[] { "Forget Everything", "Forget Infinity", "Forget Me Not", "Forget Them All", "Forget This", "Forget Enigma", "Four-Card Monte", "Purgatory", "Simon's Stages", "Souvenir", "Tallordered Keys", "The Time Keeper", "Timing is Everything", "Turn The Key" }); } Module.OnActivate += OnActivate; }
void AxisButtonPress(KMSelectable axisButton) { if (!active) { return; } var currentRotation = rotationNames[rotationIndex].ToCharArray(); axisButton.AddInteractionPunch(.5f); if (axisButton.GetComponentInChildren <TextMesh>().text != currentRotation[enteringStage].ToString()) { Debug.LogFormat("[Hyperneedy #{0}] Pressed the button {1}, that is incorrect. Strike!", moduleId, axisButton.GetComponentInChildren <TextMesh>().text); module.OnStrike(); enteringStage = 0; } else { Debug.LogFormat("[Hyperneedy #{0}] Pressed the button {1}, that is correct.", moduleId, axisButton.GetComponentInChildren <TextMesh>().text); enteringStage++; audio.PlaySoundAtTransform("Bleep" + rnd.Range(1, 11).ToString(), axisButton.transform); } if (enteringStage == 2) { Debug.LogFormat("[Hyperneedy #{0}] Pressed the button {1}, that is correct. Module temporarily neutralized!", moduleId, axisButton.GetComponentInChildren <TextMesh>().text); module.OnPass(); OnNeedyDeactivation(); } }
public void ShowNoteButton() { if (moduleSolved) { return; } GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform); showNoteButton.AddInteractionPunch(); if (showNoteButton.GetComponentInChildren <TextMesh>().text == noteToSelfOptions[2]) { CheckIngredients(); } else if (!noteActive) { noteActive = true; noteToSelf.SetActive(true); noteToSelfText.text = noteToSelfOptions[1]; } else { noteActive = false; noteToSelf.SetActive(false); noteToSelfText.text = noteToSelfOptions[0]; } }
public void PressIngredientButton() { if (moduleSolved) { return; } GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform); ingredientButton.AddInteractionPunch(); noteActive = false; noteToSelf.SetActive(false); recipe.SetActive(true); noteToSelfText.text = noteToSelfOptions[2]; if (stage < 20) { recipeText[stage].text += " " + ingredientButton.GetComponentInChildren <TextMesh>().text; ingredientsAdded.Add(ingredientOptions[displayedIngredientIndex]); } if (stage < correctIngredients.Count()) { if (ingredientsAdded[stage] != correctIngredients[stage]) { correct = false; } } else { correct = false; } Debug.LogFormat("[The Hangover #{0}] {1}) *{2}* added to your elixir.", moduleId, (stage + 1), ingredientOptions[displayedIngredientIndex]); stage++; }
private void KeyHL(KMSelectable key) { if (keys.IndexOf(key) == blackkey && moduleSolved == false) { keyID[keys.IndexOf(key)].material = keyColours[6]; key.GetComponentInChildren <TextMesh>().text = String.Empty; } }
private void KeyHL(KMSelectable key) { if (alreadypressed[keys.IndexOf(key)] == false && moduleSolved == false && pressable == true) { keyID[keys.IndexOf(key)].material = keyColours[8]; key.GetComponentInChildren <TextMesh>().text = String.Empty; } }
void onDigitPress(KMSelectable digit) { audio.PlaySoundAtTransform(sounds[1].name, transform); if (userInput.text.Length < 6) { userInput.text += digit.GetComponentInChildren <TextMesh>().text; } }
void PressNormalButton(KMSelectable button) { if (!solved) { button.AddInteractionPunch(); StartCoroutine(ButtonAnimation(button.transform)); sound.PlaySoundAtTransform(button.GetComponentInChildren <TextMesh>().text, transform); if (dialtone != null) { StopCoroutine(dialtone); } if (recording) { text.text += button.GetComponentInChildren <TextMesh>().text; } } }
void keyPressed(KMSelectable pressedKey) { audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.TypewriterKey, transform); if (!clicked) { Display.text = ""; clicked = true; } if (!moduleSolved) { Display.text = Display.text + pressedKey.GetComponentInChildren <TextMesh>().text; Debug.LogFormat("[Rot Decoding #{0}] " + "You pressed " + pressedKey.GetComponentInChildren <TextMesh>().text, moduleId); } }
private void KeyPress(KMSelectable key) { Audio.PlaySoundAtTransform("Mii Channel Typewriter Sound Effect", transform); if (useranswer.text.Length > 9) { return; } combine += key.GetComponentInChildren <TextMesh>().text; useranswer.GetComponentInChildren <TextMesh>().text = combine; }
IEnumerator MoveScale(bool mode) { float duration; if (mode) { duration = 3.45f; } else { duration = 2.497f; } var elapsed = 0f; while (elapsed < duration) { yield return(null); elapsed += Time.deltaTime; if (mode) { Go.transform.localScale = Vector3.Lerp(scale[0], scale[1], elapsed / duration); Go.transform.localPosition = Vector3.Lerp(pos[0], pos[1], elapsed / duration); Go.GetComponent <MeshRenderer>().material.color = Color32.Lerp(Color.black, Color.white, elapsed / duration); Go.GetComponentInChildren <TextMesh>().color = Color32.Lerp(Color.white, Color.black, elapsed / duration); BG.GetComponent <MeshRenderer>().material.color = Color32.Lerp(Color.white, Color.black, elapsed / duration); Border.GetComponent <MeshRenderer>().material.color = Color32.Lerp(Color.white, Color.black, elapsed / duration); } else { Go.transform.localScale = Vector3.Lerp(scale[1], scale[0], elapsed / duration); Go.transform.localPosition = Vector3.Lerp(pos[1], pos[0], elapsed / duration); Go.GetComponent <MeshRenderer>().material.color = Color32.Lerp(Color.white, Color.black, elapsed / duration); Go.GetComponentInChildren <TextMesh>().color = Color32.Lerp(Color.black, Color.white, elapsed / duration); BG.GetComponent <MeshRenderer>().material.color = Color32.Lerp(Color.black, Color.white, elapsed / duration); Border.GetComponent <MeshRenderer>().material.color = Color32.Lerp(Color.black, Color.white, elapsed / duration); } } if (mode) { StartCoroutine(Cycle()); } }
void ButtonPress(KMSelectable button) { audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, button.transform); button.AddInteractionPunch(); if (isActive) { Debug.LogFormat("[Flag Identification #{0}] Pressed {1}", moduleId, button.GetComponentInChildren <TextMesh>().text); if (button.GetComponentInChildren <TextMesh>().text == correctAnswer) { Solve(); } else { Debug.LogFormat("[Flag Identification #{0}] STRIKE: Pressed {1}, Flag was {2}.", moduleId, button.GetComponentInChildren <TextMesh>().text, correctAnswer); GetComponent <KMNeedyModule>().OnStrike(); Solve(); } } }
void WordPress(KMSelectable word) { if (moduleSolved || flashing || pressedWords.Contains(word.GetComponentInChildren <TextMesh>().text)) { return; } word.AddInteractionPunch(); Audio.PlaySoundAtTransform(sounds[stage].name, transform); pressedWords.Add(word.GetComponentInChildren <TextMesh>().text); word.GetComponentInChildren <TextMesh>().color = fontColours[1]; correctAnswer = correctColumn[chosenWordsIndicesOrdered[stage]]; Debug.LogFormat("[T-Words #{0}] You pressed {1}.", moduleId, word.GetComponentInChildren <TextMesh>().text); if (word.GetComponentInChildren <TextMesh>().text != correctAnswer) { incorrect = true; } stage++; if (stage == 4) { stage = 0; if (!incorrect) { Audio.PlaySoundAtTransform(sounds[4].name, transform); moduleSolved = true; GetComponent <KMBombModule>().HandlePass(); Debug.LogFormat("[T-Words #{0}] Module solved.", moduleId); flashing = true; StartCoroutine(Solved()); } else { Audio.PlaySoundAtTransform(sounds[5].name, transform); incorrect = false; GetComponent <KMBombModule>().HandleStrike(); Debug.LogFormat("[T-Words #{0}] Strike! You did not enter the words in the correct order.", moduleId); chosenWordsIndicesOrdered.Clear(); chosenWordsIndices.Clear(); pressedWords.Clear(); flashing = true; StartCoroutine(Strike()); } } }
void Awake() { moduleId = moduleIdCounter++; foreach (KMSelectable letter in keyboard) { KMSelectable pressedLetter = letter; letter.OnInteract += delegate() { letterPress(pressedLetter.GetComponentInChildren <TextMesh>().text); return(false); }; } moduleSolved = false; }
void PressATGCButton(KMSelectable btn) { GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform); btn.AddInteractionPunch(.5f); if (inputPos < 12 && !moduleSolved && !checking) { input[inputPos] = btn.GetComponentInChildren <TextMesh>().text[0]; boxes[0].GetComponentsInChildren <Renderer>()[inputPos].material = ColorConversionGlow(input[inputPos]); inputPos++; } }
void TrianglePress(KMSelectable triangle) { if (moduleSolved) { return; } triangle.AddInteractionPunch(); pressedColour = triangle.GetComponentInChildren <TriangleColour>().triangleColour; if (pressedColour == correctColour) { Audio.PlaySoundAtTransform("beep", transform); triangle.GetComponentInChildren <TriangleColour>().pressed = true; Debug.LogFormat("[The Triangle #{0}] You pressed {1}. That is correct.", moduleId, pressedColour); if (triangleNames[0].pressed && triangleNames[1].pressed && triangleNames[2].pressed && triangleNames[3].pressed) { moduleSolved = true; } if (moduleSolved) { GetComponent <KMBombModule>().HandlePass(); Debug.LogFormat("[The Triangle #{0}] Module disarmed.", moduleId); triangleRotation.SetTrigger("solved"); triangleText.text = ""; if (colorblindActive) { for (int i = 0; i < colorblindText.Length; i++) { colorblindText[i].text = ""; } } return; } } else { GetComponent <KMBombModule>().HandleStrike(); Debug.LogFormat("[The Triangle #{0}] Strike! You pressed {1}. That is incorrect.", moduleId, pressedColour); } Start(); }
// When a key is pressed bool PressKey(KMSelectable key) { GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, key.transform); key.AddInteractionPunch(0.25f); if (inputMode == true) { submitKey += key.GetComponentInChildren <TextMesh>().text.ToString(); ScreenDisplay(submitKey); pressedNumber = submitKey.Length; checkInput(pressedNumber); } return(false); }
private void ButtonPress(KMSelectable button) { if (moduleSolved) { return; } button.AddInteractionPunch(); Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform); Debug.LogFormat("[Tribal Council #{0}] You voted for {1}.", moduleId, button.GetComponentInChildren <TextMesh>().text); if (button.GetComponentInChildren <TextMesh>().text != correctanswer2 && button.GetComponentInChildren <TextMesh>().text != correctanswer) { strike = true; } if (strike == false) { moduleSolved = true; GetComponent <KMBombModule>().HandlePass(); Debug.LogFormat("[Tribal Council #{0}] Module Solved.", moduleId); foreach (var but in buttons) { but.GetComponentInChildren <TextMesh>().color = fontcolor[1]; } parchmenttext.text = button.GetComponentInChildren <TextMesh>().text; parchmenttext.color = fontcolor[0]; Audio.PlaySoundAtTransform("JeffProbst-TribeHasSpoken", transform); } else { GetComponent <KMBombModule>().HandleStrike(); Debug.LogFormat("[Tribal Council #{0}] You did not vote out the right person.", moduleId); strike = false; } }