Ejemplo n.º 1
0
    bool DeletePress()
    {
        bombAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, backButton.transform);
        backButton.GetComponentInParent <Animator>().Play("StandardSingle", 0, 0);

        if (!moduleActive || moduleSolved)
        {
            return(false);
        }

        // Not inputting: Force symbols to stop
        if (!inInputMode)
        {
            staticDisplayTimer = Mathf.Infinity;
            return(false);
        }

        // In input mode
        if (wordInput.Length <= 1)
        {
            wordInput = "";
        }
        else
        {
            wordInput = wordInput.Remove(wordInput.Length - 1);
        }
        UpdateWordDisplay();
        return(false);
    }
Ejemplo n.º 2
0
    bool InputPress()
    {
        bombAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, inputButton.transform);
        inputButton.GetComponentInParent <Animator>().Play("StandardSingle", 0, 0);

        if (!moduleActive || moduleSolved)
        {
            return(false);
        }

        // Not inputting: Force symbols to move again
        if (!inInputMode)
        {
            staticDisplayTimer = -1f;
            return(false);
        }

        // In input mode
        if (wordInput.Length >= 15)
        {
            return(false);
        }

        if (wordClearCoroutine != null)
        {
            StopCoroutine(wordClearCoroutine);
            wordClearCoroutine = null;
        }

        wordInput += "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[inputOnChar];
        UpdateWordDisplay();
        return(false);
    }
Ejemplo n.º 3
0
    bool ModeSwitchPress()
    {
        bombAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonPress, centerButton.transform);

        if ((buttonStuckDown = !buttonStuckDown) == true)
        {
            centerButton.GetComponentInParent <Animator>().Play("StickyDownFrom0", 0, 0);
            centerButton.AddInteractionPunch(0.1f);
            EnterInputMode();
        }
        else
        {
            centerButton.GetComponentInParent <Animator>().Play("StickyDownFrom1", 0, 0);
        }
        return(false);
    }
    private void InitButtons()
    {
        Btn1.OnInteract += delegate
        {
            Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, Btn1.transform);
            Btn1.AddInteractionPunch(.1f);
            Btn1.GetComponentInParent <Animator>().Play("ButtonPress");
            if (this.isSolved)
            {
                return(false);
            }

            if (!this.HasSolution)
            {
                this.HandleButtonPressWithNoSolution(this.buttons[0]);
            }
            else
            {
                this.CheckSolution(this.buttons[0]);
            }

            return(false);
        };

        Btn2.OnInteract += delegate
        {
            Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, Btn1.transform);
            Btn2.AddInteractionPunch(.1f);
            Btn2.GetComponentInParent <Animator>().Play("ButtonPress");
            if (this.isSolved)
            {
                return(false);
            }
            if (!this.HasSolution)
            {
                this.HandleButtonPressWithNoSolution(this.buttons[1]);
            }
            else
            {
                this.CheckSolution(this.buttons[1]);
            }


            return(false);
        };

        Btn3.OnInteract += delegate
        {
            Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, Btn1.transform);
            Btn3.AddInteractionPunch(.1f);
            Btn3.GetComponentInParent <Animator>().Play("ButtonPress");
            if (this.isSolved)
            {
                return(false);
            }
            if (!this.HasSolution)
            {
                this.HandleButtonPressWithNoSolution(this.buttons[2]);
            }
            else
            {
                this.CheckSolution(this.buttons[2]);
            }

            return(false);
        };

        Btn1.OnInteractEnded += delegate
        {
            Btn1.GetComponentInParent <Animator>().Play("ButtonRelease");
            Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonPress, Btn1.transform);
        };
        Btn2.OnInteractEnded += delegate
        {
            Btn2.GetComponentInParent <Animator>().Play("ButtonRelease");
            Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonPress, Btn2.transform);
        };
        Btn3.OnInteractEnded += delegate
        {
            Btn3.GetComponentInParent <Animator>().Play("ButtonRelease");
            Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonPress, Btn3.transform);
        };

        ScreenBtn.OnInteract += delegate
        {
            if (this.isSolved)
            {
                Btn1.AddInteractionPunch();
                Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, Btn1.transform);
                return(false);
            }
            ScreenBtn.AddInteractionPunch(.5f);
            Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, ScreenBtn.transform);
            if (this.HasSolution)
            {
                Debug.LogFormat("[Logical Buttons #{0}] Pressed the operator screen while had solution. Strike!", this._moduleId);
                Module.HandleStrike();
                this.InitLogic();
            }
            else
            {
                this.gateOperator = ChangeLogicalGateOperator(this.gateOperator);
                this.helper       = new LogicalButtonsHelper(this.buttons, this.gateOperator);
                this.solution     = this.helper.SolveOrder(this.stage);
                OperatorTxt.text  = this.gateOperator.Name;
                Debug.LogFormat("[Logical Buttons #{0}] Pressing operator button, new answer is:", _moduleId);
                this.DebugMessage();
            }

            return(false);
        };
    }
