Exemplo n.º 1
0
 void RegsPress(KMSelectable Reg)
 {
     if (sequence[indexOfSequence] == 'N')
     {
         if (Reg.name == "UpReg")
         {
             positionOfPlayer[1]--;
             if (positionOfPlayer[1] < 0)
             {
                 Module.HandleStrike();
                 positionOfPlayer[1]++;
             }
             else
             {
                 indexOfSequence++;
                 if (indexOfSequence == 4)
                 {
                     indexOfSequence = 0;
                 }
             }
         }
         else if (Reg.name == "DownReg")
         {
             positionOfPlayer[1]++;
             if (positionOfPlayer[1] > 5)
             {
                 Module.HandleStrike();
                 positionOfPlayer[1]--;
             }
             else
             {
                 indexOfSequence++;
                 if (indexOfSequence == 4)
                 {
                     indexOfSequence = 0;
                 }
             }
         }
         else if (Reg.name == "LeftReg")
         {
             positionOfPlayer[0]--;
             if (positionOfPlayer[0] < 0)
             {
                 Module.HandleStrike();
                 positionOfPlayer[0]++;
             }
             else
             {
                 indexOfSequence++;
                 if (indexOfSequence == 4)
                 {
                     indexOfSequence = 0;
                 }
             }
         }
         else
         {
             positionOfPlayer[0]++;
             if (positionOfPlayer[1] > 0)
             {
                 Module.HandleStrike();
                 positionOfPlayer[1]--;
             }
             else
             {
                 indexOfSequence++;
                 if (indexOfSequence == 4)
                 {
                     indexOfSequence = 0;
                 }
             }
         }
         Debug.Log("A regular button has been pressed.");
         Debug.LogFormat("Player position: ({0}, {1})", positionOfPlayer[0], positionOfPlayer[1]);
     }
     else
     {
         Module.HandleStrike();
         bones = 0;
     }
 }
