Exemplo n.º 1
0
 void OnTimerExpired()
 {
     BombModule.HandleStrike();
     DisplayIncorrect();
     DisplayText.text = "Time Ran Out!";
     Debug.LogFormat("[Edgework #{0}] Time ran out at question {1}", moduleId, CurrentQuestion + 1);
     Invoke("ClearDisplays", 2);
 }
Exemplo n.º 2
0
 void OnTimerExpired()
 {
     needyModule.HandleStrike();
     moduleSolved       = true;
     topScreenText.text = "Time";
     stackHeights.Clear();
     answerStacks.Clear();
     stackCheck = "";
 }
    // Use this for initialization
    void Start()
    {
        moduleId = moduleIdCounter++;

        textDisplay.text      = "";
        needySelf.OnActivate += delegate { hasStarted = true; };

        needySelf.OnNeedyActivation += delegate {
            if (forceDisable)
            {
                needySelf.HandlePass();
            }
            else
            {
                AssignValue();
            }
        };

        needySelf.OnTimerExpired += delegate {
            QuickLog("Letting the needy timer run out is not a good idea after all.");
            currentStreak = 0;
            needySelf.SetResetDelayTime(15 + 5 * currentStreak, 45 + 10 * currentStreak); // Modify reactivation time based on the streak the module is on.
            needySelf.HandleStrike();
            isActive = false;
        };

        for (int x = 0; x < arrowButtons.Length; x++)
        {
            int y = x;
            arrowButtons[x].OnInteract += delegate {
                if (isActive && !isanimating)
                {
                    MAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, arrowButtons[y].transform);
                    arrowButtons[y].AddInteractionPunch();
                    CheckAnswer(y);
                }
                return(false);
            };
        }

        needySelf.OnNeedyDeactivation += delegate
        {
            StartCoroutine(victory());
            hasStarted = false;
        };

        bombInfo.OnBombSolved += delegate {
            StartCoroutine(victory());
            hasStarted = false;
        };

        StartCoroutine(DelayRotation());
    }
Exemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     needyModule.OnTimerExpired += delegate() {
         if (canRun)
         {
             localstrike = true;
             Debug.LogFormat("[Time Accumulation #{0}]: Don't let this run out of time! Strike incurred.", localModID);
             needyModule.HandleStrike();
         }
     };
     selectDisable.OnInteract += delegate() {
         int curneedTime = Mathf.RoundToInt(needyModule.GetNeedyTimeRemaining());
         if (curneedTime >= 0)
         {
             value += curneedTime;
             needyModule.HandlePass();
             Debug.LogFormat("[Time Accumulation #{0}]: Adding {1} onto the counter. Counter currently at {2}.", localModID, curneedTime, value);
         }
         audioKTANE.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonPress, transform);
         forwardsAnim = true;
         return(false);
     };
     needyModule.OnNeedyActivation += delegate()
     {
         if (!canRun)
         {
             needyModule.HandlePass();
         }
     };
     needyModule.OnActivate += delegate() {
         isInTimeMode    = TimeModeActive;
         canRun          = true;
         isLightsFirstOn = true;
         if (isInTimeMode)
         {
             Debug.LogFormat("[Time Accumulation #{0}]: Module detected in Time Mode, disabling strike count for this module...", localModID);
         }
     };
     selectDisable.OnInteractEnded += delegate()
     {
         forwardsAnim = false;
         audioKTANE.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonRelease, transform);
     };
     bombInfo.OnBombExploded += delegate()
     {
         canRun = false;
     };
     bombInfo.OnBombSolved += delegate()
     {
         canRun = false;
     };
 }
Exemplo n.º 5
0
    private void Start()
    {
        Needy.Assign(onNeedyActivation : OnNeedyActivation,
                     onNeedyDeactivation : OnNeedyDeactivation,
                     onTimerExpired : () => delegate()
        {
            Needy.HandleStrike();
            OnNeedyDeactivation().Invoke();
        },
                     moduleScript: this);

        Buttons.Assign(onInteract: HandleButtons);
    }