Ejemplo n.º 5
0
    void PanelPress(KMSelectable panel)
    {
        if (moduleSolved || shrinking)
        {
            return;
        }
        submitButton.AddInteractionPunch();
        timeOfPress    = Bomb.GetTime();
        timeOfPressInt = (Mathf.FloorToInt(timeOfPress)) % 10;
        if (timeOfPressInt != pressTimes[stage - 1])
        {
            Debug.LogFormat("[Catchphrase #{0}] Strike! You pressed the {1} panel when the last digit of the bomb timer was {2}. That is not correct.", moduleId, panel.GetComponent <panels>().logPosition, timeOfPressInt);
            GetComponent <KMBombModule>().HandleStrike();
            return;
        }

        if (stage == 1)
        {
            for (int i = 0; i < correctPanels1.Count(); i++)
            {
                if (panel == correctPanels1[i])
                {
                    stage1Correct = true;
                    break;
                }
            }
            if (stage1Correct)
            {
                Audio.PlaySoundAtTransform("reveal", transform);
                Debug.LogFormat("[Catchphrase #{0}] You pressed the {1} panel. That is correct.", moduleId, panel.GetComponent <panels>().logPosition);
                shrinking = true;
                panel.GetComponentInParent <Animator>().SetBool("shrink", true);
                stage++;
                stage1Colour   = panel.GetComponent <panels>().colour;
                stage1Position = panel.GetComponent <panels>().position;
                panel.GetComponent <panels>().colour   = "";
                panel.GetComponent <panels>().position = "";
                GetPanel2();
                StartCoroutine(StopShrink());
            }
            else
            {
                Debug.LogFormat("[Catchphrase #{0}] Strike! You pressed the {1} panel. That is not correct.", moduleId, panel.GetComponent <panels>().logPosition);
                GetComponent <KMBombModule>().HandleStrike();
            }
        }
        else if (stage == 2)
        {
            for (int i = 0; i < correctPanels2.Count(); i++)
            {
                if (panel == correctPanels2[i])
                {
                    stage2Correct = true;
                    break;
                }
            }
            if (stage2Correct)
            {
                Audio.PlaySoundAtTransform("reveal", transform);
                Debug.LogFormat("[Catchphrase #{0}] You pressed the {1} panel. That is correct.", moduleId, panel.GetComponent <panels>().logPosition);
                shrinking = true;
                panel.GetComponentInParent <Animator>().SetBool("shrink", true);
                stage++;
                panel.GetComponent <panels>().colour   = "";
                panel.GetComponent <panels>().position = "";
                GetPanel3();
                StartCoroutine(StopShrink());
            }
            else
            {
                Debug.LogFormat("[Catchphrase #{0}] Strike! You pressed the {1} panel. That is not correct.", moduleId, panel.GetComponent <panels>().logPosition);
                GetComponent <KMBombModule>().HandleStrike();
            }
        }

        else if (stage == 3)
        {
            for (int i = 0; i < correctPanels3.Count(); i++)
            {
                if (panel == correctPanels3[i])
                {
                    stage3Correct = true;
                    break;
                }
            }
            if (stage3Correct)
            {
                Audio.PlaySoundAtTransform("reveal", transform);
                Debug.LogFormat("[Catchphrase #{0}] You pressed the {1} panel. That is correct.", moduleId, panel.GetComponent <panels>().logPosition);
                shrinking = true;
                panel.GetComponentInParent <Animator>().SetBool("shrink", true);
                stage++;
                panel.GetComponent <panels>().colour   = "";
                panel.GetComponent <panels>().position = "";
                StartCoroutine(StopShrink());
                Debug.LogFormat("[Catchphrase #{0}] Press the final panel when the last digit of the bomb timer is {1}.", moduleId, pressTimes[3]);
            }
            else
            {
                Debug.LogFormat("[Catchphrase #{0}] Strike! You pressed the {1} panel. That is not correct.", moduleId, panel.GetComponent <panels>().logPosition);
                GetComponent <KMBombModule>().HandleStrike();
            }
        }

        else if (stage == 4)
        {
            Audio.PlaySoundAtTransform("reveal", transform);
            Debug.LogFormat("[Catchphrase #{0}] You pressed the {1} panel. That is correct.", moduleId, panel.GetComponent <panels>().logPosition);
            shrinking = true;
            panel.GetComponentInParent <Animator>().SetBool("shrink", true);
            stage++;
            panel.GetComponent <panels>().colour   = "";
            panel.GetComponent <panels>().position = "";
            StartCoroutine(StopShrink());
        }

        else
        {
            return;
        }
    }