Exemplo n.º 2
0
    IEnumerator SimulateModule(Component component, Transform moduleTransform, MethodInfo method, string command)
    {
        // Simple Command
        if (typeof(IEnumerable <KMSelectable>).IsAssignableFrom(method.ReturnType))
        {
            IEnumerable <KMSelectable> selectableSequence = null;
            try
            {
                selectableSequence = (IEnumerable <KMSelectable>)method.Invoke(component, new object[] { command });
                if (selectableSequence == null)
                {
                    Debug.LogFormat("Twitch Plays handler reports invalid command (by returning null).", method.DeclaringType.FullName, method.Name);
                    yield break;
                }
            }
            catch (System.Exception ex)
            {
                Debug.LogErrorFormat("An exception occurred while trying to invoke {0}.{1}; the command invokation will not continue.", method.DeclaringType.FullName, method.Name);
                Debug.LogException(ex);
                yield break;
            }

            int initialStrikes = fakeInfo.strikes;
            int initialSolved  = fakeInfo.GetSolvedModuleNames().Count;
            foreach (KMSelectable selectable in selectableSequence)
            {
                DoInteractionStart(selectable);
                yield return(new WaitForSeconds(0.1f));

                DoInteractionEnd(selectable);

                if (fakeInfo.strikes != initialStrikes || fakeInfo.GetSolvedModuleNames().Count != initialSolved)
                {
                    break;
                }
            }
            ;
        }

        // Complex Commands
        if (method.ReturnType == typeof(IEnumerator))
        {
            IEnumerator responseCoroutine = null;
            try
            {
                responseCoroutine = (IEnumerator)method.Invoke(component, new object[] { command });
            }
            catch (System.Exception ex)
            {
                Debug.LogErrorFormat("An exception occurred while trying to invoke {0}.{1}; the command invokation will not continue.", method.DeclaringType.FullName, method.Name);
                Debug.LogException(ex);
                yield break;
            }

            if (responseCoroutine == null)
            {
                Debug.LogFormat("Twitch Plays handler reports invalid command (by returning null).", method.DeclaringType.FullName, method.Name);
                yield break;
            }

            if (!ComponentHelds.ContainsKey(component))
            {
                ComponentHelds[component] = new HashSet <KMSelectable>();
            }
            HashSet <KMSelectable> heldSelectables = ComponentHelds[component];

            int initialStrikes = fakeInfo.strikes;
            int initialSolved  = fakeInfo.GetSolvedModuleNames().Count;

            if (!responseCoroutine.MoveNext())
            {
                Debug.LogFormat("Twitch Plays handler reports invalid command (by returning empty sequence).", method.DeclaringType.FullName, method.Name);
                yield break;
            }

            if (responseCoroutine.Current is string)
            {
                var str = (string)responseCoroutine.Current;
                if (str.StartsWith("sendtochat"))
                {
                    Debug.Log("Twitch handler sent: " + str);
                }
                yield break;
            }

            while (responseCoroutine.MoveNext())
            {
                object currentObject = responseCoroutine.Current;
                if (currentObject is KMSelectable)
                {
                    KMSelectable selectable = (KMSelectable)currentObject;
                    if (heldSelectables.Contains(selectable))
                    {
                        DoInteractionEnd(selectable);
                        heldSelectables.Remove(selectable);
                        if (fakeInfo.strikes != initialStrikes || fakeInfo.GetSolvedModuleNames().Count != initialSolved)
                        {
                            yield break;
                        }
                    }
                    else
                    {
                        DoInteractionStart(selectable);
                        heldSelectables.Add(selectable);
                    }
                }
                else if (currentObject is IEnumerable <KMSelectable> )
                {
                    foreach (var selectable in (IEnumerable <KMSelectable>)currentObject)
                    {
                        DoInteractionStart(selectable);
                        yield return(new WaitForSeconds(.1f));

                        DoInteractionEnd(selectable);
                    }
                }
                else if (currentObject is string)
                {
                    string currentString = (string)currentObject;
                    float  waitTime;
                    Match  match = Regex.Match(currentString, "^trywaitcancel ([0-9]+(?:\\.[0-9])?)((?: (?:.|\\n)+)?)$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
                    if (match.Success && float.TryParse(match.Groups[1].Value, out waitTime))
                    {
                        yield return(new WaitForSeconds(waitTime));
                    }

                    Debug.Log("Twitch handler sent: " + currentObject);
                    yield return(currentObject);
                }
                else if (currentObject is Quaternion)
                {
                    moduleTransform.localRotation = (Quaternion)currentObject;
                }
                else
                {
                    yield return(currentObject);
                }

                if (fakeInfo.strikes != initialStrikes || fakeInfo.GetSolvedModuleNames().Count != initialSolved)
                {
                    yield break;
                }
            }
        }
    }
Exemplo n.º 3
0
 void oButtonPress(KMSelectable oButton)
 {
     for (int i = 0; i < 5; i++)
     {
         if (oButton == OtherButtons[i])   //BL BR TR TL SL
         {
             Debug.Log("DIldos" + i);
             if (verdict == true && i == firstPosition)
             {
                 GetComponent <KMBombModule>().HandlePass();
                 Audio.PlaySoundAtTransform("FTANG", transform);
                 moduleSolved    = true;
                 MainText.text   = "Standard Crazy\nTalk";
                 message         = "Press the V in lives.";
                 splitMessage[0] = ""; splitMessage[1] = ""; splitMessage[2] = ""; splitMessage[3] = ""; splitMessage[4] = "";
                 for (int q = 0; q < message.Length; q++)
                 {
                     if (message[q] == '\n')
                     {
                         splitMessage[0] += "\n";
                         splitMessage[1] += "\n";
                         splitMessage[2] += "\n";
                         splitMessage[3] += "\n";
                         splitMessage[4] += "\n";
                     }
                     else
                     {
                         RNG = UnityEngine.Random.Range(0, 5);
                         for (int j = 0; j < 5; j++)
                         {
                             if (RNG == j)
                             {
                                 splitMessage[j] += message[q];
                             }
                             else
                             {
                                 splitMessage[j] += " ";
                             }
                         }
                     }
                 }
             }
             else if (verdict == false && i == secondPosition)
             {
                 GetComponent <KMBombModule>().HandlePass();
                 Audio.PlaySoundAtTransform("FTANG", transform);
                 moduleSolved    = true;
                 MainText.text   = "Standard Crazy\nTalk";
                 message         = "Press the V in lives.";
                 splitMessage[0] = ""; splitMessage[1] = ""; splitMessage[2] = ""; splitMessage[3] = ""; splitMessage[4] = "";
                 for (int q = 0; q < message.Length; q++)
                 {
                     if (message[q] == '\n')
                     {
                         splitMessage[0] += "\n";
                         splitMessage[1] += "\n";
                         splitMessage[2] += "\n";
                         splitMessage[3] += "\n";
                         splitMessage[4] += "\n";
                     }
                     else
                     {
                         RNG = UnityEngine.Random.Range(0, 5);
                         for (int j = 0; j < 5; j++)
                         {
                             if (RNG == j)
                             {
                                 splitMessage[j] += message[q];
                             }
                             else
                             {
                                 splitMessage[j] += " ";
                             }
                         }
                     }
                 }
             }
             else
             {
                 GetComponent <KMBombModule>().HandleStrike();
                 Audio.PlaySoundAtTransform("Bitch", transform);
             }
         }
     }
 }
Exemplo n.º 4
0
 void RegsPress(KMSelectable Reg)
 {
     Debug.Log("A reg has been pressed.");
 }
    private void KeyPress(KMSelectable key)
    {
        int k = keys.IndexOf(key);

        if (alreadypressed[k] == false && moduleSolved == false && pressable == true)
        {
            key.AddInteractionPunch();
            if (quirk[k] != 4 && revealed[k] == false)
            {
                revealed[k] = true;
                GetComponent <KMAudio>().PlaySoundAtTransform("Reveal", transform);
                StartCoroutine(Reveal(k));
            }
            else if (quirk[k] != 4 && revealed[k] == true)
            {
                alreadypressed[k] = true;
                bool strike = false;
                int  t      = 0;
                if (quirk[k] == 1)
                {
                    t = Mathf.Abs((((int)bomb.GetTime() % 60 - ((int)bomb.GetTime() % 60) % 10) / 10) - ((int)bomb.GetTime() % 10));
                }
                for (int i = 0; i < 7; i++)
                {
                    if (i != 6)
                    {
                        if (i != k)
                        {
                            switch (quirk[k])
                            {
                            case 2:
                                if (valueList[i] < valueList[k] && alreadypressed[i] == false && quirk[i] == 2)
                                {
                                    Debug.LogFormat("[Disordered Keys #{0}] Error: Key {1} pushed out of order- Key {2} should have been pressed before this", moduleID, k + 1, i + 1);
                                    strike = true;
                                }
                                break;

                            case 0:
                            case 5:
                                if ((quirk[i] == 2 && alreadypressed[i] == false) || (valueList[i] < valueList[k] && alreadypressed[i] == false && (quirk[i] == 0 || quirk[i] == 5)))
                                {
                                    Debug.LogFormat("[Disordered Keys #{0}] Error: Key {1} pushed out of order- Key {2} should have been pressed before this", moduleID, k + 1, i + 1);
                                    strike = true;
                                }
                                break;

                            case 1:
                                if (quirk[i] == 2 && alreadypressed[i] == false)
                                {
                                    Debug.LogFormat("[Disordered Keys #{0}] Error: Key {1} pushed out of order- Key {2} should have been pressed before this", moduleID, k + 1, i + 1);
                                    strike = true;
                                }
                                else if (valueList[k] % 6 != t)
                                {
                                    Debug.LogFormat("[Disordered Keys #{0}] Error: Key {1} pushed at incorrect time", moduleID, k + 1);
                                    strike = true;
                                }
                                break;

                            case 3:
                                if ((alreadypressed[i] == false && quirk[i] != 3 && quirk[i] != 4) || (valueList[i] < valueList[k] && alreadypressed[i] == false && quirk[i] == 3))
                                {
                                    Debug.LogFormat("[Disordered Keys #{0}] Error: Key {1} pushed out of order- Key {2} should have been pressed before this", moduleID, k + 1, i + 1);
                                    strike = true;
                                }
                                break;
                            }
                            if (strike == true)
                            {
                                GetComponent <KMBombModule>().HandleStrike();
                                GetComponent <KMAudio>().PlaySoundAtTransform("Error", transform);
                                resetCount++;
                                Reset();
                                break;
                            }
                        }
                    }
                    else
                    {
                        pressCount++;
                        GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform);
                        key.transform.localPosition = new Vector3(0, 0, -1f);
                        if (quirk[k] == 5)
                        {
                            StopAllCoroutines();
                        }
                        if (pressCount == 6)
                        {
                            moduleSolved = true;
                            GetComponent <KMAudio>().PlaySoundAtTransform("InputCorrect", transform);
                            meter.material = keyColours[6];
                            Reset();
                        }
                    }
                }
            }
            else
            {
                for (int i = 0; i < 7; i++)
                {
                    if (i != 6)
                    {
                        if (i != k && alreadypressed[i] == false && quirk[i] != 4)
                        {
                            GetComponent <KMBombModule>().HandleStrike();
                            GetComponent <KMAudio>().PlaySoundAtTransform("Error", transform);
                            Debug.LogFormat("[Disordered Keys #{0}] Error: False key pressed", moduleID);
                            resetCount++;
                            Reset();
                            break;
                        }
                    }
                    else
                    {
                        pressCount++;
                        GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform);
                        key.transform.localPosition = new Vector3(0, 0, -1f);
                        if (pressCount == 6)
                        {
                            moduleSolved = true;
                            GetComponent <KMAudio>().PlaySoundAtTransform("InputCorrect", transform);
                            meter.material = keyColours[6];
                            Reset();
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 6
0
    public void numberPress(KMSelectable number)
    {
        if (moduleSolved)
        {
            return;
        }

        if (givenAnswer + 1 == correctAnswerLength)
        {
        }
        else
        {
            number.AddInteractionPunch(.5f);
            Audio.PlaySoundAtTransform("spray", transform);
        }

        if (number == numbers[0])
        {
            pickedNumber      = selectedNumbers[0];
            answer           += pickedNumber.ToString();
            bursts[0].enabled = true;
            numbersRend[0].SetActive(false);
            int burstText = UnityEngine.Random.Range(0, 4);
            bursts[0].material.mainTexture = burstColors[burstText];
        }
        else if (number == numbers[1])
        {
            pickedNumber      = selectedNumbers[1];
            answer           += pickedNumber.ToString();
            bursts[1].enabled = true;
            numbersRend[1].SetActive(false);
            int burstText = UnityEngine.Random.Range(0, 4);
            bursts[1].material.mainTexture = burstColors[burstText];
        }
        else if (number == numbers[2])
        {
            pickedNumber      = selectedNumbers[2];
            answer           += pickedNumber.ToString();
            bursts[2].enabled = true;
            numbersRend[2].SetActive(false);
            int burstText = UnityEngine.Random.Range(0, 4);
            bursts[2].material.mainTexture = burstColors[burstText];
        }
        else if (number == numbers[3])
        {
            pickedNumber      = selectedNumbers[3];
            answer           += pickedNumber.ToString();
            bursts[3].enabled = true;
            numbersRend[3].SetActive(false);
            int burstText = UnityEngine.Random.Range(0, 4);
            bursts[3].material.mainTexture = burstColors[burstText];
        }
        else if (number == numbers[4])
        {
            pickedNumber      = selectedNumbers[4];
            answer           += pickedNumber.ToString();
            bursts[4].enabled = true;
            numbersRend[4].SetActive(false);
            int burstText = UnityEngine.Random.Range(0, 4);
            bursts[4].material.mainTexture = burstColors[burstText];
        }
        else if (number == numbers[5])
        {
            pickedNumber      = selectedNumbers[5];
            answer           += pickedNumber.ToString();
            bursts[5].enabled = true;
            numbersRend[5].SetActive(false);
            int burstText = UnityEngine.Random.Range(0, 4);
            bursts[5].material.mainTexture = burstColors[burstText];
        }
        else if (number == numbers[6])
        {
            pickedNumber      = selectedNumbers[6];
            answer           += pickedNumber.ToString();
            bursts[6].enabled = true;
            numbersRend[6].SetActive(false);
            int burstText = UnityEngine.Random.Range(0, 4);
            bursts[6].material.mainTexture = burstColors[burstText];
        }
        else if (number == numbers[7])
        {
            pickedNumber      = selectedNumbers[7];
            answer           += pickedNumber.ToString();
            bursts[7].enabled = true;
            numbersRend[7].SetActive(false);
            int burstText = UnityEngine.Random.Range(0, 4);
            bursts[7].material.mainTexture = burstColors[burstText];
        }
        else if (number == numbers[8])
        {
            pickedNumber      = selectedNumbers[8];
            answer           += pickedNumber.ToString();
            bursts[8].enabled = true;
            numbersRend[8].SetActive(false);
            int burstText = UnityEngine.Random.Range(0, 4);
            bursts[8].material.mainTexture = burstColors[burstText];
        }
        givenAnswer++;
    }
Exemplo n.º 7
0
    void ButtonPress(KMSelectable Button)
    {
        Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, Button.transform);
        if (moduleSolved)
        {
            return;
        }
        for (int i = 0; i < 25; i++)
        {
            if (Button == Buttons[i])
            {
                if (Adding)
                {
                    if (TowerPlacements[i] != 4 && Cubes[i * 5 + TowerPlacements[i]].gameObject.activeSelf)
                    {
                        TowerPlacements[i]++;
                    }
                    Cubes[i * 5 + TowerPlacements[i]].gameObject.SetActive(true);
                    if (TowerPlacements[i] != 4)
                    {
                        TowerPlacements[i]++;
                        TowerChecking[i] = TowerPlacements[i];
                    }
                    else
                    {
                        TowerChecking[i] = 5;
                    }
                }
                else
                {
                    if (TowerPlacements[i] == 0)
                    {
                        return;
                    }
                    if (TowerPlacements[i] != 0 && !Cubes[i * 5 + TowerPlacements[i]].gameObject.activeSelf)
                    {
                        TowerPlacements[i]--;
                    }
                    Cubes[i * 5 + TowerPlacements[i]].gameObject.SetActive(false);
                    if (TowerPlacements[i] != 0)
                    {
                        TowerChecking[i] = TowerPlacements[i];
                    }
                }
            }
        }
        int Check = 0;

        for (int i = 0; i < 5; i++)       //Each if statement checks if the row contains the sum of all numbers from 1-5 (15), while each for loop checks the column
        {
            Check += TowerChecking[i];
        }
        if (Check != 15)
        {
            return;
        }
        for (int i = 5; i < 10; i++)
        {
            Check += TowerChecking[i];
        }
        if (Check != 30)
        {
            return;
        }
        for (int i = 10; i < 15; i++)
        {
            Check += TowerChecking[i];
        }
        if (Check != 45)
        {
            return;
        }
        for (int i = 15; i < 20; i++)
        {
            Check += TowerChecking[i];
        }
        if (Check != 60)
        {
            return;
        }
        for (int i = 20; i < 25; i++)
        {
            Check += TowerChecking[i];
        }
        if (Check != 75)
        {
            return;
        }
        SolveChecker();
    }
Exemplo n.º 8
0
 void ButtonPress(KMSelectable button)
 {
     if (!moduleSolved)
     {
         button.AddInteractionPunch();
         GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.TypewriterKey, button.transform);
         button.AddInteractionPunch();
         GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.TypewriterKey, button.transform);
         button.AddInteractionPunch();
         displayTXTarray = displayTXT.text.ToCharArray();
         displayTXTarray[currentDigit] = button.GetComponentInChildren <TextMesh>().text.ToCharArray()[0];
         displayTXT.text = new string(displayTXTarray);
         if (currentDigit == 7)
         {
             if (displayTXT.text.ToLower() == answerA)
             {
                 striketrhough1.SetActive(true);
                 GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.WireSequenceMechanism, transform);
                 currentDigit    = 0;
                 displayTXT.text = displayKey;
                 Debug.LogFormat("[Keywords #{0}] Correct! Both the user input and the top answer was {1}.", moduleId, answerA.ToUpper());
                 if (striketrhough1.activeSelf && striketrhough2.activeSelf)
                 {
                     displayTXT.text = "--------";
                     moduleSolved    = true;
                     GetComponent <KMBombModule>().HandlePass();
                     GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                     button.AddInteractionPunch(4f);
                     GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                     return;
                 }
                 return;
             }
             if (displayTXT.text.ToLower() == answerB)
             {
                 striketrhough2.SetActive(true);
                 GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.WireSequenceMechanism, transform);
                 currentDigit    = 0;
                 displayTXT.text = displayKey;
                 Debug.LogFormat("[Keywords #{0}] Correct! Both the user input and the bottom answer was {1}.", moduleId, answerB.ToUpper());
                 if (striketrhough1.activeSelf && striketrhough2.activeSelf)
                 {
                     displayTXT.text = "--------";
                     moduleSolved    = true;
                     GetComponent <KMBombModule>().HandlePass();
                     GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                     button.AddInteractionPunch(4f);
                     GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                     return;
                 }
                 return;
             }
             if ((displayTXT.text.ToLower() != answerA) && (displayTXT.text.ToLower() != answerB))
             {
                 Debug.LogFormat("[Keywords #{0}] Wrong!!! The user input was {1} when the correct answers were {2} and {3}.", moduleId, displayTXT.text.ToLower(), answerA, answerB);
                 button.AddInteractionPunch(4f);
                 GetComponent <KMBombModule>().HandleStrike();
                 button.AddInteractionPunch(4f);
                 currentDigit    = 0;
                 displayTXT.text = displayKey;
                 return;
             }
         }
         if (striketrhough1.activeSelf && striketrhough2.activeSelf)
         {
             displayTXT.text = "--------";
             moduleSolved    = true;
             GetComponent <KMBombModule>().HandlePass();
             GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
             button.AddInteractionPunch(4f);
             GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
             return;
         }
     }
     else
     {
         button.AddInteractionPunch(0.25f);
         GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.TypewriterKey, button.transform);
         button.AddInteractionPunch(0.25f);
     }
     currentDigit += 1;
 }
    IEnumerator ProcessTwitchCommand(string command)
    {
        command = command.ToLowerInvariant();


        List <string> split = command.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();

        if (split[0] == "rotate" || split[0] == "look")
        {
            if (split[0] == "look" && (split.Count == 1 || GetPosition(split[1]) < 0))
            {
                yield return(split.Count == 1
                    ? string.Format("sendtochaterror I don't know which peg I should be looking at.")
                    : string.Format("sendtochaterror I don't know what you mean by the {0} peg", split[1]));

                yield break;
            }

            if (split.Count > 2)
            {
                yield return(string.Format("sendtochaterror I don't know how to process command: {0}", command));

                yield break;
            }

            int start = 0;
            if (split.Count == 2)
            {
                start = GetPosition(split[1]);
            }

            if (start == -1 || start == -3)
            {
                yield return(string.Format("sendtochaterror I don't know what you mean by the {0} peg.", split[1]));

                yield break;
            }


            bool rotatepegs = start == -2;
            if (rotatepegs)
            {
                start = 0;
            }
            yield return(null);

            yield return(null);

            bool frontFace = transform.parent.parent.localEulerAngles.z < 45 || transform.parent.parent.localEulerAngles.z > 315;

            IEnumerator rotate = RotateBomb(frontFace, true, start);
            while (rotate.MoveNext())
            {
                yield return(rotate.Current);
            }

            if (rotatepegs)
            {
                for (int i = 0; i < 5 && !TwitchShouldCancelCommand; i++)
                {
                    for (int j = 0; j < 5; j++)
                    {
                        IEnumerator rotatepeg = RotatePeg(i, j + 1);
                        while (rotatepeg.MoveNext())
                        {
                            yield return(rotatepeg.Current);
                        }
                    }
                }
            }
            else
            {
                if (split[0] == "rotate")
                {
                    for (int i = start; i < (start + 4); i++)
                    {
                        if (!TwitchShouldCancelCommand)
                        {
                            yield return(new WaitForSeconds(split.Count == 2 ? 0.25f : 3f));
                        }

                        rotate = RotatePegCircle(i + 1);
                        while (rotate.MoveNext())
                        {
                            yield return(rotate.Current);
                        }
                    }
                }
                if (!TwitchShouldCancelCommand)
                {
                    if (split[0] == "look")
                    {
                        yield return(new WaitForSeconds(4));
                    }
                    else
                    {
                        yield return(new WaitForSeconds(split.Count == 2 ? 0.25f : 3f));
                    }
                }
            }

            rotate = RotateBomb(frontFace, false, 0);
            while (rotate.MoveNext())
            {
                yield return(rotate.Current);
            }

            if (TwitchShouldCancelCommand)
            {
                yield return("cancelled");
            }
        }
        else
        {
            List <KMSelectable> pegs = new List <KMSelectable>();
            bool skipped             = false;
            foreach (string pegtopress in split)
            {
                switch (GetPosition(pegtopress))
                {
                case 0:
                case 1:
                case 2:
                case 3:
                case 4:
                    KMSelectable peg = Pegs[GetPosition(pegtopress)];
                    if (pegs.Contains(peg))
                    {
                        yield return(string.Format("sendtochaterror I can't press the {0} peg more than once.", new[] { "top", "top right", "bottom right", "bottom left", "top left" }[GetPosition(pegtopress)]));

                        yield break;
                    }
                    pegs.Add(peg);
                    break;

                case -3:        //Press/submit
                    skipped = true;
                    break;

                default:
                    yield return(!pegs.Any() && !skipped
                            ? string.Format("sendtochaterror Valid commands are 'look', 'rotate', 'press', or 'submit'")
                            : string.Format("sendtochaterror I don't know what you mean by the {0} peg.", pegtopress));

                    yield break;
                }
            }

            if (pegs.Count != 3)
            {
                yield return(string.Format("sendtochaterror I need exactly which three pegs to press. You told me to press {0} peg{1}.", pegs.Count, pegs.Count != 1 ? "s" : ""));

                yield break;
            }

            yield return(null);

            foreach (KMSelectable peg in pegs)
            {
                peg.OnInteract();
                yield return(new WaitForSeconds(DURATION));
            }
            yield return(new WaitForSeconds(DURATION));
        }
    }
    private void Awake()
    {
        RootSelectable = GetComponent <KMSelectable>();

        GoToPage(MainMenuPrefab.name);
    }
