private IEnumerator delay() { yield return(new WaitForSeconds(1f)); if (TimeModeActive) { timeMode = true; Debug.LogFormat("[Timing is Everything #{0}] Current Mode: Time", moduleId); Debug.LogFormat("[Timing is Everything #{0}] Time Mode is active! This means that new times will NOT be generated and no strikes will occur unless pressed at an incorrect time!", moduleId); Button.GetComponent <MeshRenderer>().material = buttonColors[1]; } else if (ZenModeActive) { zenMode = true; Debug.LogFormat("[Timing is Everything #{0}] Current Mode: Zen", moduleId); Debug.LogFormat("[Timing is Everything #{0}] Zen Mode is active! This means that times go up instead of down!", moduleId); Button.GetComponent <MeshRenderer>().material = buttonColors[2]; timeA *= 2; //timeB += 30; //timeC += 30; GenerateStrings(timeA, strA, 1); //GenerateStrings(timeB, strB, 2); //GenerateStrings(timeC, strC, 3); Text.text = strC; } else { Debug.LogFormat("[Timing is Everything #{0}] Current Mode: Normal", moduleId); } moduleReady = true; Debug.LogFormat("[Timing is Everything #{0}] The times are: {1}, {2}, and {3}.", moduleId, strA, strB, strC); StopCoroutine("delay"); }
void SetBuildingsScene() { Display.SetActive(false); CookieButton.gameObject.SetActive(false); Buildings.gameObject.SetActive(false); Rebirth.gameObject.SetActive(false); Buildings_Display.GetComponent <Renderer>().enabled = true; Buildings_Display.Highlight.gameObject.SetActive(true); Buildings_Text.GetComponent <Renderer>().enabled = true; foreach (KMSelectable multiplier in MultiplierButtons) { multiplier.GetComponent <Renderer>().enabled = true; multiplier.Highlight.gameObject.SetActive(true); } foreach (TextMesh multitext in MultiText) { multitext.GetComponent <Renderer>().enabled = true; } Pay_Amount.GetComponent <Renderer>().enabled = true; Pay_Amount_text.GetComponent <Renderer>().enabled = true; Cookie_Amount.GetComponent <Renderer>().enabled = true; Cookie_Amount_text.GetComponent <Renderer>().enabled = true; Return_Button.GetComponent <Renderer>().enabled = true; Return_Button.Highlight.gameObject.SetActive(true); Return_Button_text.GetComponent <Renderer>().enabled = true; Cookie_Amount_text.text = calcscript.ConvertToScientific(Convert.ToDouble(CookieCount.text)); Buildings_Text.text = "Grandma"; }
private KMSelectable.OnInteractHandler GetButtonPressHandler(int index, KMSelectable obj, string sound) { return(delegate { if (_mustPress == null || !_pressed.Add(index)) { return false; } obj.AddInteractionPunch(); obj.transform.localPosition = new Vector3(obj.transform.localPosition.x, 0.014f, obj.transform.localPosition.z); if (!_mustPress.Contains(index)) { obj.GetComponent <MeshRenderer>().material = MatWrong; Debug.LogFormat("[Rock-Paper-Scissors-Lizard-Spock #{1}] {0} is wrong.", _names[index], _moduleId); Module.HandleStrike(); } else { Audio.PlaySoundAtTransform(sound, obj.transform); obj.GetComponent <MeshRenderer>().material = MatCorrect; var solved = false; if (!_mustPress.Except(_pressed).Any()) { solved = true; _mustPress = null; Module.HandlePass(); } Debug.LogFormat("[Rock-Paper-Scissors-Lizard-Spock #{1}] {0} is correct.{2}", _names[index], _moduleId, solved ? " Module solved." : ""); } return false; }); }
void WireSnip(KMSelectable clickedWire) { Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.WireSnip, clickedWire.transform); clickedWire.AddInteractionPunch(); cutWireObjects[clickedWire.GetComponent <WireDetails>().wireIndex].SetActive(true); cutWireObjects[clickedWire.GetComponent <WireDetails>().wireIndex].GetComponentInChildren <Renderer>().material = wireMaterialOptions[clickedWire.GetComponent <WireDetails>().materialIndex]; if (moduleSolved) { Debug.LogFormat("[Skinny Wires #{0}] Strike! Continuing to cut wires after the module has been disarmed can only end badly.", moduleId); GetComponent <KMBombModule>().HandleStrike(); clickedWire.GetComponent <WireDetails>().wireObject.SetActive(false); return; } if (clickedWire.GetComponent <WireDetails>().correctWire) { Debug.LogFormat("[Skinny Wires #{0}] You cut wire {1}{2}. That is correct. Module disarmed.", moduleId, clickedWire.GetComponent <WireDetails>().letterIndex, clickedWire.GetComponent <WireDetails>().numberIndex); GetComponent <KMBombModule>().HandlePass(); moduleSolved = true; } else { Debug.LogFormat("[Skinny Wires #{0}] Strike! You cut wire {1}{2}. That is incorrect.", moduleId, clickedWire.GetComponent <WireDetails>().letterIndex, clickedWire.GetComponent <WireDetails>().numberIndex); GetComponent <KMBombModule>().HandleStrike(); } clickedWire.GetComponent <WireDetails>().wireObject.SetActive(false); }
void Start() { thisModuleNumber = moduleNumber++; loadSettings(); GetComponent <KMBombModule>().OnActivate += OnActivate; position = Random.Range(0, 12); WheelButton.GetComponent <Transform>().Rotate(new Vector3(0, 1, 0), (position * -360.0f / 12.0f)); selectChord(); FindSolution(); }
// Gets edgework and sets up display private void Start() { ModuleButton.GetComponent <MeshRenderer>().material = StageTaps[0]; lastDigit = Bomb.GetSerialNumberNumbers().Last(); sumOfDigits = Bomb.GetSerialNumberNumbers().Sum(); // Displays solution in log Debug.LogFormat("[Mistake #{0}] First, touch the module anytime.", moduleId); Debug.LogFormat("[Mistake #{0}] Second, touch the module when the last digit of the timer is {1}.", moduleId, lastDigit); Debug.LogFormat("[Mistake #{0}] Third, touch the module when the seconds sections of the timer is {1}.", moduleId, sumOfDigits); }
private bool ButtonPress() { if(leakSfxRef != null) leakSfxRef.StopSound(); steamPlaying = false; Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform); Button.GetComponent<KMSelectable>().AddInteractionPunch(); buttonPressed = true; buttonSinglePressTimer = 0; Button.gameObject.transform.Translate( Vector3.Scale(ButtonPushedOffset, transform.parent.parent.localScale)); return false; }
public Pusher(KMSelectable selectable, FaceRotation[] moves, int[] moveIndexes, Vector3 localPos, params Vector3[] localAngles) { Moves = moves; MoveIndexes = moveIndexes; LocalPosition = localPos; LocalEulerAngles = localAngles; Selectable = selectable; MeshRenderer = Selectable.GetComponent <MeshRenderer>(); MeshFilter = Selectable.GetComponent <MeshFilter>(); HighlightMeshFilter = Selectable.transform.Find("Highlight").Find("Highlight(Clone)").GetComponent <MeshFilter>(); }
void MixButtons() { if (Random.Range(0, 10) < 5) { leftButton.GetComponent <MeshRenderer>().material.color = green; rightButton.GetComponent <MeshRenderer>().material.color = blue; } else { leftButton.GetComponent <MeshRenderer>().material.color = blue; rightButton.GetComponent <MeshRenderer>().material.color = green; } }
void Start() { SN = Bomb.GetSerialNumber(); Callitsomethingyoucanremember = (int)Char.GetNumericValue(SN[5]); StartingWeed = UnityEngine.Random.Range(0, Position.Count()); You = StartingWeed; F**k = Position[StartingWeed]; Ball.GetComponent <MeshRenderer>().material = color[F**k]; Debug.LogFormat("[1D Maze #{0}] You started at cell {1}.", moduleId, (You + 1)); Debug.LogFormat("[1D Maze #{0}] The desired cell is any in row {1}.", moduleId, (Bomb.GetSerialNumberNumbers().Last())); }
private void SetTextures() { for (int var = 0; var < _unselectableButtons.Length; var++) { for (int i = 0; i < _unselectableButtons[var].Count; i++) { _unselectableButtons[var][i].GetComponent <MeshFilter>().mesh = _selected[var] ? ButtonTrue : ButtonFalse; _unselectableButtons[var][i].GetComponent <MeshRenderer>().material = (_selected[var] ? Greens : Reds)[var + 1]; } Buttons[var].GetComponent <MeshFilter>().mesh = _selected[var] ? ButtonTrue : ButtonFalse; Buttons[var].GetComponent <MeshRenderer>().material = (_selected[var] ? Greens : Reds)[var + 1]; } SubmitButton.GetComponent <MeshFilter>().mesh = _isSolved ? ButtonTrue : ButtonFalse; SubmitButton.GetComponent <MeshRenderer>().material = (_isSolved ? Greens : Reds)[0]; }
public void AztecButton(KMSelectable button) { if (aztecSolved) { return; } button.AddInteractionPunch(0.5f); Audio.PlaySoundAtTransform("sand", transform); aztecClicks++; aztecWeightAdded += button.GetComponent <aztecButton>().buttonValue; if (aztecClicks % aztecReset == 0) { if (aztecButtonsScript[0].buttonValue == 1) { aztecButtonsScript[0].buttonValue = 2; aztecButtonsScript[1].buttonValue = 1; foreach (aztecButton azButton in aztecButtonsScript) { azButton.buttonText.text = azButton.buttonValue.ToString() + " KG"; } } else { aztecButtonsScript[0].buttonValue = 1; aztecButtonsScript[1].buttonValue = 2; foreach (aztecButton azButton in aztecButtonsScript) { azButton.buttonText.text = azButton.buttonValue.ToString() + " KG"; } } } }
void Start() { moduleId = moduleIdCounter++; General = transform.Find("Buttons").gameObject; shuffled = allWords; wordList = shuffled.Shuffle().ToList(); Children = GetComponent <KMSelectable>().Children; for (int i = 0; i < 6; i++) { int index = rnd.Range(0, wordList.Count); currentWords.Add(wordList[index]); wordList.RemoveAt(index); } rule1 = GetComponent <KMBombInfo>().GetModuleIDs().ToArray().Intersect(new[] { "WireSequence", "Wires", "WhosOnFirst", "NeedyVentGas", "Simon", "Password", "Morse", "Memory", "Maze", "NeedyKnob", "Keypad", "Venn", "NeedyCapacitor", "BigButton" }).Any(); rule2 = GetComponent <KMBombInfo>().GetOnIndicators().Count() >= 2; rule3 = Array.Exists(GetComponent <KMBombInfo>().GetModuleNames().ToArray(), item => item.ToUpperInvariant().StartsWith("V") && item != "V"); rule4 = GetComponent <KMBombInfo>().GetBatteryCount(Battery.AA) > GetComponent <KMBombInfo>().GetBatteryCount(Battery.D); rule5 = GetComponent <KMBombInfo>().GetModuleNames().Count % 3 == 0; correctWord = rule1 || rule2 || rule3 || rule4 || rule5?getWordInCommon(rule1? 3 : rule2? 5 : rule3? 4 : rule4? 1 : 6) : currentWords[1]; Debug.LogFormat("[V #{0}] Words are: {1}, {2}, {3}, {4}, {5}, {6}", moduleId, currentWords[0], currentWords[1], currentWords[2], currentWords[3], currentWords[4], currentWords[5]); Debug.LogFormat("[V #{0}] Rule {1} applied.", moduleId, rule1 ? 1 : rule2 ? 2 : rule3 ? 3 : rule4 ? 4 : rule5 ? 5 : 6); Debug.LogFormat("[V #{0}] Correct word to press is {1}.", moduleId, correctWord); for (int i = 0; i < Children.Length; i++) { KMSelectable Selectable = Children[i]; Selectable.transform.Find("Faces").Find("Face1").Find("Text").GetComponent <TextMesh>().text = currentWords[i]; Selectable.OnInteract += () => buttonInteract(Selectable, Selectable.GetComponent <vButton>().btnIndex); } return; }
public TileInfo(int location, KMSelectable selectable) { Location = location; KMSelectable = selectable; GameObject = selectable.gameObject; Transform = selectable.transform; _meshRenderer = selectable.GetComponent <MeshRenderer>(); }
void MessageDisplay() { if (!isRoleSelected) { GetComponent <KMBombModule>().HandleStrike(); Debug.LogFormat("[Town of KTaNE #{0}] Once again, the manual CLEARLY states that a role must be selected first, but you decided to submit a message? Then have a strike :)", _modID); } var text = Message_mesh.text; bool isspecialmsg = false; if (text == "Your target's role is ") { MessageRoleArrows[0].Highlight.gameObject.SetActive(true); MessageRoleArrows[0].GetComponent <Renderer>().enabled = true; MessageRoleArrows[1].Highlight.gameObject.SetActive(true); MessageRoleArrows[1].GetComponent <Renderer>().enabled = true; MessageRoleDisplay.Highlight.gameObject.SetActive(true); MessageRoleDisplay.GetComponent <Renderer>().enabled = true; MessageRole_mesh.GetComponent <Renderer>().enabled = true; Display.Highlight.gameObject.SetActive(true); Display.GetComponent <Renderer>().enabled = true; isspecialmsg = true; } if (text == "Your target visited ") { MessageRoleArrows[0].Highlight.gameObject.SetActive(true); MessageRoleArrows[0].GetComponent <Renderer>().enabled = true; MessageRoleArrows[1].Highlight.gameObject.SetActive(true); MessageRoleArrows[1].GetComponent <Renderer>().enabled = true; MessageRoleDisplay.Highlight.gameObject.SetActive(true); MessageRoleDisplay.GetComponent <Renderer>().enabled = true; MessageRole_mesh.GetComponent <Renderer>().enabled = true; Display.Highlight.gameObject.SetActive(true); Display.GetComponent <Renderer>().enabled = true; } if (!isspecialmsg) { messagessolved.Add(text); } }
void Awake() { thisLoggingID = loggingID++; transform.Find("Background").GetComponent <MeshRenderer>().material.color = new Color(1, 0.1f, 0.1f); ButtonTransmit.GetComponent <MeshRenderer>().material.color = new Color(0.91f, 0.88f, 0.86f); ButtonTransmit.OnInteract += HandleTransDown; ButtonTransmit.OnInteractEnded += HandleTransUp; ButtonSwitch.OnInteract += HandleSwitch; LED = transform.Find("Lights").GetComponent <MeshRenderer>(); LED.materials[0].color = new Color(0.3f, 0.3f, 0.3f); LED.materials[1].color = LED_OFF; LED.materials[2].color = LED_OFF; LED.materials[3].color = LED_OFF; transform.Find("ReceiveBox").GetComponent <MeshRenderer>().material.color = new Color(0.3f, 0.3f, 0.3f); transform.Find("ReceiveSwitch").GetComponent <MeshRenderer>().material.color = new Color(0.6f, 0.6f, 0.6f); ButtonTransmit.GetComponent <MeshRenderer>().material.color = new Color(0.91f, 0.88f, 0.86f); List <string> charList = new List <string>() { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }; DisplayChars = new int[3][]; for (int a = 0; a < 3; a++) { int pos = Random.Range(0, charList.Count); DisplayCharsRaw[a] = charList[pos]; DisplayChars[a] = Morsify(charList[pos]); charList.RemoveAt(pos); } GetComponent <KMBombModule>().OnActivate += GenSolution; HandleSwitch(); }
public static void UpdateSettings(this KMSelectable selectable) { if (CopySettingsFromProxyMethod != null) { CopySettingsFromProxyMethod.Invoke( selectable.GetComponent(ModSelectableType) ?? selectable.gameObject.AddComponent(ModSelectableType), new object[0]); } }
void Start() { offset = Rnd.Range(0f, 360f); timeoffset = Rnd.Range(0, 100); bean = Rnd.Range(0, 6); bool[] initvalid = { false, false, true, false, true, false }; Bean.GetComponent <MeshRenderer>().material.color = new Color(colours[0][bean % 3] / 255f, colours[1][bean % 3] / 255f, colours[2][bean % 3] / 255f); StartCoroutine(Wobble()); }
public static void Reproxy(this KMSelectable selectable) { object modSelectable = selectable.GetComponent(ModSelectableType); if (modSelectable != null) { CopySettingsFromProxyMethod.Invoke(modSelectable, null); } }
public static void Reproxy(this KMSelectable selectable) { ModSelectable modSelectable = selectable.GetComponent <ModSelectable>(); if (modSelectable != null) { modSelectable.CopySettingsFromProxy(); } }
private KMSelectable.OnInteractHandler SelectorPressed(int pos) { return(delegate { Selection[pos].AddInteractionPunch(); if (!solved && !playing) { if (pos / 3 == 2) { Color = (Color / 3) * 3 + pos % 3; } else if (pos / 3 == 1) { Color = (Color / 9) * 9 + Color % 3 + 3 * (pos % 3); } else { Color = (Color % 9) + 9 * (pos % 3); } if (pos % 3 != 0) { string[] audio = { "a", "a2", "b", "b2", "c", "c2" }; Audio.PlaySoundAtTransform(audio[(pos % 3) - 1 + (pos / 3) * 2], Module.transform); } Playbutton.GetComponent <MeshRenderer>().material.color = new Color((Color / 9) / 2f, ((Color / 3) % 3) / 2f, (Color % 3) / 2f); for (int j = 0; j < 9; j++) { if (j / 3 == 0) { Selection[j].GetComponent <MeshRenderer>().material.color = new Color((j % 3) / 2f, ((Color / 3) % 3) / 2f, (Color % 3) / 2f); } else if (j / 3 == 1) { Selection[j].GetComponent <MeshRenderer>().material.color = new Color((Color / 9) / 2f, (j % 3) / 2f, (Color % 3) / 2f); } else { Selection[j].GetComponent <MeshRenderer>().material.color = new Color((Color / 9) / 2f, ((Color / 3) % 3) / 2f, (j % 3) / 2f); } } } return false; }); }
void SetWireColor(KMSelectable wire, Color color) { // set the wire model Renderer rend = wire.GetComponent <Renderer>(); rend.material.SetColor("_Color", color); // set the broken wire model as well GetBrokenWireOfWire(wire).GetComponent <MeshRenderer>().material.SetColor("_Color", color); }
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 pressedButton) { if (moduleSolved || pressedButton.GetComponent <ContainedLyric>().pressed) { return; } pressedButton.AddInteractionPunch(); Audio.PlaySoundAtTransform("scratch", transform); pressedButton.GetComponent <ContainedLyric>().pressed = true; pressedButton.GetComponent <Renderer>().material = vinylMats[1]; if (pressedButton.GetComponent <ContainedLyric>().containedLyric == chosenLyrics[stage]) { stage++; Debug.LogFormat("[The Festive Jukebox #{0}] You pressed {1}. That is correct.", moduleId, pressedButton.GetComponent <ContainedLyric>().containedLyric); } else { Debug.LogFormat("[The Festive Jukebox #{0}] You pressed {1}. That is incorrect.", moduleId, pressedButton.GetComponent <ContainedLyric>().containedLyric); stage++; incorrect = true; } if (stage == 3) { if (incorrect) { GetComponent <KMBombModule>().HandleStrike(); Debug.LogFormat("[The Festive Jukebox #{0}] Strike! The order was not correct.", moduleId); stage = 0; incorrect = false; Start(); } else { moduleSolved = true; GetComponent <KMBombModule>().HandlePass(); Debug.LogFormat("[The Festive Jukebox #{0}] Module disarmed. Merry Christmas!", moduleId); Audio.PlaySoundAtTransform("winScratch", transform); Audio.PlaySoundAtTransform("oldRecord", transform); Audio.PlaySoundAtTransform(songs[songIndex].name, transform); } } }
public static void EnsureModSelectable(this KMSelectable selectable) { Component modSelectable = selectable.GetComponent(ModSelectableType); if (modSelectable == null) { selectable.gameObject.AddComponent(ModSelectableType); } selectable.EnsureModHighlightable(); }
void ButtonPress(KMSelectable pressedButton) { if (moduleSolved || pressedButton.GetComponent <ButtonOrder>().pressed) { return; } pressedButton.AddInteractionPunch(); if (pressedButton.GetComponent <ButtonOrder>().buttonValue == expectedValue) { Audio.PlaySoundAtTransform("beep", transform); Debug.LogFormat("[Spinning Buttons #{0}] You pressed the {1} button that says {2}. That is correct.", moduleId, pressedButton.GetComponent <ButtonOrder>().colourName, textOptions[pressedButton.GetComponent <ButtonOrder>().numberLabel]); pressedButton.GetComponent <ButtonOrder>().pressed = true; indicatorLights[pressedButton.GetComponent <ButtonOrder>().buttonLocation - 1].material = indicatorMaterials[1]; stage++; if (stage < 4) { expectedValue = orderOfButtons[stage]; } else { anim.SetTrigger("solved"); GetComponent <KMBombModule>().HandlePass(); Debug.LogFormat("[Spinning Buttons #{0}] Module disarmed.", moduleId); moduleSolved = true; StartCoroutine(PassAlarm()); } } else { for (int i = 0; i <= 3; i++) { buttonInfo[i].pressed = false; } Audio.PlaySoundAtTransform("wrong", transform); GetComponent <KMBombModule>().HandleStrike(); Debug.LogFormat("[Spinning Buttons #{0}] Strike! You pressed the {1} button that says {2}. That is incorrect.", moduleId, pressedButton.GetComponent <ButtonOrder>().colourName, textOptions[pressedButton.GetComponent <ButtonOrder>().numberLabel]); stage = 0; Start(); } }
bool CheckButtonPress() { bombAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, checkButton.transform); checkButton.AddInteractionPunch(0.4f); checkButton.GetComponent <Animator>().Play("ZButtonPress", 0, 0); if (moduleSolved) { return(false); } List <VexBlock> shownOrder = VexesInDisplayOrder(); if (shownOrder[0].GetPosition() == -1) { Debug.LogFormat("[TetraVex #{0}] STRIKE: Submitted when a piece wasn't in place.", thisLogID); bombModule.HandleStrike(); return(false); } // Logging Debug.LogFormat("[TetraVex #{0}] Submitted solution:", thisLogID); for (int i = 0; i < 9; i += 3) { string[] log = VexBlock.BlockLineToStrings(shownOrder[i], shownOrder[i + 1], shownOrder[i + 2]); Debug.LogFormat("[TetraVex #{0}] {1}", thisLogID, log[0]); Debug.LogFormat("[TetraVex #{0}] {1}", thisLogID, log[1]); Debug.LogFormat("[TetraVex #{0}] {1}", thisLogID, log[2]); if (i < 6) { Debug.LogFormat("[TetraVex #{0}] ───┼───┼───", thisLogID); } } // We only check DOWN and RIGHT for each block, because left and up for each block are already checked by previous blocks. // We don't even bother extending the loop to hit the bottom-right block, because if we did hit it it is a guaranteed solve. for (int i = 0; i < 8; ++i) { if (!shownOrder[i].IsPositionOkay(i < 6 ? shownOrder[i + 3] : null, i % 3 < 2 ? shownOrder[i + 1] : null)) { Debug.LogFormat("[TetraVex #{0}] STRIKE: The block in the {1} position has an incorrect connection.", thisLogID, __positionText[i]); bombModule.HandleStrike(); return(false); } } Debug.LogFormat("[TetraVex #{0}] SOLVE: All connections okay; this is a valid solution.", thisLogID); bombAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, bombModule.transform); bombModule.HandlePass(); moduleSolved = true; return(false); }
private IEnumerator Play() { playing = true; Submit.GetComponent <MeshRenderer>().material.color = new Color(1f, 1f, 1f); for (int i = 0; i < 16 && playing; i++) { if ((Solution[i] / 9) == 1) { Audio.PlaySoundAtTransform("a", Module.transform); } if ((Solution[i] / 9) == 2) { Audio.PlaySoundAtTransform("a2", Module.transform); } yield return(new WaitForSeconds(0.15f)); if ((Solution[i] / 3) % 3 == 1) { Audio.PlaySoundAtTransform("b", Module.transform); } if ((Solution[i] / 3) % 3 == 2) { Audio.PlaySoundAtTransform("b2", Module.transform); } yield return(new WaitForSeconds(0.15f)); if ((Solution[i] % 3) == 1) { Audio.PlaySoundAtTransform("c", Module.transform); } if ((Solution[i] % 3) == 2) { Audio.PlaySoundAtTransform("c2", Module.transform); } yield return(new WaitForSeconds(0.7f)); } playing = false; Submit.GetComponent <MeshRenderer>().material.color = new Color(0f, 0f, 0f); }
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 Awake() { thisLoggingID = loggingID++; //transform.Find("Background").GetComponent<MeshRenderer>().material.color = new Color(1, 0.1f, 0.1f); ButtonTL.GetComponent <MeshRenderer>().material.color = new Color(0, 0, 0); ButtonTR.GetComponent <MeshRenderer>().material.color = new Color(0, 0, 0); ButtonBL.GetComponent <MeshRenderer>().material.color = new Color(0, 0, 0); ButtonBR.GetComponent <MeshRenderer>().material.color = new Color(0, 0, 0); GetComponent <KMBombModule>().OnActivate += Init; }