Exemplo n.º 6
0
    void LastSolveEvaluation()
    {
        var module = MostRecent;

        if (module.StartsWith("The "))
        {
            module = module.Substring(4);
            Debug.Log("The word to evaluate after removing 'The' is " + module);
        }
        else
        {
            Debug.Log("The word to evaluate is " + module);
        }
        lastInput = module.Substring(0, 1).ToLower();
        Debug.Log("You have input " + lastInput);

        //This half evaluates if the input is truly valid. This switch makes me want to shoot my computer.
        Debug.Log(validLetters.Contains(lastInput) ? "Valid Input Recieved" : "Invalid Input Recieved");
        if (ValidState == validLetters.Contains(lastInput))
        {
            Debug.Log("Needle position matches Valid input state");
            return;
        }
        else
        {
            for (int i = 0; i < ledStates.Length; i++)
            {
                LEDs[i].material = OffOn[0];
            }
            Debug.Log("Needle position does not match Valid input state");
            Needy.HandleStrike();
            YouFuckedUp();
        }
    }
 void ResetStreak()
 {
     needyHandler.HandleStrike();
     progressHandler.ResetProgress();
     isActivated   = false;
     debugValInput = 0;
     StopAllCoroutines();
     ModifyDelay();
 }
Exemplo n.º 8
0
    private void OnTimerExpired()
    {
        if (moduleResolved)
        {
            return;
        }

        TechSupportLog.Log("STRIKE: Timer Expired");
        needyModule.HandleStrike();

        for (int i = 0; i < options.Count; i++)
        {
            console.Remove(options[i].B);
        }

        console.Show(timerExpiredMessage);
        StartCoroutine(RebootModule());
    }
    void expired()
    {
        lights[random].enabled = false;

        sequence.Clear();
        lenght2    = 0;
        currentInt = 0;
        addseconds = 0;
        needy.HandleStrike();
    }
Exemplo n.º 10
0
 protected void OnTimerExpired()
 {
     Debug.LogFormat("[Needy Determinants #{0}] has had its timer expire!", _moduleId);
     Module.HandleStrike();
     _isSolved     = true;
     _minusPressed = false;
     answer        = 0;
     str_answer    = "";
     Screen.text   = "";
 }
Exemplo n.º 11
0
    void OnTimerExpired()
    {
        if (answer != 0)
        {
            Debug.LogFormat("[Simon Literally Says #{0}] STRIKE: Timer expired on Simon's request.", thisLoggingID);
            bombModule.HandleStrike();
        }
        else
        {
            Debug.LogFormat("[Simon Literally Says #{0}] SAFE: Timer expired as expected.", thisLoggingID);
        }

        for (int i = 0; i < kpAnims.Length; ++i)
        {
            kpAnims[i].Play("KeypadHide", 0, 0);
        }

        cleanupCoroutine = StartCoroutine(HandleNeedyCleanup(true));
    }
Exemplo n.º 12
0
 void OnTimerExpired()
 {
     if (answer != 4)
     {
         needyModule.HandleStrike();
         texts[0].text = "Common Sense";
         texts[1].text = "-";
         texts[2].text = "-";
         theBack.GetComponent <MeshRenderer>().material = mats[0];
         texts[0].color = colors[6];
         Debug.LogFormat("[Common Sense #{0}] You didn't input your response in time.", moduleId);
         moduleSolved = true;
     }
     else
     {
         needyModule.HandlePass();
         Debug.LogFormat("[Common Sense #{0}] You selected the correct answer. Pass.", moduleId);
     }
 }
Exemplo n.º 13
0
 private void Deactivate()
 {
     active = false;
     coordinates[0].text       = "*";
     coordinates[1].text       = "*";
     solids[targetpos].enabled = false;
     rcpatch.enabled           = false;
     if (currentpos[0] * 8 + currentpos[1] != targetpos)
     {
         needy.HandleStrike();
     }
 }
Exemplo n.º 14
0
 void OnNeedyDeactivation()
 {
     active = false;
     if (!solved && !(Bomb.GetSolvedModuleNames().Count() == Bomb.GetSolvableModuleNames().Count()))
     {
         Module.HandleStrike();
     }
     for (int i = 0; i < 5; i++)
     {
         Buttons[i].GetComponent <MeshRenderer>().material.color = new Color(1, 1, 1);
     }
 }