Exemplo n.º 11
0
    //Twitch plays integration
    public IEnumerator ProcessTwitchCommand(string command)
    {
        Match modulesMatch  = Regex.Match(command, "((press|hold) )?(♩|♪|♫|♬|tl|tr|bl|br|lt|rt|lb|rb|[1-4])( (for )?([0-9]+))?", RegexOptions.IgnoreCase);
        int   buttonGroup   = 3;
        int   durationGroup = 6;

        if (!modulesMatch.Success)
        {
            if (command.Equals("mash", System.StringComparison.InvariantCultureIgnoreCase))
            {
                LogMessage("Mashing buttons!");
                for (int i = 0; i < 4; i++)
                {
                    yield return(buttons[2]);

                    yield return(new WaitForSeconds(0.04f));
                }

                yield return(new WaitForSeconds(0.04f));

                while (timesPressed < timesNeeded)
                {
                    KMSelectable button = buttons[Random.Range(0, 4)];
                    yield return(button);

                    yield return(new WaitForSeconds(0.04f));

                    yield return(button);

                    yield return(new WaitForSeconds(0.04f));
                }
                yield break;
            }
            LogMessage("Invalid Twitch command \"" + command + "\".");
            yield break;
        }

        KMSelectable selectedButton = null;
        string       buttonName     = modulesMatch.Groups[buttonGroup].Value;

        switch (buttonName)
        {
        case "tl":
        case "lt":
        case "1":
            selectedButton = twitchPlaysButtons[0];
            break;

        case "tr":
        case "rt":
        case "2":
            selectedButton = twitchPlaysButtons[1];
            break;

        case "bl":
        case "lb":
        case "3":
            selectedButton = twitchPlaysButtons[2];
            break;

        case "br":
        case "rb":
        case "4":
            selectedButton = twitchPlaysButtons[3];
            break;

        default:
            for (int i = 0; i < 4; i++)
            {
                if (labels[i].Equals(buttonName, System.StringComparison.InvariantCultureIgnoreCase))
                {
                    selectedButton = buttons[i];
                }
            }
            break;
        }

        if (selectedButton == null)
        {
            LogMessage("Invalid Twitch command \"" + command + "\" (invalid button '" + modulesMatch.Groups[buttonGroup].Value + "').");
            yield break;
        }

        int count = 0;

        if (!(modulesMatch.Groups[durationGroup].Value == ""))
        {
            count = int.Parse(modulesMatch.Groups[durationGroup].Value);
        }

        float duration = (count * beepLength) + (preBeepPause / 2);

        LogMessage("Valid Twitch command \"" + command + "\". Holding for a duration of " + duration + " seconds.");

        yield return(selectedButton);

        yield return(new WaitForSeconds(duration));

        yield return(selectedButton);
    }
Exemplo n.º 12
0
    private IEnumerator KnobTurn(KMSelectable r)
    {
        yield return(null);

        var hold = 0;

        if ((r == Hot && knob2turn) || r == Cold && !knob2turn)
        {
            if (r == Hot)
            {
                hotP += 2.5f;
            }
            else
            {
                coldP += 2.5f;
            }
            while (hold != 15)
            {
                yield return(new WaitForSeconds(0.001f));

                r.transform.Rotate(Vector3.up, 2.5f);
                hold += 1;
            }
            if (curknob == 2)
            {
                if (rotate && c == 0 && spin > 1500)
                {
                    c = 1;
                    WaitForSol();
                    yield break;
                }
                BombModule.HandlePass();
                SOLVED = true;
                DebugLog("The module has been defused.");
            }
            else
            {
                /*DebugLog("test2" + " " + curknob.ToString());
                 * if (rotate && c == 0 && curknob < 2)
                 * {
                 *  c = 2;
                 *  WaitForSol();
                 *  yield break;
                 * }
                 * if (rotate && c == 0)
                 * {
                 *  c = 3;
                 *  WaitForSol();
                 *  yield break;
                 * }*/
                curknob++;
            }
        }
        else
        {
            while (hold != 15)
            {
                yield return(new WaitForSeconds(0.001f));

                r.transform.Rotate(Vector3.up, -2.5f);
                hold += 1;
            }
            if (r == Hot)
            {
                hotP -= 2.5f;
            }
            else
            {
                coldP -= 2.5f;
            }
            while (hold != 30)
            {
                yield return(new WaitForSeconds(0.001f));

                Hot.transform.Rotate(Vector3.up, -hotP);
                Cold.transform.Rotate(Vector3.up, -coldP);
                hold += 1;
            }
            hotP  = 0;
            coldP = 0;
            BombModule.HandleStrike();
            curknob = 0;
        }
        hold     = 0;
        canPress = true;
    }
Exemplo n.º 13
0
    protected void Start()
    {
        ModConfig modConfig = new ModConfig("SinkSettings", typeof(SinkSettings));

        Settings = (SinkSettings)modConfig.Settings;
        if (moduleType == Type.Faulty && Settings.fault == "0")
        {
            moduleType = Type.Normal;
            BombModule.ModuleDisplayName = "Sink";
            BombModule.ModuleType        = "Sink";
        }
        Sink_moduleId = Sink_moduleIdCounter++;

        ColKnobs  = UnityEngine.Random.Range(0, 3);
        ColFaucet = UnityEngine.Random.Range(0, 3);
        ColPipe   = UnityEngine.Random.Range(0, 3);

        Rules = new bool[6] {
            BombInfo.GetOffIndicators().Contains("NSA"), BombInfo.GetSerialNumberLetters().Any("AEIOU".Contains), (ColKnobs == 2), (ColFaucet == 1), (ColPipe == 0), (BombInfo.GetPorts().Contains("HDMI") || BombInfo.GetPorts().Contains("RJ45"))
        };

        if (moduleType == Type.Normal && BombModule.GetComponent <KMSelectable>().Children.Count() > 2)
        {
            for (int i = 1; i < 8; i++)
            {
                if (i != 2)
                {
                    BombModule.GetComponent <KMSelectable>().Children[i] = null;
                }
            }
        }
        if (moduleType == Type.Faulty)
        {
            spin = UnityEngine.Random.Range(0, 20);
            if (spin > 15)
            {
                rotate = true;
            }
            var faulty = UnityEngine.Random.Range(0, 5);
            Faucet = BombModule.GetComponent <KMSelectable>().Children[1];
            Basin  = BombModule.GetComponent <KMSelectable>().Children[3];
            Pipe   = BombModule.GetComponent <KMSelectable>().Children[7];
            BombModule.GetComponent <KMSelectable>().Children[1] = null;
            for (int i = 3; i < 8; i++)
            {
                BombModule.GetComponent <KMSelectable>().Children[i] = null;
            }
            switch (faulty)
            {
            case 0:
                PipeMesh.material.color         = Color.black;
                ColdMesh.material.mainTexture   = knobColors[ColKnobs];
                HotMesh.material.mainTexture    = knobColors[ColKnobs];
                FaucetMesh.material.mainTexture = knobColors[ColFaucet];
                for (int i = 3; i < 6; i++)
                {
                    BombModule.GetComponent <KMSelectable>().Children[i] = Basin;
                }
                Basin.OnInteract += delegate() { FaultyPVC(1); return(false); };
                Hot.OnInteract   += delegate() { FaultyPVC(0); return(false); };
                Cold.OnInteract  += delegate() { FaultyPVC(2); return(false); };
                BombModule.GetComponent <KMSelectable>().UpdateChildren();
                goto start;

            case 1:
                ColPipe = 2;
                PipeMesh.material.color = new Color(0, 157 / 255f, 1);
                Rules[4] = false;
                Rules    = Rules.Select(x => !x).ToArray();
                break;

            case 2:
                var r = UnityEngine.Random.Range(0, 2);
                ColdMesh.material.mainTexture = knobColors[ColKnobs];
                HotMesh.material.mainTexture  = knobColors[ColKnobs];
                if (r == 0)
                {
                    ColdMesh.material = null;
                }
                else
                {
                    HotMesh.material = null;
                }
                BombModule.GetComponent <KMSelectable>().Children[1] = Faucet;
                BombModule.GetComponent <KMSelectable>().Children[7] = Pipe;
                BombModule.GetComponent <KMSelectable>().UpdateChildren();
                while (ColFaucet == ColPipe && ColKnobs == ColPipe)
                {
                    ColFaucet = UnityEngine.Random.Range(0, 3);
                    ColPipe   = UnityEngine.Random.Range(0, 3);
                }
                if (!ColFaucet.Equals(ColKnobs) && !ColPipe.Equals(ColKnobs))
                {
                    ColPipe = ColKnobs;
                }
                FaucetMesh.material.mainTexture = knobColors[ColFaucet];
                PipeMesh.material.mainTexture   = knobColors[ColPipe];
                if (!ColPipe.Equals(ColKnobs))
                {
                    PipeMesh.material.mainTexture = null;
                }
                Faucet.OnInteract = ButtonHandler(Faucet, 1, r);
                Pipe.OnInteract   = ButtonHandler(Pipe, 1, r);
                Cold.OnInteract   = ButtonHandler(Cold, 1, r);
                Hot.OnInteract    = ButtonHandler(Hot, 1, r);
                Rules[3]          = ColFaucet.Equals(1);
                Rules[4]          = ColPipe.Equals(0);
                goto start;

            case 3:
                rotate = false;
                var s          = UnityEngine.Random.Range(0, 2);
                var selectable = new[] { Faucet, Pipe };
                Hot.OnInteract += delegate() { BombModule.HandleStrike(); DebugLog("Warning: Overheating"); return(false); };
                if (s == 0)
                {
                    Hot = Faucet;
                    BombModule.GetComponent <KMSelectable>().Children[1] = Faucet;
                }
                else
                {
                    Hot = Pipe;
                    BombModule.GetComponent <KMSelectable>().Children[7] = Pipe;
                }
                ColKnobs  = 0;
                ColFaucet = 0;
                ColPipe   = 2;
                Rules[2]  = false;
                Rules[3]  = false;
                Rules[4]  = false;
                ColdMesh.material.color   = Color.black;
                HotMesh.material.color    = Color.black;
                FaucetMesh.material.color = Color.black;
                PipeMesh.material.color   = Color.black;
                Steps();
                goto start;

            case 4:
                BombModule.transform.Rotate(0, 180, 0);
                Rules = Rules.Reverse().ToArray();
                switch (BombInfo.GetBatteryCount())
                {
                case 0:
                case 1:
                    selectedRules = new[] { 4, 6, 5 };
                    break;

                case 2:
                case 3:
                    selectedRules = new[] { 1, 3, 5 };
                    Rules         = Rules.Select(x => !x).ToArray();
                    break;

                case 4:
                case 5:
                    selectedRules = new[] { 2, 6, 3 };
                    Rules         = Rules.Select(x => !x).ToArray();
                    break;

                default:
                    selectedRules = new[] { 4, 1, 2 };
                    break;
                }
                ColdMesh.material.mainTexture   = knobColors[ColKnobs];
                HotMesh.material.mainTexture    = knobColors[ColKnobs];
                FaucetMesh.material.mainTexture = knobColors[ColFaucet];

                knob1 = Rules[selectedRules[0] - 1];
                knob2 = Rules[selectedRules[1] - 1];
                knob3 = Rules[selectedRules[2] - 1];

                if (ColPipe != 2)
                {
                    PipeMesh.material.mainTexture = knobColors[ColPipe];
                }
                DebugLog("Third Knob: {0}", knob1 ? "Hot" : "Cold");
                DebugLog("Second Knob: {0}", knob2 ? "Hot" : "Cold");
                DebugLog("First Knob: {0}", knob3 ? "Hot" : "Cold");
                DebugLog("Knobs are {0}, Faucet is {1}, Drain Pipe is {2}", textureList[ColKnobs], textureList[ColFaucet], colorList[ColPipe]);
                StartCoroutine(CheckForTurn());
                Cold.OnInteract = ButtonHandler(Cold, 0);
                Hot.OnInteract  = ButtonHandler(Hot, 0);
                canPress        = true;
                BombModule.GetComponent <KMSelectable>().UpdateChildren();
                goto start;
            }
        }

        ColdMesh.material.mainTexture   = knobColors[ColKnobs];
        HotMesh.material.mainTexture    = knobColors[ColKnobs];
        FaucetMesh.material.mainTexture = knobColors[ColFaucet];

        if (ColPipe != 2)
        {
            PipeMesh.material.mainTexture = knobColors[ColPipe];
        }

        Steps();

        start : return;
    }
