Exemplo n.º 1
0
    IEnumerator TwitchHandleForcedSolve()
    {
        int start = Stage;

        for (int i = start; i < 4; i++)
        {
            List <int> presses = new List <int>();
            for (int j = 0; j < 4; j++)
            {
                if (scores[j] == order[i] && !Pressed.Contains(j))
                {
                    presses.Add(j);
                }
            }
            keys[presses.PickRandom()].OnInteract();
            yield return(new WaitForSecondsRealtime(0.2f));
        }
    }
Exemplo n.º 2
0
    void PressKey(int Press)
    {
        keys[Press].AddInteractionPunch(0.2f);
        Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonPress, keys[Press].transform);
        if (!solved)
        {
            if (scores[Press] == order[Stage] && new[] { Press }.Any(c => !Pressed.Contains(c)))
            {
                Debug.LogFormat("[Colored Letters #{0}] You pressed Button {1}. That was correct.", moduleId, Press + 1);
                Stage++;
                Pressed.Add(Press);
                if (Stage == 4)
                {
                    int SolveText = rnd.Range(0, messagePool.Length);
                    Debug.LogFormat("[Colored Letters #{0}] Module solved.", moduleId);
                    Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                    Module.HandlePass();
                    StopAllCoroutines();
                    for (int x = 0; x < 4; x++)
                    {
                        texts[x].text  = messagePool[SolveText][x].ToString();
                        texts[x].color = Color.green;
                    }
                    solved = true;
                }
            }

            else
            {
                Debug.LogFormat("[Colored Letters #{0}] You pressed Button {1}. That was incorrect. The module resets", moduleId, Press + 1);
                for (int i = 0; i < 4; i++)
                {
                    scores[i] = 0;
                }
                Module.HandleStrike();
                StopAllCoroutines();
                Activate();
            }
        }
    }