Exemplo n.º 15
0
 /// <summary>
 /// Handle the success or failure of the module
 /// </summary>
 /// <param name="index">The index of the button pressed</param>
 /// <param name="strike">Whether or not a strike should be given (true by default)</param>
 private void StrikeHandler(int index, bool strike = true)
 {
     if (strike)
     {
         needyModule.HandleStrike();
         Debug.LogFormat(@"[Triangle Buttons #{0}] {1} button has been pushed and is incorrect. Strike occurred, module deactivated.", moduleId, buttonLocations[index]);
     }
     else
     {
         Debug.LogFormat(@"[Triangle Buttons #{0}] {1} button has been pushed and is correct. Module deactivated.", moduleId, buttonLocations[index]);
     }
     needyModule.HandlePass();
 }
Exemplo n.º 16
0
 void ResetStreak()
 {
     needyHandler.HandleStrike();
     curStreak     = 0;
     isActivated   = false;
     debugValInput = 0;
     if (revealAnim != null)
     {
         StopCoroutine(revealAnim);
     }
     ModifyDelay();
     StartCoroutine(FlashStreak());
 }
Exemplo n.º 17
0
    void Start()
    {
        //Set module ID
        moduleId = moduleIdCounter++;

        //Set up needy module
        needyModule = GetComponent <KMNeedyModule>();
        needyModule.OnNeedyActivation   += delegate { RandomizeOrientation(); };
        needyModule.OnNeedyDeactivation += delegate { HideTriangles(); };
        needyModule.OnTimerExpired      += delegate { needyModule.HandleStrike(); HideTriangles(false); };

        //Other variables
        moduleActive = false;
        rotation     = new Vector3(90, 0, 0);

        //Add solutions to dictionary of solutions
        solutions = new Dictionary <string, int>()
        {
            { "3102", 0 },
            { "1320", 2 },
            { "0213", 1 },
            { "2103", 2 },
            { "3120", 3 },
            { "2013", 0 },
            { "3210", 1 },
            { "2031", 1 },
            { "1032", 2 },
            { "3021", 3 },
            { "0123", 3 },
            { "2130", 1 },
            { "1203", 0 },
            { "1302", 3 },
            { "0231", 3 },
            { "0321", 2 },
            { "3201", 1 },
            { "3012", 2 },
            { "0312", 0 },
            { "0132", 1 },
            { "1230", 3 },
            { "2301", 0 },
            { "2310", 2 },
            { "1023", 0 }
        };

        //Set up button selections
        for (int c = 0; c < buttons.Length; c++)
        {
            int d = c;
            buttons[c].OnInteract += delegate { ButtonPress(d); return(false); };
        }
    }
Exemplo n.º 18
0
 void Awake()
 {
     _moduleID = _moduleIdCounter++;
     GetSettings();
     Module.CountdownTime   = _Settings.ActivationTime;
     Module.OnActivate     += delegate { Audio.PlaySoundAtTransform("activate", Button.transform); };
     Module.OnTimerExpired += delegate { Module.HandleStrike(); Debug.LogFormat("[Think Fast #{0}] You struck on Think Fast, you {1}.", _moduleID, Insults[Rnd.Range(0, Insults.Length)]); };
     Button.OnInteract     += delegate { StartCoroutine(ButtonPress()); return(false); };
     StartCoroutine(ButtonRotate());
     if (_Settings.FakeActivationSounds)
     {
         StartCoroutine(BeAnnoying());
     }
 }
Exemplo n.º 19
0
    void OnTimerExpired()
    {
        Button_enabler.SetActive(false);
        if (Flower_Color == Flower_Answer)
        {
            Needy.HandlePass();
        }
        else
        {
            Needy.HandleStrike();

            Debug.LogFormat("You submitted the wrong color, it was {0} but you submitted {1}", LogRelatedThingy[Flower_Answer], LogRelatedThingy[Flower_Color]);
        }
    }
Exemplo n.º 20
0
 private void Outtatime()
 {
     active = false;
     if (state.SequenceEqual(target))
     {
         needy.HandlePass();
     }
     else
     {
         needy.HandleStrike();
     }
     foreach (Renderer t in tilerends)
     {
         t.material = mats[0];
     }
 }
 private void Strike()
 {
     Module.HandleStrike();
     if (state)
     {
         micOn--;
         if (micOn == 0)
         {
             mic.Stop();
         }
         state = false;
     }
     Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.Strike, transform);
     Text.text = "";
     Debug.LogFormat("[Crazy Speak #{0}] Needy struck.", _id);
 }