Exemplo n.º 14
0
 public SpeedButton(KMSelectable selectable, Renderer block, TextMesh text, TextMesh arrowText) : base(selectable, block, text)
 {
     ArrowText = arrowText;
 }
Exemplo n.º 15
0
    void ButtonPress(KMSelectable Button)
    {
        if (Button == Buttons[0])
        {
            Button.AddInteractionPunch();
            GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform);
            if (HAHAHAHAHAHHAHAHA > 0)
            {
                stageretard      += 1;
                HAHAHAHAHAHHAHAHA = -1;
                Debug.LogFormat("[Funny Numbers #{0}] You pressed EL FUNNY. That was correct.", moduleId);
                if (stageretard >= 6)
                {
                    GetComponent <KMBombModule>().HandlePass();
                    moduleSolved = true;
                    Audio.PlaySoundAtTransform("moan", transform);
                }
                else
                {
                    switch (stageretard)
                    {
                    case 2:
                        if (UnityEngine.Random.Range(0, 10) == 1)
                        {
                            stageretard = 5;
                        }
                        FunneChegg(retard2);
                        break;

                    case 3:
                        if (UnityEngine.Random.Range(0, 7) == 1)
                        {
                            stageretard = 5;
                        }
                        FunneChegg(retard3);
                        break;

                    case 4:
                        if (UnityEngine.Random.Range(0, 5) == 2)
                        {
                            stageretard = 5;
                        }
                        FunneChegg(retard4);
                        break;

                    case 5:
                        FunneChegg(retard5);
                        break;

                    default:
                        Debug.LogFormat("Chegg");
                        break;
                    }
                }
            }
            else
            {
                GetComponent <KMBombModule>().HandleStrike();
                Debug.LogFormat("[Funny Numbers #{0}] You pressed funny when it was unfunny. F**k! Nooooooooooooo!", moduleId);
            }
        }
        else if (Button == Buttons[1])
        {
            Button.AddInteractionPunch();
            GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform);
            if (HAHAHAHAHAHHAHAHA <= 0)
            {
                stageretard      += 1;
                HAHAHAHAHAHHAHAHA = -1;
                Debug.LogFormat("[Funny Numbers #{0}] You pressed EL NO FUNNY. That was correct.", moduleId);
                if (stageretard >= 6)
                {
                    GetComponent <KMBombModule>().HandlePass();
                    moduleSolved = true;
                    Audio.PlaySoundAtTransform("moan", transform);
                }
                else
                {
                    switch (stageretard)
                    {
                    case 2:
                        FunneChegg(retard2);
                        break;

                    case 3:
                        FunneChegg(retard3);
                        break;

                    case 4:
                        FunneChegg(retard4);
                        break;

                    case 5:
                        FunneChegg(retard5);
                        break;

                    default:
                        Debug.Log("Chegg");
                        break;
                    }
                }
            }
            else
            {
                GetComponent <KMBombModule>().HandleStrike();
                Debug.LogFormat("[Funny Numbers #{0}] You pressed unfunny when it was funny. F**k!", moduleId);
            }
        }
        else
        {
        }
    }
Exemplo n.º 16
0
 public void Start()
 {
     this.kmSelectable                 = this.GetComponent <KMSelectable>();
     this.kmSelectable.OnInteract      = this.KMSelectable_Interact;
     this.kmSelectable.OnInteractEnded = this.KMSelectable_InteractEnded;
 }
    void eyePress(KMSelectable pressedEye)
    {
        beforeMovement = currentMood;
        pressedEye.AddInteractionPunch();
        if (pressedEye == TheEyes[0])                         //left
        {
            if (mod((int)Math.Floor(Bomb.GetTime()), 2) == 0) //even
            //LEFT
            {
                currentX -= 1;
                movement  = 3;
            }
            else     //odd
            //DOWN
            {
                currentY += 1;
                movement  = 2;
            }
        }
        else                                                  //right
        {
            if (mod((int)Math.Floor(Bomb.GetTime()), 2) == 0) //even
            //RIGHT
            {
                currentX += 1;
                movement  = 1;
            }
            else     //odd
            //Up
            {
                currentY -= 1;
                movement  = 0;
            }
        }
        if (currentX <= -1)
        {
            currentX += 7;
        }
        if (currentX >= 7)
        {
            currentX -= 7;
        }
        if (currentY <= -1)
        {
            currentY += 7;
        }
        if (currentY >= 7)
        {
            currentY -= 7;
        }
        currentMood = currentY * 7 + currentX;

        while (emptySpaces[currentMood] == '#')
        {
            switch (movement)
            {
            case 0: currentMood -= 7; if (currentMood < 0)
                {
                    currentMood += 49;
                }
                break;

            case 1: currentMood += 1; if (mod(currentMood, 7) == 0)
                {
                    currentMood = mod(currentMood + 42, 49);
                }
                break;

            case 2: currentMood += 7; if (currentMood > 49)
                {
                    currentMood -= 49;
                }
                break;

            case 3: currentMood -= 1; if (mod(currentMood, 7) == 6)
                {
                    currentMood = mod(currentMood + 7, 49);
                }
                break;

            default: Debug.Log("Damnit."); break;
            }

            if (invalidMoods.IndexOf(currentMood) != -1)
            {
                Debug.LogFormat("[Frankenstein's Indicator #{0}] Trying to move {1} would result in an invalid mood at {2}. Strike!", moduleId, movementNames[movement], coords[currentMood]);
                GetComponent <KMBombModule>().HandleStrike();
                currentMood = beforeMovement;
            }
        }
        currentY = currentMood / 7;
        currentX = mod(currentMood, 7);
        if (invalidMoods.IndexOf(currentMood) != -1)
        {
            Debug.LogFormat("[Frankenstein's Indicator #{0}] Trying to move {1} would result in an invalid mood at {2}. Strike!", moduleId, movementNames[movement], coords[currentMood]);
            GetComponent <KMBombModule>().HandleStrike();
            currentMood = beforeMovement;
        }
        else
        {
            if (beforeMovement != currentMood)
            {
                Debug.LogFormat("[Frankenstein's Indicator #{0}] You moved {1}, you are now at {2}.", moduleId, movementNames[movement], coords[currentMood]);
            }
            ShowFace();
        }
    }
Exemplo n.º 18
0
 void PressButton(KMSelectable pressed)
 {
     if (moduleSolved != true && cooldown != true && delayed != true)
     {
         audio.GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, pressed.transform);
         pressed.AddInteractionPunch(0.25f);
         if (buttons[0] == pressed)
         {
             if (readyForInput == true)
             {
                 if (currentSwitch.Equals(nextSwitch))
                 {
                     readyForInput = false;
                     if (otherOrgs == true)
                     {
                         arrow.GetComponent <Renderer>().enabled = false;
                     }
                     if (order.Count == 0)
                     {
                         module.GetComponent <Text>().text = "No Modules :)";
                         Debug.LogFormat("[Organization #{0}] All non-ignored modules solved! GG!", moduleId);
                         moduleSolved = true;
                         bomb.GetComponent <KMBombModule>().HandlePass();
                     }
                     else
                     {
                         if (TimeModeActive == true)
                         {
                             audio.GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                             if (otherOrgs == true)
                             {
                                 module.GetComponent <Text>().text = "In Cooldown...";
                             }
                             else
                             {
                                 module.GetComponent <Text>().text = "In Cooldown...";
                             }
                             StartCoroutine(timer());
                         }
                         else
                         {
                             audio.GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                             Debug.LogFormat("[Organization #{0}] The next module is now shown! '{1}'!", moduleId, order.ElementAt(0));
                             string temp = order[0];
                             if (temp.Contains('’'))
                             {
                                 temp = temp.Replace("’", "\'");
                             }
                             else if (temp.Contains('³'))
                             {
                                 temp = temp.Replace('³', '3');
                             }
                             else if (temp.Contains('è'))
                             {
                                 temp = temp.Replace('è', 'e');
                             }
                             module.GetComponent <Text>().text = "" + temp;
                         }
                     }
                 }
                 else
                 {
                     Debug.LogFormat("[Organization #{0}] The switch is not in the correct position (currently '{1}')! Strike!", moduleId, currentSwitch);
                     bomb.GetComponent <KMBombModule>().HandleStrike();
                     int rand = UnityEngine.Random.Range(0, 3);
                     if (rand == 0)
                     {
                         audio.GetComponent <KMAudio>().PlaySoundAtTransform("wrong1", transform);
                     }
                     else if (rand == 1)
                     {
                         audio.GetComponent <KMAudio>().PlaySoundAtTransform("wrong2", transform);
                     }
                     else
                     {
                         audio.GetComponent <KMAudio>().PlaySoundAtTransform("wrong3", transform);
                     }
                 }
             }
             else
             {
                 Debug.LogFormat("[Organization #{0}] The current module has not been solved yet! Strike!", moduleId);
                 bomb.GetComponent <KMBombModule>().HandleStrike();
                 int rand = UnityEngine.Random.Range(0, 3);
                 if (rand == 0)
                 {
                     audio.GetComponent <KMAudio>().PlaySoundAtTransform("wrong1", transform);
                 }
                 else if (rand == 1)
                 {
                     audio.GetComponent <KMAudio>().PlaySoundAtTransform("wrong2", transform);
                 }
                 else
                 {
                     audio.GetComponent <KMAudio>().PlaySoundAtTransform("wrong3", transform);
                 }
             }
         }
         else if (buttons[1] == pressed)
         {
             if (currentSwitch.Equals("Up"))
             {
                 currentSwitch = "Down";
                 StartCoroutine(downSwitch());
             }
             else if (currentSwitch.Equals("Down"))
             {
                 currentSwitch = "Up";
                 StartCoroutine(upSwitch());
             }
         }
     }
 }
 private void GenericButtonPress(KMSelectable btn)
 {
     btn.AddInteractionPunch(0.3f);
     Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, btn.transform);
 }