Exemplo n.º 22
0
    // Use this for initialization
    void Start()
    {
        textnumber.text = "Not FizzBuzz.";

        needyModule.OnNeedyActivation += delegate()
        {
            if (forceDisable)
            {
                needyModule.HandlePass();
                return;
            }

            targetnumber    = Random.Range(0, int.MaxValue);
            textnumber.text = targetnumber.ToString();

            goalVal += targetnumber % 3 == 0 ? 1 : 0;
            goalVal += targetnumber % 5 == 0 ? 2 : 0;
        };

        needyModule.OnTimerExpired += delegate()
        {
            if (poslist[rotatePos % poslist.Length] != goalVal)
            {
                needyModule.HandleStrike();
                Debug.LogFormat("[BuzzFizz #{0}]: \"{2}\" was expected but \"{3}\" was set for {1}.", cmodID, targetnumber, conText[goalVal], conText[poslist[rotatePos % 4]]);
            }
            goalVal   = 0;
            iswarning = false;
        };
        needyModule.OnNeedyDeactivation += delegate()
        {
            textnumber.color = Color.white;
            iswarning        = false;
        };
        needyModule.OnActivate += delegate()
        {
            textnumber.text  = "Pending...";
            textnumber.color = Color.white;
        };
        dialSelect.OnInteract += delegate()
        {
            dial.transform.Rotate(new Vector3(0, 90, 0));
            rotatePos = (rotatePos + 1) % 4;
            return(false);
        };
    }
Exemplo n.º 23
0
 private void TimerExpired()
 {
     if (_bomb.HoldState == FloatingHoldable.HoldStateEnum.Held)
     {
         _module.HandleStrike();
         Debug.LogFormat("[Hot Potato #{0}] Bomb not dropped in time, strike!", _moduleId);
     }
     else
     {
         _module.HandlePass();
         Debug.LogFormat("[Hot Potato #{0}] Bomb dropped in time.", _moduleId);
     }
     if (TwitchPlaysActive)
     {
         StopCoroutine(_TextU);
     }
     _textMesh.text = string.Empty;
 }
Exemplo n.º 24
0
    void ButtonPress(KMSelectable button)
    {
        button.AddInteractionPunch(.5f);
        audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, button.transform);
        if (!active)
        {
            return;
        }
        var ix = Array.IndexOf(buttons, button);

        Debug.LogFormat("[Llama, Llama, Alpaca #{0}] Selected: {1}", moduleId, button.GetComponentInChildren <TextMesh>().text);
        if (ix != solution)
        {
            Debug.LogFormat("[Llama, Llama, Alpaca #{0}] That was not correct. Strike!", moduleId);
            module.HandleStrike();
        }
        else
        {
            Debug.LogFormat("[Llama, Llama, Alpaca #{0}] That was correct. Module passed.", moduleId);
            module.HandlePass();
        }
        OnNeedyDeactivation();
    }
Exemplo n.º 25
0
    IEnumerator HandleHeightManagment()
    {
        for (int x = 0; x < 3; x++)
        {
            yield return(AnimateNextRowAnim(5f));
        }
        while (isActive)
        {
            yield return(null);

            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)
            {
                yield return(AnimateNextRowDynamicAnim());
            }
            else
            {
                if (!pauseLift)
                {
                    timeLeftManaged -= Time.deltaTime;
                }
                //mAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.NeedyWarning, transform);
                if (timeLeftManaged < 0f)
                {
                    needySelf.HandleStrike();
                    HandleDeactivation();
                }
            }
        }
    }
 void Deactivate()
 {
     Text.text = "";
     Module.HandleStrike();
     Deactivated = 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();
    }
Exemplo n.º 28
0
    // Use this for initialization
    void Start()
    {
        if (!Tablet.chosenCourse.HasConfig("Binyamin"))
        {
            displayText.text = "CONFG";
            return;
        }

        string config = Tablet.chosenCourse.GetConfig("Binyamin");

        //answers = new int[] { 3, 5, 6, 3, 7, 4, 2, 1, 2, 5, 7 };

        // checks that config is not empty
        if (config.Length == 0 || config == "")
        {
            displayText.text = "ERR0";
            return;
        }
        answers = config.Trim().Split('\n');

        // checks that questions are defined
        if (answers.Length == 0)
        {
            displayText.text = "ERR1";
            return;
        }

        // setup options
        largestPosition = -1;
        foreach (string answer in answers)
        {
            try {
                int number = int.Parse(answer.Split(',')[0]);
                if (number > largestPosition)
                {
                    largestPosition = number;
                }
            } catch (Exception e) {
                displayText.text = "ERR5";
                return;
            }
        }
        if (largestPosition != -1)
        {
            for (int i = 0; i < largestPosition; i++)
            {
                GameObject newSelection = Instantiate(selectionText.gameObject, selectionText.parent);
                newSelection.transform.localEulerAngles = new Vector3(0f, 0f, (i + 1) * (360f / (largestPosition + 1)));
                newSelection.transform.GetChild(0).GetComponent <TextMesh>().text = (i + 1) + "";
            }
        }
        else
        {
            displayText.text = "ERR4";
            return;
        }

        // runs when new round is activated
        module.OnNeedyActivation += delegate {
            // reset selected answer text object
            position          = 0;
            positionText.text = position.ToString();

            // select a random question from the list
            answer = GetNextAnswer().Trim().Split(',');
            bool parse = int.TryParse(answer[0], out currentAnswer);
            if (parse)
            {
                //displayText.text = answer[1];
                displayText.text = Tablet.chosenCourse.language.Format(answer[1]);
                //displayText.text = language.SendText(textFormatter, language, answer[1]);
                Debug.Log(currentAnswer);
            }
            else
            {
                currentAnswer    = -1;
                displayText.text = "ERR2";
            }
        };

        // controls dial position/answer selection
        dial.OnInteract += delegate {
            if (position < largestPosition)
            {
                position++;
            }
            else
            {
                position = 0;
            }

            Debug.Log(position);

            // rotate dial to next position
            positionText.text = position.ToString();
            return(false);
        };

        // controls whether strike is given or not
        module.OnTimerExpired += delegate {
            if (currentAnswer != -1)
            {
                if (position != currentAnswer)
                {
                    module.HandleStrike();
                }
            }
        };
    }
    // Use this for initialization
    void Start()
    {
        _moduleId++;

        _startmin = int.Parse(BombInfo.GetFormattedTime().Split(':').First());
        _startsec = int.Parse(BombInfo.GetFormattedTime().Split(':').Last());

        LogTheFile(string.Format("The bomb's starting time was {0} minutes and {1} seconds.", _startmin, _startsec));

        _questions = new List <ReversedEdgeworkQuestion>
        {
            new ReversedEdgeworkQuestion("# of INDs", BombInfo.GetIndicators().Count()),
            new ReversedEdgeworkQuestion("# of lit INDs", BombInfo.GetOnIndicators().Count()),
            new ReversedEdgeworkQuestion("# of off INDs", BombInfo.GetOffIndicators().Count()),
            new ReversedEdgeworkQuestion("# of ports", BombInfo.GetPortCount()),
            new ReversedEdgeworkQuestion("# of port p.s", BombInfo.GetPortPlateCount()),
            new ReversedEdgeworkQuestion("# of batts", BombInfo.GetBatteryCount()),
            new ReversedEdgeworkQuestion("# of D batts", BombInfo.GetBatteryCount(Battery.D)),
            new ReversedEdgeworkQuestion("# of AA batts", BombInfo.GetBatteryCount(Battery.AA)),
            new ReversedEdgeworkQuestion("# of batt hds", BombInfo.GetBatteryHolderCount()),
            new ReversedEdgeworkQuestion("First # of SN", BombInfo.GetSerialNumberNumbers().First()),
            new ReversedEdgeworkQuestion("Last # of SN", BombInfo.GetSerialNumberNumbers().Last()),
            new ReversedEdgeworkQuestion("# of mod", BombInfo.GetModuleNames().Count),
            new ReversedEdgeworkQuestion("# of r. mod", BombInfo.GetSolvableModuleNames().Count),
            new ReversedEdgeworkQuestion("# of n. mod",
                                         BombInfo.GetModuleNames().Count - BombInfo.GetSolvableModuleNames().Count),
            new ReversedEdgeworkQuestion("b. st. min", _startmin),
            new ReversedEdgeworkQuestion("b. st. sec", _startsec)
        };
        for (var i = 0; i < 4; ++i)
        {
            int index = i;
            Buttons[index].OnInteract += delegate
            {
                Buttons[index].AddInteractionPunch();
                ModuleAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, Buttons[index].transform);
                if (!_active)
                {
                    return(false);
                }

                if (_mainQuestion.Answer != _assignedQuestions[index].Answer)
                {
                    _active = false;
                    foreach (var text in texts)
                    {
                        text.text = "";
                    }

                    screenText.text = "";
                    LogTheFile(string.Format("You pressed {0}({1}), which was wrong. Handling Strike and going to sleep.",
                                             _assignedQuestions[index].Question, _assignedQuestions[index].Answer.ToString()));
                    Module.HandleStrike();
                    Module.HandlePass();
                }
                else
                {
                    _active = false;
                    foreach (var text in texts)
                    {
                        text.text = "";
                    }

                    screenText.text = "";
                    Module.HandlePass();
                    LogTheFile("Correct button pressed, going to sleep.");
                }

                return(false);
            };
            Buttons[index].OnInteractEnded += delegate
            {
                ModuleAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonRelease,
                                                     Buttons[index].transform);
            };
        }

        Module.OnNeedyActivation   += GenerateQuestion;
        Module.OnNeedyDeactivation += delegate
        {
            _active = false;
            foreach (var text in texts)
            {
                text.text = "";
            }
            screenText.text = "";
        };
        Module.OnTimerExpired += delegate
        {
            foreach (var text in texts)
            {
                text.text = "";
            }

            screenText.text = "";
            LogTheFile("Timer expired, handling Strike");
            Module.HandleStrike();
        };
    }
    void Awake()
    {
        needySelf.OnActivate += delegate()
        {
            mustInvert = bombInfo.GetSerialNumberNumbers().ToList().Count > 0 ? bombInfo.GetSerialNumberNumbers().Last() % 2 != 0 : false;
            // If there is at least 1 number in the serial number, grab the last one and check if it's odd or even. Otherwise set it to false by default.
        };
        needySelf.OnNeedyActivation += delegate()
        {// Generate board with goal presses and mix up interactable board with lit/unilt tiles
            if (forceDisable)
            {
                needySelf.HandlePass();
                return;
            }
            hasActivated = true;
            bool[] choices = new bool[] { true, false };
            for (int pos = 0; pos < lightstate.Count(); pos++)
            {
                lightstate[pos] = choices[UnityEngine.Random.Range(0, choices.Count())];
            }

            for (int pos = 0; pos < goallights.Count(); pos++)
            {
                goallights[pos] = choices[UnityEngine.Random.Range(0, choices.Count())];
            }
        };
        needySelf.OnNeedyDeactivation += delegate() // If the module is force-deactivated
        {
            hasActivated = false;
            for (int x = 0; x < buttonColors.Count(); x++)
            {
                buttonColors[x].material = buttonDeactivated;
                lightKeys[x].enabled     = false;
            }
        };

        needySelf.OnTimerExpired += delegate()
        {
            StopCoroutine(FlashGoalOnWarning());
            isWarning = false;
            if (IsCorrect(lightstate))
            {
                sound.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                StartCoroutine(PlayCorrectAnim());
            }
            else
            {
                needySelf.HandleStrike();
                StartCoroutine(PlayStrikeAnim());
            }
            hasActivated = false;
        };
        for (int x = 0; x < buttons.Count(); x++)
        {
            int pos = x;
            buttonSelectables[pos].OnInteract += delegate()
            {
                if (!hasActivated)
                {
                    return(false);
                }
                buttonSelectables[pos].AddInteractionPunch(0.5f);
                sound.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonRelease, transform);
                lightstate[pos] = !lightstate[pos];
                return(false);
            };
        }
    }