Exemplo n.º 20
0
    void Awake()
    {
        ModConfig <OrganizationSettings> modConfig = new ModConfig <OrganizationSettings>("OrganizationSettings");

        //Read from the settings file, or create one if one doesn't exist
        Settings = modConfig.Settings;
        //Update the settings file incase there was an error during read
        modConfig.Settings = Settings;
        nextSwitch         = "";
        currentSwitch      = "Up";
        moduleId           = moduleIdCounter++;
        moduleSolved       = false;
        foreach (KMSelectable obj in buttons)
        {
            KMSelectable pressed = obj;
            pressed.OnInteract += delegate() { PressButton(pressed); return(false); };
        }
        if (fullModuleList == null)
        {
            fullModuleList = GetComponent <KMBossModule>().GetIgnoredModules("Organization", new string[] {
                "Forget Me Not",     //Mandatory to prevent unsolvable bombs.
                "Forget Everything", //Cruel FMN.
                "Turn The Key",      //TTK is timer based, and stalls the bomb if only it and FI are left.
                "Souvenir",          //Similar situation to TTK, stalls the bomb.
                "The Time Keeper",   //Again, timilar to TTK.
                "Forget This",
                "Simon's Stages",
                "Timing is Everything",
                "Organization", //Also mandatory to prevent unsolvable bombs.
                "The Swan",
                "Hogwarts",
                "Divided Squares",
                "Cookie Jars",
                "Turn The Keys",
                "Forget Them All",
                "Tallordered Keys",
                "Purgatory",
                "Forget Us Not",
                "Forget Perspective"
            });
        }
        List <IEnumerable <string> > ignoreLists = new List <IEnumerable <string> >();

        ignoredModules = fullModuleList.ToArray();
        //Split the lists at empty values
        while (ignoredModules.Count() > 0)
        {
            ignoreLists.Add(ignoredModules.TakeWhile(x => x != ""));
            ignoredModules = ignoredModules.SkipWhile(x => x != "").Skip(1).ToArray();
        }
        //If we're ignoring solved based modules and the ignored module list is compatble, combine two of the lists
        if (Settings.ignoreSolveBased && ignoreLists.Count > 1)
        {
            ignoredModules = ignoreLists[0].Concat(ignoreLists[1]).ToArray();
        }
        //If the ignore module list is incompatible or solved based modules will not be ignored, either use the whole list or the first split
        else
        {
            ignoredModules = ignoreLists.FirstOrDefault().ToArray();
        }
        //If the JSON is compatible with move to back modules, add them here
        if (ignoreLists.Count > 2)
        {
            backModules = ignoreLists.Last().ToArray();
        }
        GetComponent <KMBombModule>().OnActivate += OnActivate;
    }
Exemplo n.º 21
0
 void DogsPress(KMSelectable Dog)
 {
     Debug.Log("A dog has been pressed.");
 }
Exemplo n.º 22
0
    private void KeyPress(KMSelectable key)
    {
        int k = keys.IndexOf(key);

        if (alreadypressed[k] == false && moduleSolved == false && pressable == true)
        {
            GetComponent <KMAudio>().PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform);
            alreadypressed[k]           = true;
            key.transform.localPosition = new Vector3(0, 0, -1f);
            if (k != pivot)
            {
                if (swapCount < 6)
                {
                    if (onepress == false)
                    {
                        onepress    = true;
                        keyCatch[0] = k;
                    }
                    else
                    {
                        onepress    = false;
                        pressable   = false;
                        keyCatch[1] = k;
                        swapCount++;
                        Debug.LogFormat("[Reordered Keys #{0}] Swapped keys {1} and {2}: {3} swaps remaining", moduleID, keyCatch[0], keyCatch[1], 6 - swapCount);
                        StartCoroutine(sequence[1]);
                    }
                }
                else
                {
                    swapCount = 0;
                    Debug.LogFormat("[Reordered Keys #{0}] Out of swaps: Reset", moduleID);
                    resetCount++;
                    Reset();
                }
            }
            else
            {
                onepress  = false;
                swapCount = 0;
                string[] IO         = initialOrder.ToArray();
                string   submission = String.Join(String.Empty, IO);
                if (submission == answer)
                {
                    Audio.PlaySoundAtTransform("InputCorrect", transform);
                    meter[stage - 1].material = keyColours[7];
                    if (stage < 2)
                    {
                        stage++;
                    }
                    else
                    {
                        moduleSolved = true;
                    }
                }
                else
                {
                    GetComponent <KMBombModule>().HandleStrike();
                }
                resetCount++;
                Reset();
            }
        }
    }
Exemplo n.º 23
0
    public void ButtonPress(KMSelectable button)
    {
        button.AddInteractionPunch(0.2f);
        Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonPress, transform);

        if (moduleSolved == true)
        {
            return;
        }

        else
        {
            switch (correctAnswer)
            {
            case Answers.Unicorn:     //Rule 1
                if (button == buttons[6] && counter == 0)
                {
                    counter = 1;
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}.", moduleId, button.gameObject.name);
                }
                else if (button == buttons[6] && counter == 1)
                {
                    counter = 2;
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}.", moduleId, button.gameObject.name);
                }
                else if (button == buttons[6] && counter == 2)
                {
                    counter = 3;
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}.", moduleId, button.gameObject.name);
                }
                else if (button == buttons[6] && counter == 3)
                {
                    counter = 4;
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}.", moduleId, button.gameObject.name);
                }
                else if (button == buttons[6] && counter == 4)
                {
                    module.HandlePass();
                    Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                    moduleSolved = true;
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}. Module Disarmed.", moduleId, button.gameObject.name);
                }
                else
                {
                    Debug.LogFormat("[The Block #{0}] The Button you pressed was: {1}. This was incorrect - Strike Incurred", moduleId, button.gameObject.name);
                    Strike();
                }
                break;

            case Answers.FirstGreen:     //Rule 2
                for (int i = 0; i < 6; i++)
                {
                    if (cubeFaceColours[i] == FaceColour.Green)
                    {
                        correctButton = i;
                        break;
                    }
                }
                if (button == buttons[correctButton])
                {
                    module.HandlePass();
                    moduleSolved = true;
                    Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}. Module Disarmed.", moduleId, button.gameObject.name);
                }
                else
                {
                    Debug.LogFormat("[The Block #{0}] The Button you pressed was: {1}. This was incorrect - Strike Incurred", moduleId, button.gameObject.name);
                    Strike();
                }

                break;

            case Answers.AllReverse:     //Rule 3
                if (button == buttons[counter])
                {
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}.", moduleId, button.gameObject.name);
                    if (counter == 0)
                    {
                        module.HandlePass();
                        moduleSolved = true;
                        Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                        Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}. Module Disarmed.", moduleId, button.gameObject.name);
                    }
                    else
                    {
                        counter--;
                    }
                }
                else
                {
                    Debug.LogFormat("[The Block #{0}] The Button you pressed was: {1}. This was incorrect - Strike Incurred", moduleId, button.gameObject.name);
                    Strike();
                }
                break;

            case Answers.Side5:     //Rule 4
                if (button == buttons[4])
                {
                    module.HandlePass();
                    moduleSolved = true;
                    Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}. Module Disarmed.", moduleId, button.gameObject.name);
                }
                else
                {
                    Debug.LogFormat("[The Block #{0}] The Button you pressed was: {1}. This was incorrect - Strike Incurred", moduleId, button.gameObject.name);
                    Strike();
                }
                break;

            case Answers.Side2Side4:     //Rule 5
                if (button == buttons[1] && counter == 0)
                {
                    counter = 1;
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}.", moduleId, button.gameObject.name);
                }
                else if (button == buttons[3] && counter == 1)
                {
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}. Module Disarmed.", moduleId, button.gameObject.name);
                    moduleSolved = true;
                    module.HandlePass();
                    Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                }
                else
                {
                    Debug.LogFormat("[The Block #{0}] The Button you pressed was: {1}. This was incorrect - Strike Incurred", moduleId, button.gameObject.name);
                    Strike();
                }
                break;

            case Answers.AllNumerical:     //Rule 6
                if (button == buttons[counter])
                {
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}.", moduleId, button.gameObject.name);
                    if (counter == 5)
                    {
                        module.HandlePass();
                        Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                        moduleSolved = true;
                        Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}. Module Disarmed.", moduleId, button.gameObject.name);
                    }
                    else
                    {
                        counter++;
                    }
                }
                else
                {
                    Debug.LogFormat("[The Block #{0}] The Button you pressed was: {1}. This was incorrect - Strike Incurred", moduleId, button.gameObject.name);
                    Strike();
                }
                break;

            case Answers.BlockRule7:     //Rule 7
                if (button == buttons[6])
                {
                    module.HandlePass();
                    Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                    moduleSolved = true;
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}. Module Disarmed.", moduleId, button.gameObject.name);
                }
                else
                {
                    Debug.LogFormat("[The Block #{0}] The Button you pressed was: {1}. This was incorrect - Strike Incurred", moduleId, button.gameObject.name);
                    Strike();
                }
                break;

            case Answers.LastBlue:     //Rule 8
                for (int i = 5; i > -1; i--)
                {
                    if (cubeFaceColours[i] == FaceColour.Blue)
                    {
                        correctButton = i;
                        break;
                    }
                }
                if (button == buttons[correctButton])
                {
                    module.HandlePass();
                    Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                    moduleSolved = true;
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}. Module Disarmed.", moduleId, button.gameObject.name);
                }
                else
                {
                    Debug.LogFormat("[The Block #{0}] The Button you pressed was: {1}. This was incorrect - Strike Incurred", moduleId, button.gameObject.name);
                    Strike();
                }

                break;

            case Answers.EvenNumerical:     //Rule 9
                if (button == buttons[1] && counter == 0)
                {
                    counter = 1;
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}.", moduleId, button.gameObject.name);
                }
                else if (button == buttons[3] && counter == 1)
                {
                    counter = 2;
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}.", moduleId, button.gameObject.name);
                }
                else if (button == buttons[5] && counter == 2)
                {
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}. Module Disarmed.", moduleId, button.gameObject.name);
                    moduleSolved = true;
                    module.HandlePass();
                    Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                }
                else
                {
                    Debug.LogFormat("[The Block #{0}] The Button you pressed was: {1}. This was incorrect - Strike Incurred", moduleId, button.gameObject.name);
                    Strike();
                }
                break;

            case Answers.OddReverse:     //Rule 10
                if (button == buttons[4] && counter == 0)
                {
                    counter = 1;
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}.", moduleId, button.gameObject.name);
                }
                else if (button == buttons[2] && counter == 1)
                {
                    counter = 2;
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}.", moduleId, button.gameObject.name);
                }
                else if (button == buttons[0] && counter == 2)
                {
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}. Module Disarmed.", moduleId, button.gameObject.name);
                    moduleSolved = true;
                    module.HandlePass();
                    Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                }
                else
                {
                    Debug.LogFormat("[The Block #{0}] The Button you pressed was: {1}. This was incorrect - Strike Incurred", moduleId, button.gameObject.name);
                    Strike();
                }
                break;

            case Answers.FirstBlue:     //Rule 11
                for (int i = 0; i < 6; i++)
                {
                    if (cubeFaceColours[i] == FaceColour.Blue)
                    {
                        correctButton = i;
                        break;
                    }
                }
                if (button == buttons[correctButton])
                {
                    module.HandlePass();
                    Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                    moduleSolved = true;
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}. Module Disarmed.", moduleId, button.gameObject.name);
                }
                else
                {
                    Debug.LogFormat("[The Block #{0}] The Button you pressed was: {1}. This was incorrect - Strike Incurred", moduleId, button.gameObject.name);
                    Strike();
                }

                break;

            case Answers.BlockRule12:     //Rule 12
                if (button == buttons[6])
                {
                    module.HandlePass();
                    Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                    moduleSolved = true;
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}. Module Disarmed.", moduleId, button.gameObject.name);
                }
                else
                {
                    Debug.LogFormat("[The Block #{0}] The Button you pressed was: {1}. This was incorrect - Strike Incurred", moduleId, button.gameObject.name);
                    Strike();
                }
                break;

            case Answers.Side1Side4:     //Rule 13
                if (button == buttons[0] && counter == 0)
                {
                    counter = 1;
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}.", moduleId, button.gameObject.name);
                }
                else if (button == buttons[3] && counter == 1)
                {
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}. Module Disarmed.", moduleId, button.gameObject.name);
                    moduleSolved = true;
                    module.HandlePass();
                    Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                }
                else
                {
                    Debug.LogFormat("[The Block #{0}] The Button you pressed was: {1}. This was incorrect - Strike Incurred", moduleId, button.gameObject.name);
                    Strike();
                }
                break;

            case Answers.Side4Rule14:     //Rule 14
                if (button == buttons[3])
                {
                    module.HandlePass();
                    Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                    moduleSolved = true;
                    Debug.LogFormat("[The Block #{0}] The button you pressed was: {1}. Module Disarmed.", moduleId, button.gameObject.name);
                }
                else
                {
                    Debug.LogFormat("[The Block #{0}] The Button you pressed was: {1}. This was incorrect - Strike Incurred", moduleId, button.gameObject.name);
                    Strike();
                }
                break;
            }
        }
    }
Exemplo n.º 24
0
    void buttonPressed(KMSelectable pressedButton)
    {
        pressedButton.AddInteractionPunch();
        GetComponent <KMAudio>().PlayGameSoundAtTransformWithRef(KMSoundOverride.SoundEffect.ButtonPress, transform);

        incorrect = false;

        if (moduleSolved)
        {
            return;
        }
        else
        {
            for (int j = 0; j < glitchSquares.Count(); j++)
            {
                glitchSquares[j].color = glitchColors[8];
            }
            if (startingSoundEnabled && !moduleDetermined)
            {
                startingSoundEnabled = false;
                audio.PlaySoundAtTransform("beginningNoise", transform);
            }
            else
            {
                if (!memoryBankSeen)
                {
                    bombStarted = false;
                    StartCoroutine(glitchEffect());
                    memoryBankNumber = Rnd.Range(0, 100);
                    if (memoryBankNumber < 10)
                    {
                        memoryBankText.text = "0" + memoryBankNumber;
                        DebugMsg("The displayed number is " + 0 + memoryBankNumber + ".");
                    }
                    else
                    {
                        memoryBankText.text = "" + memoryBankNumber;
                        DebugMsg("The displayed number is " + memoryBankNumber + ".");
                    }
                    memoryBankColor = memoryBanks[memoryBankNumber];
                    for (int i = 0; i < 10; i++)
                    {
                        if (memoryBanks[i] == memoryBankColor)
                        {
                            memoryBankColumn = i;
                            i = 10;
                        }
                    }
                    memoryBankSeen = true;
                    Invoke("memoryBankTextGoByeBye", 3);
                }
                else if (!moduleDetermined)
                {
                    if (!logicDiveActive)
                    {
                        logicDiveGameObject.transform.localPosition = new Vector3(logicDiveGameObject.transform.localPosition.x, logicDiveGameObject.transform.localPosition.y - 100f, logicDiveGameObject.transform.localPosition.z);
                        buttons[0].transform.localPosition          = new Vector3(buttons[0].transform.localPosition.x, buttons[0].transform.localPosition.y + 100f, buttons[0].transform.localPosition.z);
                        moduleButtonGameObject.SetActive(false);
                        logicDiveGameObject.SetActive(true);
                        memoryBankText.text = "";
                        DebugMsg("Going into logic dive...");
                        logicDiveNumber = 0;
                        logicDiveActive = true;
                        logicDive();
                    }
                    else
                    {
                        logicDiveGameObject.transform.localPosition = new Vector3(logicDiveGameObject.transform.localPosition.x, logicDiveGameObject.transform.localPosition.y + 100f, logicDiveGameObject.transform.localPosition.z);
                        logicDiveGameObject.SetActive(false);
                        for (int i = 0; i < 9; i++)
                        {
                            if (buttons[i + 1] == pressedButton)
                            {
                                if (i != logicDiveCorrectButtonNum)
                                {
                                    incorrect = true;
                                }
                                i = 9;
                            }
                        }
                        if (!incorrect)
                        {
                            logicDiveActive = false;
                            StartCoroutine(glitchEffect());
                            DebugMsg("Logic Dive completed successfully. Remembering module...");
                            determineModule();
                        }
                        else
                        {
                            buttons[0].transform.localPosition = new Vector3(buttons[0].transform.localPosition.x, buttons[0].transform.localPosition.y - 100f, buttons[0].transform.localPosition.z);
                            moduleButtonGameObject.SetActive(true);
                            GetComponent <KMBombModule>().HandleStrike();
                            DebugMsg("Strike! Pressed incorrect button.");
                            logicDiveActive      = false;
                            logicDiveNumber      = 0;
                            startingSoundEnabled = true;
                            memoryBankSeen       = false;
                            incorrect            = false;
                            StartCoroutine(glitchEffect());
                        }
                    }
                }
                else
                {
                    if (whichModule == 0) //3 wires
                    {
                        for (int i = 0; i < 3; i++)
                        {
                            if (buttons[10 + i] == pressedButton && !cutWires[i])
                            {
                                cutWires[i] = true;
                                wires[i].GetComponent <MeshFilter>().mesh = wireCondition[1];
                                if (wireCombinations[memoryBankColumn + (wireIndex * 10)][nextWire].ToString() != (i + 1).ToString())
                                {
                                    DebugMsg("Strike! Pressed wire " + (i + 1) + ", while the correct wire was wire " + wireCombinations[memoryBankColumn + (wireIndex * 10)][nextWire] + ".");
                                    incorrect = true;
                                }
                                else
                                {
                                    nextWire++;
                                }
                                i = 3;
                            }
                        }
                        if (!incorrect && nextWire == 3)
                        {
                            DebugMsg("Module solved!");
                            moduleSolved = true;
                            GetComponent <KMBombModule>().HandlePass();
                        }
                        else if (incorrect)
                        {
                            GetComponent <KMBombModule>().HandleStrike();
                            incorrect = false;
                            nextWire  = 0;
                            threeWires();
                        }
                    }
                    else if (whichModule == 1)
                    {
                        if (buttonsSecondStage)
                        {
                            StopAllCoroutines();
                            if (pressedButton != buttons[(secondButtonPresses[buttonColor, memoryBankColumn]) + 12])
                            {
                                DebugMsg("Strike! Pressed button " + pressedButton.name + ", while the correct button for that stage was " + buttons[(firstButtonPresses[buttonColor, memoryBankColumn]) + 12].name + ".");
                                GetComponent <KMBombModule>().HandleStrike();
                                buttonsSecondStage = false;
                                coloredButtons();
                            }
                            else
                            {
                                DebugMsg("Module solved!");
                                moduleSolved = true;
                                GetComponent <KMBombModule>().HandlePass();
                            }
                        }
                        else
                        {
                            if (pressedButton != buttons[(firstButtonPresses[buttonColor, memoryBankColumn]) + 12])
                            {
                                StopAllCoroutines();
                                DebugMsg("Strike! Pressed button " + pressedButton.name + ", while the correct button for that stage was " + buttons[(secondButtonPresses[buttonColor, memoryBankColumn]) + 12].name + ".");
                                GetComponent <KMBombModule>().HandleStrike();
                                buttonsSecondStage = false;
                                coloredButtons();
                            }
                            else
                            {
                                buttonsSecondStage = true;
                                DebugMsg("Correct button. Advancing to next stage.");
                            }
                        }
                    }
                    else if (whichModule == 2)
                    {
                        for (int i = 0; i < 6; i++)
                        {
                            if (pressedButton == buttons[i + 19])
                            {
                                if (i != correctTextButton)
                                {
                                    DebugMsg("Strike! Pressed button " + (i + 1) + ", while the correct button was " + (correctTextButton + 1) + ".");
                                    GetComponent <KMBombModule>().HandleStrike();
                                    puncuationButtons();
                                }
                                else
                                {
                                    DebugMsg("Module solved!");
                                    moduleSolved = true;
                                    GetComponent <KMBombModule>().HandlePass();
                                }
                                i = 6;
                            }
                        }
                    }
                    else if (whichModule == 3)
                    {
                        for (int i = 0; i < 6; i++)
                        {
                            if (pressedButton == buttons[i + 25])
                            {
                                if (i == pianoCorrectButton)
                                {
                                    DebugMsg("Module solved!");
                                    moduleSolved = true;
                                    GetComponent <KMBombModule>().HandlePass();
                                }
                                else
                                {
                                    DebugMsg("Strike! Pressed key " + pianoKeyNames[i] + ".");
                                    GetComponent <KMBombModule>().HandleStrike();
                                    puncuationButtons();
                                }
                            }
                        }
                    }
                    else if (whichModule == 4)
                    {
                        if (pressedButton == buttons[37])
                        {
                            StopAllCoroutines();
                            StartCoroutine(DisplayUpdater());
                            messageDisplayButtonPressed = true;
                            messageDisplayButton.SetActive(false);
                        }
                        else
                        {
                            for (int i = 0; i < 6; i++)
                            {
                                if (pressedButton == buttons[31 + i])
                                {
                                    if (messageLetters[i].text == ("" + messageSelectedString[messageSelectedWordsChart[memoryBankColumn, messageButtonPresses]]))
                                    {
                                        DebugMsg("Correct button pressed.");
                                        messageButtonPresses++;
                                        if (messageButtonPresses == 6)
                                        {
                                            DebugMsg("Module solved!");
                                            moduleSolved = true;
                                            GetComponent <KMBombModule>().HandlePass();
                                        }
                                    }
                                    else
                                    {
                                        DebugMsg("Strike! Pressed letter " + messageLetters[i].text + ", while the correct letter was " + messageSelectedString[messageSelectedWordsChart[memoryBankColumn, messageButtonPresses]]);
                                        GetComponent <KMBombModule>().HandleStrike();
                                        messageDisplayButton.SetActive(true);
                                        messageDisplayButtonPressed = false;
                                        colorfulMessage();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 25
0
 // TPK Methods
 protected void DoInteractionStart(KMSelectable interactable)
 {
     interactable.OnInteract();
 }
Exemplo n.º 26
0
    private IEnumerator ProcessTwitchCommand(string command)
    {
        command = command.ToLowerInvariant().Trim();
        var split = command.Split(new[] { ' ', ',', ';' }, StringSplitOptions.RemoveEmptyEntries);

        if (split.Length == 3 && split[0].StartsWith("press") && split[1].StartsWith("useless") && split[2].StartsWith("button"))
        {
            yield return(new WaitForSeconds(0.1f));

            NotSend.OnInteract();
            if (!mgled)
            {
                mgled = true;
                StartCoroutine(MLG());
            }
            else if (mgled && !mgling)
            {
                mgling     = true;
                Slovo.text = "nope";
                yield return(new WaitForSeconds(.5f));

                Slovo.text = word;
                mgling     = false;
            }
        }
        if (split.Length >= 2 && split[0].StartsWith("submit"))
        {
            var code = split.Skip(1).Join("");
            if (code.Any(letter => !letter.EqualsAny('0', '1')))
            {
                yield break;
            }
            // Let TP know we're about to send an input
            // This needs to be done before every input
            yield return(null);

            // Make sure the screen is empty before accepting a command
            yield return(Reset.OnInteract());

            foreach (var letter in code)
            {
                yield return(new WaitForSeconds(0.03f));

                yield return(null);

                KMSelectable button = null;
                switch (letter)
                {
                case '0':
                    button = B0;
                    break;

                case '1':
                    button = B1;
                    break;
                }
                yield return(button.OnInteract());
            }

            yield return(null);

            yield return(Send.OnInteract());
        }
    }
    public override IEnumerator Respond(string[] split, string command)
    {
        if (command.Equals("toggle"))
        {
            yield return(null);

            yield return(Click(0, 0));
        }
        else if (command.EqualsAny("check", "submit"))
        {
            yield return(null);

            yield return(Click(1, 0));
        }
        else if (command.StartsWith("select "))
        {
            if (split.Length != 4)
            {
                yield break;
            }
            bool[]   passed = { false, false, false };
            string[] vars   = { "a", "b", "c", "d", "e", "f", "g", "-" };
            for (int i = 1; i < 4; i++)
            {
                for (int j = 0; j < vars.Length; j++)
                {
                    if (split[i].EqualsAny("min(" + vars[j] + ")", "max(" + vars[j] + ")", "avg(" + vars[j] + ")", "sum(" + vars[j] + ")", "count(" + vars[j] + ")", vars[j]))
                    {
                        passed[i - 1] = true;
                        break;
                    }
                }
            }
            if (passed.Contains(false))
            {
                yield break;
            }

            yield return(null);

            KMSelectable[] changers  = { _component.GetValue <KMSelectable>("selection1GroupButton"), _component.GetValue <KMSelectable>("selection2GroupButton"), _component.GetValue <KMSelectable>("selection3GroupButton") };
            KMSelectable[] changers2 = { _component.GetValue <KMSelectable>("selection1Button"), _component.GetValue <KMSelectable>("selection2Button"), _component.GetValue <KMSelectable>("selection3Button") };
            for (int i = 0; i < 3; i++)
            {
                string cur = split[i + 1];
                if (cur.Length != 1)
                {
                    int offset = cur.StartsWith("count") ? 5 : 3;
                    while (changers[i].GetComponentInChildren <TextMesh>().text.ToLower() != cur.Substring(0, offset))
                    {
                        yield return(DoInteractionClick(changers[i]));
                    }
                    cur = cur[cur.IndexOf('(') + 1].ToString();
                }
                else
                {
                    while (changers[i].GetComponentInChildren <TextMesh>().text.ToLower() != "none")
                    {
                        yield return(DoInteractionClick(changers[i]));
                    }
                }
                while (changers2[i].GetComponentInChildren <TextMesh>().text.ToLower() != cur)
                {
                    yield return(DoInteractionClick(changers2[i]));
                }
            }
        }
        else if (command.StartsWith("where "))
        {
            if (split.Length != 4)
            {
                yield break;
            }
            if (!split[1].EqualsAny("a", "b", "c", "d", "e", "f", "g"))
            {
                yield break;
            }
            if (!split[2].EqualsAny("=", "<>", "<", "<=", ">", ">="))
            {
                yield break;
            }
            if (!split[3].EqualsAny("1", "2", "3", "4", "5", "6", "7", "8", "9", "0"))
            {
                yield break;
            }

            yield return(null);

            KMSelectable[] changers = { _component.GetValue <KMSelectable>("where1LeftOperandButton"), _component.GetValue <KMSelectable>("where1OperatorButton"), _component.GetValue <KMSelectable>("where1RightOperandButton") };
            for (int i = 0; i < 3; i++)
            {
                while (changers[i].GetComponentInChildren <TextMesh>().text.ToLower() != split[i + 1])
                {
                    yield return(DoInteractionClick(changers[i]));
                }
            }
        }
        else if (command.StartsWith("group by "))
        {
            if (split.Length != 3)
            {
                yield break;
            }
            if (!split[2].EqualsAny("a", "b", "c", "d", "e", "f", "g", "-"))
            {
                yield break;
            }

            yield return(null);

            KMSelectable changer = _component.GetValue <KMSelectable>("groupBy1Button");
            while (changer.GetComponentInChildren <TextMesh>().text.ToLower() != split[2])
            {
                yield return(DoInteractionClick(changer));
            }
        }
        else if (command.StartsWith("limit "))
        {
            if (split.Length != 3)
            {
                yield break;
            }
            if (!split[1].EqualsAny("1", "2", "3", "4", "5", "6", "7", "8", "9", "999"))
            {
                yield break;
            }
            if (!split[2].EqualsAny("1", "2", "3", "4", "5", "6", "7", "8", "9", "0"))
            {
                yield break;
            }

            yield return(null);

            KMSelectable[] changers = { _component.GetValue <KMSelectable>("limitTakeButton"), _component.GetValue <KMSelectable>("limitSkipButton") };
            for (int i = 0; i < 2; i++)
            {
                while (changers[i].GetComponentInChildren <TextMesh>().text.ToLower() != split[i + 1].Replace("999", "all").Replace("0", "none"))
                {
                    yield return(DoInteractionClick(changers[i]));
                }
            }
        }
    }
Exemplo n.º 28
0
    protected override void submitWord(KMSelectable submitButton)
    {
        if (moduleSolved)
        {
            return;
        }

        submitButton.AddInteractionPunch(1f);

        if (screenTexts[2].text.Equals("PINKUC"))
        {
            setPinkCipherMode();
        }

        else if (screenTexts[2].text.Equals("CYANUC"))
        {
            setCyanCipherMode();
        }

        else if (screenTexts[2].text.Equals("TRUEUC"))
        {
            setTrueUCMode();
        }

        else if (screenTexts[2].text.Equals("CANCEL"))
        {
            setNormalMode();
        }

#if UNITY_EDITOR
        else if (screenTexts[2].text.Length == 1)
        {
            setDebugMode();
        }
#endif

        else if (screenTexts[2].text.Equals("MUSICA"))
        {
            page = 0;
            getScreens();
            if (!playingLongAudio)
            {
                Audio.PlaySoundAtTransform("A Choice", transform);
                StartCoroutine(songTime(818f));
            }
        }
        else if (screenTexts[2].text.Equals("IKTPQN"))
        {
            submitText.text = "<3";
            for (var i = 0; i < 3; i++)
            {
                screenTexts[i].font       = standardFont;
                screentextmat[i].material = standardFontMat;
                screenTexts[i].color      = Color.white;
                screens[i].sharedMaterial = blackScreensAndButtons;
                screenTexts[i].gameObject.SetActive(true);
            }
            screenTexts[0].fontSize = 35;
            screenTexts[1].fontSize = 40;
            screenTexts[2].fontSize = 25;
            screenTexts[0].text     = "A-II-I-VI";
            screenTexts[1].text     = "PTG";
            screenTexts[2].text     = "SE-AN";
        }
        else if (screenTexts[2].text.Equals("PRISSY"))
        {
            submitText.text = "<3";
            for (var i = 0; i < 3; i++)
            {
                screenTexts[i].font       = standardFont;
                screentextmat[i].material = standardFontMat;
                screenTexts[i].color      = Color.white;
                screens[i].sharedMaterial = blackScreensAndButtons;
                screenTexts[i].gameObject.SetActive(true);
            }
            screenTexts[0].fontSize = 40;
            screenTexts[1].fontSize = 40;
            screenTexts[2].fontSize = 40;
            screenTexts[0].text     = "THANK";
            screenTexts[1].text     = "YOU FOR";
            screenTexts[2].text     = "PLAYING";
            if (!playingLongAudio)
            {
                Audio.PlaySoundAtTransform("A Life's Story", transform);
                StartCoroutine(songTime(307f));
            }
        }
        else if (screenTexts[2].text.Equals(answer))
        {
            switch (mode)
            {
            case Mode.PinkUC:
                background.sharedMaterial = pinkCipherBackground;
                screenTexts[0].text       = "TRU";
                screenTexts[1].text       = "";
                screenTexts[2].text       = "";
                break;

            case Mode.CyanUC:
                background.sharedMaterial = cyanCipherBackground;
                screenTexts[0].text       = "EUC";
                screenTexts[1].text       = "";
                screenTexts[2].text       = "";
                break;

            case Mode.TrueUC:
                background.sharedMaterial = ultimateCipherBackground;
                screenTexts[0].text       = "IKTPQN";
                screenTexts[1].text       = "";
                screenTexts[2].text       = "";
                break;

            default:
                background.sharedMaterial = ultimateCipherBackground;
                screenTexts[0].text       = "PINKUC";
                screenTexts[1].text       = "CYANUC";
                screenTexts[2].text       = "";
                break;
            }
            for (var i = 0; i < 3; i++)
            {
                screenTexts[i].fontSize   = 40;
                screenTexts[i].font       = standardFont;
                screentextmat[i].material = standardFontMat;
                screenTexts[i].color      = Color.white;
                screens[i].sharedMaterial = blackScreensAndButtons;
                screenTexts[i].gameObject.SetActive(true);
            }
            Audio.PlaySoundAtTransform("UCSolveSFX", transform);
            module.HandlePass();
            moduleSolved = true;
        }
        else
        {
            Audio.PlaySoundAtTransform("StrikeSFX", transform);
            module.HandleStrike();
            page = 0;
            getScreens();
        }
        submitScreen = false;
    }
 public static void Press(KMSelectable selectable) => selectable.OnInteract?.Invoke();
    void Init()
    {
        ButtonTL.OnInteract += delegate() { ButtonTL.AddInteractionPunch(); return(false); };
        ButtonTR.OnInteract += delegate() { ButtonTR.AddInteractionPunch(); return(false); };
        ButtonBL.OnInteract += delegate() { ButtonBL.AddInteractionPunch(); return(false); };
        ButtonBR.OnInteract += delegate() { ButtonBR.AddInteractionPunch(); return(false); };

        List <KMSelectable> buttons = new List <KMSelectable>()
        {
            ButtonTL, ButtonTR, ButtonBL, ButtonBR
        };
        int i      = 0;
        int TLtype = -1;

        while (buttons.Count > 0)
        {
            int pos = Random.Range(0, buttons.Count);
            if (pos == 0 && TLtype == -1)
            {
                Debug.Log("[Simon States #" + thisLoggingID + "] Dominant: " + COL_LIST[i]);
                TLtype = i;
            }
            KMSelectable b = buttons[pos];
            if (i == 0)
            {
                ButtonRed = b;
                b.GetComponent <MeshRenderer>().material.color = DARKRED;
                b.OnInteract += HandleRed;
            }
            else if (i == 1)
            {
                ButtonYellow = b;
                b.GetComponent <MeshRenderer>().material.color = DARKYELLOW;
                b.OnInteract += HandleYellow;
            }
            else if (i == 2)
            {
                ButtonGreen = b;
                b.GetComponent <MeshRenderer>().material.color = DARKGREEN;
                b.OnInteract += HandleGreen;
            }
            else
            {
                ButtonBlue = b;
                b.GetComponent <MeshRenderer>().material.color = DARKBLUE;
                b.OnInteract += HandleBlue;
            }
            i++;
            buttons.RemoveAt(pos);
        }

        int len = 4;

        PuzzleDisplay = new bool[len][];
        for (int a = 0; a < len; a++)
        {
            PuzzleDisplay[a] = new bool[4];
            int num = Random.Range(1, 5);
            if (num > 2)
            {
                num = Random.Range(2, 5);
            }
            List <int> posList = new List <int>()
            {
                0, 1, 2, 3
            };
            while (num > 0)
            {
                num--;
                int pos = Random.Range(0, posList.Count);
                PuzzleDisplay[a][posList[pos]] = true;
                posList.RemoveAt(pos);
            }
            string col = "";
            if (PuzzleDisplay[a][0])
            {
                col += COL_LIST[0];
            }
            else
            {
                col += "-";
            }
            if (PuzzleDisplay[a][1])
            {
                col += COL_LIST[1];
            }
            else
            {
                col += "-";
            }
            if (PuzzleDisplay[a][2])
            {
                col += COL_LIST[2];
            }
            else
            {
                col += "-";
            }
            if (PuzzleDisplay[a][3])
            {
                col += COL_LIST[3];
            }
            else
            {
                col += "-";
            }
            Debug.Log("[Simon States #" + thisLoggingID + "] Stage " + (a + 1) + " colours: " + col);
        }

        Answer = new int[len];

        bool R = false, Y = false, B = false, G = false;

        for (int a = 0; a < len; a++)
        {
            int numFlashed = 0;
            for (int z = 0; z < 4; z++)
            {
                if (PuzzleDisplay[a][z])
                {
                    numFlashed++;
                }
            }
            int numUniquePressed = 0;
            if (R)
            {
                numUniquePressed++;
            }
            if (Y)
            {
                numUniquePressed++;
            }
            if (G)
            {
                numUniquePressed++;
            }
            if (B)
            {
                numUniquePressed++;
            }
            if (a == 0)
            {
                if (numFlashed == 1)
                {
                    if (PuzzleDisplay[0][0])
                    {
                        Answer[0] = 0;
                    }
                    else if (PuzzleDisplay[0][1])
                    {
                        Answer[0] = 1;
                    }
                    else if (PuzzleDisplay[0][2])
                    {
                        Answer[0] = 2;
                    }
                    else
                    {
                        Answer[0] = 3;
                    }
                    Debug.Log("[Simon States #" + thisLoggingID + "] Stage 1: One flashed, press it (" + Answer[0] + ":" + COL_LIST[Answer[0]] + ")");
                }
                else if (numFlashed == 2)
                {
                    if (PuzzleDisplay[0][3])
                    {
                        for (int z = 0; z < 4; z++)
                        {
                            if (PuzzleDisplay[0][PRIORITY[TLtype][z]])
                            {
                                Answer[0] = PRIORITY[TLtype][z];
                                break;
                            }
                        }
                        Debug.Log("[Simon States #" + thisLoggingID + "] Stage 1: Two flashed with blue, press highest (" + Answer[0] + ":" + COL_LIST[Answer[0]] + ")");
                    }
                    else
                    {
                        Answer[0] = 3;
                        Debug.Log("[Simon States #" + thisLoggingID + "] Stage 1: Two flashed without blue, press blue (3:B)");
                    }
                }
                else if (numFlashed == 3)
                {
                    if (PuzzleDisplay[0][0])
                    {
                        for (int z = 3; z >= 0; z--)
                        {
                            if (PuzzleDisplay[0][PRIORITY[TLtype][z]])
                            {
                                Answer[0] = PRIORITY[TLtype][z];
                                break;
                            }
                        }
                        Debug.Log("[Simon States #" + thisLoggingID + "] Stage 1: Three flashed including red, press lowest (" + Answer[0] + ":" + COL_LIST[Answer[0]] + ")");
                    }
                    else
                    {
                        Answer[0] = 0;
                        Debug.Log("[Simon States #" + thisLoggingID + "] Stage 1: Three flashed excluding red, press red (0:R)");
                    }
                }
                else
                {
                    Answer[0] = PRIORITY[TLtype][1];
                    Debug.Log("[Simon States #" + thisLoggingID + "] Stage 1: Four flashed, press second highest (" + Answer[0] + ":" + COL_LIST[Answer[0]] + ")");
                }
            }
            else if (a == 1)
            {
                if (numFlashed == 2)
                {
                    if (PuzzleDisplay[1][0] && PuzzleDisplay[1][3])
                    {
                        for (int z = 0; z < 4; z++)
                        {
                            if (!PuzzleDisplay[1][PRIORITY[TLtype][z]])
                            {
                                Answer[1] = PRIORITY[TLtype][z];
                                break;
                            }
                        }
                        Debug.Log("[Simon States #" + thisLoggingID + "] Stage 2: Red and blue flashed, press highest out of yellow and green (" + Answer[1] + ":" + COL_LIST[Answer[1]] + ")");
                    }
                    else
                    {
                        for (int z = 3; z >= 0; z--)
                        {
                            if (!PuzzleDisplay[1][PRIORITY[TLtype][z]])
                            {
                                Answer[1] = PRIORITY[TLtype][z];
                                break;
                            }
                        }
                        Debug.Log("[Simon States #" + thisLoggingID + "] Stage 2: Two flashed including yellow or green, press lowest that didn't flash (" + Answer[1] + ":" + COL_LIST[Answer[1]] + ")");
                    }
                }
                else if (numFlashed == 1)
                {
                    if (!PuzzleDisplay[1][3])
                    {
                        Answer[1] = 3;
                        Debug.Log("[Simon States #" + thisLoggingID + "] Stage 2: One flashed but not blue, press blue (3:B)");
                    }
                    else
                    {
                        Answer[1] = 1;
                        Debug.Log("[Simon States #" + thisLoggingID + "] Stage 2: Blue flashed, press yellow (1:Y)");
                    }
                }
                else if (numFlashed == 4)
                {
                    Answer[1] = Answer[0];
                    Debug.Log("[Simon States #" + thisLoggingID + "] Stage 2: Four flashed, press stage 1 (" + Answer[1] + ":" + COL_LIST[Answer[1]] + ")");
                }
                else
                {
                    if (!PuzzleDisplay[1][0])
                    {
                        Answer[1] = 0;
                    }
                    else if (!PuzzleDisplay[1][1])
                    {
                        Answer[1] = 1;
                    }
                    else if (!PuzzleDisplay[1][2])
                    {
                        Answer[1] = 2;
                    }
                    else
                    {
                        Answer[1] = 3;
                    }
                    Debug.Log("[Simon States #" + thisLoggingID + "] Stage 2: Three flashed, press whatever didn't flash (" + Answer[1] + ":" + COL_LIST[Answer[1]] + ")");
                }
            }
            else if (a == 2)
            {
                if (numFlashed == 3)
                {
                    if ((PuzzleDisplay[2][0] && R) || (PuzzleDisplay[2][1] && Y) ||
                        (PuzzleDisplay[2][2] && G) || (PuzzleDisplay[2][3] && B))
                    {
                        for (int z = 0; z < 4; z++)
                        {
                            int trueVal = PRIORITY[TLtype][z];
                            if (PuzzleDisplay[2][trueVal])
                            {
                                if (trueVal == 0 && !R)
                                {
                                    Answer[2] = 0;
                                    break;
                                }
                                else if (trueVal == 1 && !Y)
                                {
                                    Answer[2] = 1;
                                    break;
                                }
                                else if (trueVal == 2 && !G)
                                {
                                    Answer[2] = 2;
                                    break;
                                }
                                else if (trueVal == 3 && !B)
                                {
                                    Answer[2] = 3;
                                    break;
                                }
                            }
                        }
                        Debug.Log("[Simon States #" + thisLoggingID + "] Stage 3: Three flashed and one was pressed, press highest unpressed that flashed (" + Answer[2] + ":" + COL_LIST[Answer[2]] + ")");
                    }
                    else
                    {
                        for (int z = 0; z < 4; z++)
                        {
                            if (PuzzleDisplay[2][PRIORITY[TLtype][z]])
                            {
                                Answer[2] = PRIORITY[TLtype][z];
                                break;
                            }
                        }
                        Debug.Log("[Simon States #" + thisLoggingID + "] Stage 3: Three flashed and weren't pressed, press highest that flashes (" + Answer[2] + ":" + COL_LIST[Answer[2]] + ")");
                    }
                }
                else if (numFlashed == 2)
                {
                    if ((PuzzleDisplay[2][0] && !R) || (PuzzleDisplay[2][1] && !Y) ||
                        (PuzzleDisplay[2][2] && !G) || (PuzzleDisplay[2][3] && !B))
                    {
                        Answer[2] = Answer[0];
                        Debug.Log("[Simon States #" + thisLoggingID + "] Stage 3: Two flashed and at least one unpressed, press stage 1 (" + Answer[2] + ":" + COL_LIST[Answer[2]] + ")");
                    }
                    else
                    {
                        for (int z = 3; z >= 0; z--)
                        {
                            if (!PuzzleDisplay[2][PRIORITY[TLtype][z]])
                            {
                                Answer[2] = PRIORITY[TLtype][z];
                                break;
                            }
                        }
                        Debug.Log("[Simon States #" + thisLoggingID + "] Stage 3: Two flashed and both pressed, press lowest no-flash (" + Answer[2] + ":" + COL_LIST[Answer[2]] + ")");
                    }
                }
                else if (numFlashed == 1)
                {
                    if (PuzzleDisplay[2][0])
                    {
                        Answer[2] = 0;
                    }
                    else if (PuzzleDisplay[2][1])
                    {
                        Answer[2] = 1;
                    }
                    else if (PuzzleDisplay[2][2])
                    {
                        Answer[2] = 2;
                    }
                    else
                    {
                        Answer[2] = 3;
                    }
                    Debug.Log("[Simon States #" + thisLoggingID + "] Stage 3: One flashed, press it (" + Answer[2] + ":" + COL_LIST[Answer[2]] + ")");
                }
                else
                {
                    Answer[2] = PRIORITY[TLtype][2];
                    Debug.Log("[Simon States #" + thisLoggingID + "] Stage 3: Four flashed, press second lowest (" + Answer[2] + ":" + COL_LIST[Answer[2]] + ")");
                }
            }
            else if (a == 3)
            {
                if (numUniquePressed == 3)
                {
                    if (!R)
                    {
                        Answer[3] = 0;
                    }
                    else if (!Y)
                    {
                        Answer[3] = 1;
                    }
                    else if (!G)
                    {
                        Answer[3] = 2;
                    }
                    else
                    {
                        Answer[3] = 3;
                    }
                    Debug.Log("[Simon States #" + thisLoggingID + "] Stage 4: Three unique pressed, press other (" + Answer[3] + ":" + COL_LIST[Answer[3]] + ")");
                }
                else if (numFlashed == 3)
                {
                    int unpressed = 4;
                    if (!R && PuzzleDisplay[3][0])
                    {
                        unpressed = 0;
                    }
                    if (!Y && PuzzleDisplay[3][1])
                    {
                        if (unpressed == 4)
                        {
                            unpressed = 1;
                        }
                        else
                        {
                            unpressed = -1;
                        }
                    }
                    if (unpressed != -1 && !G && PuzzleDisplay[3][2])
                    {
                        if (unpressed == 4)
                        {
                            unpressed = 2;
                        }
                        else
                        {
                            unpressed = -1;
                        }
                    }
                    if (unpressed != -1 && !B && PuzzleDisplay[3][3])
                    {
                        if (unpressed == 4)
                        {
                            unpressed = 3;
                        }
                        else
                        {
                            unpressed = -1;
                        }
                    }
                    if (unpressed >= 0 && unpressed < 4)
                    {
                        Answer[3] = unpressed;
                        Debug.Log("[Simon States #" + thisLoggingID + "] Stage 4: Three flashed and exactly one unpressed, press it (" + Answer[3] + ":" + COL_LIST[Answer[3]] + ")");
                    }
                    else
                    {
                        Answer[3] = PRIORITY[TLtype][3];
                        Debug.Log("[Simon States #" + thisLoggingID + "] Stage 4: Three flashed and not exactly one unpressed, press lowest (" + Answer[3] + ":" + COL_LIST[Answer[3]] + ")");
                    }
                }
                else if (numFlashed == 4)
                {
                    Answer[3] = PRIORITY[TLtype][3];
                    Debug.Log("[Simon States #" + thisLoggingID + "] Stage 4: Four flashed, press lowest (" + Answer[3] + ":" + COL_LIST[Answer[3]] + ")");
                }
                else if (numFlashed == 1)
                {
                    if (PuzzleDisplay[3][0])
                    {
                        Answer[3] = 0;
                    }
                    else if (PuzzleDisplay[3][1])
                    {
                        Answer[3] = 1;
                    }
                    else if (PuzzleDisplay[3][2])
                    {
                        Answer[3] = 2;
                    }
                    else
                    {
                        Answer[3] = 3;
                    }
                    Debug.Log("[Simon States #" + thisLoggingID + "] Stage 4: One flashed, press it (" + Answer[3] + ":" + COL_LIST[Answer[3]] + ")");
                }
                else
                {
                    Answer[3] = 2;
                    Debug.Log("[Simon States #" + thisLoggingID + "] Stage 4: Two flashed, press green (2:G)");
                }
            }
            if (Answer[a] == 0)
            {
                R = true;
            }
            if (Answer[a] == 1)
            {
                Y = true;
            }
            if (Answer[a] == 2)
            {
                G = true;
            }
            if (Answer[a] == 3)
            {
                B = true;
            }
        }
    }