コード例 #1
0
 void MusicEnder()
 {
     if (SoundIThink != null && !Focused)
     {
         SoundIThink.StopSound();
         SoundIThink = null;
     }
 }
コード例 #2
0
    IEnumerator valveR()
    {
        if (timerSound != null)
        {
            //		Debug.LogFormat ("CUT SOUND");
            timerSound.StopSound();
            timerSound = null;
        }
        Audio.PlaySoundAtTransform("steam", valve.transform);

        turn = true;
        float o = 1f;

        for (int i = 0; i < 200; i++)
        {
            valve.gameObject.transform.Rotate(new Vector3(0, 0, o));
            yield return(new WaitForSecondsRealtime(0.0001f));

            o += 0.05f;
        }

        if (_valve)
        //presT==maxPT&&presBL==maxPBL&&presBR==maxPBR &&
        {
            if (presT == maxPT && presBL == maxPBL && presBR == maxPBR)
            {
                Debug.LogFormat("[Manometers #{0}] Module solved.", _moduleId);
                _isSolved = true;

                this.HandlePass();
            }
            else
            {
                Debug.LogFormat("[Manometers #{0}] Manometers aren't to their maximum pressure (TOP={1}, BL={2}, BR={3}), that's necessary for the valve to work correctly. 1 Strike and reset !", _moduleId, presT, presBL, presBR);
                this.HandleStrike();
            }
        }
        else
        {
            Debug.LogFormat("[Manometers #{0}] Valve didn't have to be use. 1 Strike and reset !", _moduleId);
            this.HandleStrike();
        }
        for (int i = 0; i < 200; i++)
        {
            valve.gameObject.transform.Rotate(new Vector3(0, 0, o));
            yield return(new WaitForSecondsRealtime(0.0001f));

            o -= 0.05f;
        }
        turn = false;
    }
コード例 #3
0
 private IEnumerator Strike()
 {
     Module.HandleStrike();
     GivenAnswer = "";
     Sound.StopSound();
     Sound = null;
     StatusLight.GetComponent <MeshRenderer>().material = Mats[1];
     for (int i = 0; i < 60; i++)
     {
         StatusLight.GetComponent <MeshRenderer>().material.color = new Color(Mathf.Lerp(1f, 0, i / 60f), 0, 0, 0.5f);
         yield return(new WaitForSeconds(0.01f));
     }
     StatusLight.GetComponent <MeshRenderer>().material = Mats[0];
 }
コード例 #4
0
    IEnumerator SubmitAnimation()
    {
        StringBuilder stringBuilder   = new StringBuilder(Submission.text);
        float         y               = 0;
        float         changeCharacter = 0;

        KMAudio.KMAudioRef audioRef = Audio.PlaySoundAtTransformWithRef("Submit", transform);
        foreach (float alpha in TimedAnimation(4))
        {
            float curvedAlpha = Mathf.Pow(alpha, 4) / 5;
            changeCharacter += alpha;

            while (changeCharacter >= 0.5f)
            {
                changeCharacter -= 0.5f;
                stringBuilder[Random.Range(0, stringBuilder.Length)] = (char)Random.Range(32, 126);
                CustomDisplayText = stringBuilder.ToString();
            }

            SubmissionMaterial.mainTextureOffset = new Vector2(0, y += curvedAlpha);
            yield return(null);
        }

        audioRef.StopSound();
    }
コード例 #5
0
 void stopBeep()
 {
     if (audioRefBeep != null && audioRefBeep.StopSound != null)
     {
         //LogMessage ("Halting beep sound!");
         audioRefBeep.StopSound();
     }
 }
コード例 #6
0
 //On releasing a button a looped sound will stop
 void OnRelease()
 {
     Debug.Log("OnInteractEnded Released");
     if (audioRef != null && audioRef.StopSound != null)
     {
         audioRef.StopSound();
     }
 }
コード例 #7
0
    private IEnumerator KugelNextStage()
    {
        KMAudio.KMAudioRef pitch = Audio.PlaySoundAtTransformWithRef("HighPitch", Module.transform);
        yield return(new WaitForSeconds(0.5f));

        pitch.StopSound();
        pitch = null;
    }
コード例 #8
0
ファイル: Rhythms.cs プロジェクト: Timwi/KtaneRhythms
 void stopBeep()
 {
     if (_beepAudio != null && _beepAudio.StopSound != null)
     {
         //LogMessage ("Halting beep sound!");
         _beepAudio.StopSound();
     }
 }
コード例 #9
0
    void PressPlanet(KMSelectable button)
    {
        if (moduleSolved)
        {
            return;
        }
        var ix            = Array.IndexOf(planetButtons, button);
        var submittedTime = ((int)bomb.GetTime()) % 10;
        var oridinals     = new string[] { "1st", "2nd", "3rd" };

        Debug.LogFormat("[Exoplanets #{0}] You pressed the {1} planet.", moduleId, oridinals[ix]);
        var planetCorrect = targetPlanet == ix;
        var timeCorrect   = targetDigit == submittedTime;

        if (planetCorrect && timeCorrect)
        {
            module.HandlePass();
            moduleSolved = true;
            if (ambianceRef != null && settings.playAmbiance)
            {
                ambianceRef.StopSound();
                ambianceRef = null;
            }
            Debug.LogFormat("[Exoplanets #{0}] That was correct. Module solved!", moduleId);
            audio.PlaySoundAtTransform("explosion", transform);
            StartCoroutine(SolveAnimation());
        }
        else
        {
            if (!planetCorrect && !timeCorrect)
            {
                Debug.LogFormat("[Exoplanets #{0}] Neither the planet nor the time were correct.", moduleId);
            }
            else if (!planetCorrect && timeCorrect)
            {
                Debug.LogFormat("[Exoplanets #{0}] The planet wasn’t correct, but the time was.", moduleId);
            }
            else
            {
                Debug.LogFormat("[Exoplanets #{0}] The planet was correct, but the time wasn’t.", moduleId);
            }
            module.HandleStrike();
            Debug.LogFormat("[Exoplanets #{0}] Strike!", moduleId);
        }
    }
コード例 #10
0
 void Awake()
 {
     moduleId     = moduleIdCounter++;
     moduleSolved = false;
     for (int i = 0; i < objNames.Length; i++)
     {
         objNames[i]      = objNames[i] + moduleId;
         collObjs[i].name = objNames[i];
     }
     foreach (KMSelectable obj in buttons)
     {
         KMSelectable pressed = obj;
         pressed.OnInteract += delegate() { PressButton(pressed); return(false); };
     }
     if (Application.isEditor)
     {
         focused = true;
     }
     ModuleSelectable.OnFocus   += delegate() { focused = true; };
     ModuleSelectable.OnDefocus += delegate() { if (tpcycle == null)
                                                {
                                                    focused = false;
                                                }
     };
     bomb.OnBombExploded += delegate() { if (sound != null)
                                         {
                                             sound.StopSound();
                                         }
     };
 }
コード例 #11
0
    IEnumerator AllTimerFunctions()
    {
        IsActive = true;
        yield return(new WaitForSecondsRealtime(1f));

        Timer--;
        TimerDisplay.text = Timer.ToString();
        if (Timer == 30)
        {
            Last30Seconds          = true;
            ClockSoundForNoLooping = Audio.PlaySoundAtTransformWithRef("clock", transform);
        }
        if (Timer == 0)
        {
            if (ClockSoundForNoLooping != null)
            {
                ClockSoundForNoLooping.StopSound();
                ClockSoundForNoLooping = null;
            }
            for (int i = 0; i < 4; i++)
            {
                DisplayLetters[i].text = GoalWord[i].ToString().ToUpper();
            }
            Debug.LogFormat("[Jailbreak #{0}] You took too long!", moduleId);
            Last30Seconds = false;
            CanType       = true;
            yield return(new WaitForSecondsRealtime(5f));

            CanType = false;
            //GetComponent<KMBombModule>().HandleStrike();
            GuessDisplay.text = "Query";
            Audio.PlaySoundAtTransform("DooDooDooDoo", transform);
            WordGeneration();
            IsActive = false;
            Timer    = 90;
            for (int i = 0; i < 4; i++)
            {
                DisplayLetters[i].text = "_";
            }
        }
        else
        {
            StartCoroutine(AllTimerFunctions());
        }
    }
コード例 #12
0
    IEnumerator NeedyDistract()
    {
        yield return(new WaitForSeconds(Time - 4f));

        sound = GetComponent <KMAudio>().PlayGameSoundAtTransformWithRef(KMSoundOverride.SoundEffect.NeedyWarning, transform);
        yield return(new WaitForSeconds(4f));

        sound.StopSound();
        sound = null;
    }
コード例 #13
0
ファイル: coolBeansScript.cs プロジェクト: VFlyer/KTaNE_Beans
    void Awake()
    {
        _moduleID = _moduleIdCounter++;

        Text.GetComponent <TextMesh>().text = "";

        for (int i = 0; i < Beans.Length; i++)
        {
            Beans[i].OnInteract      += BeanPressed(i);
            Beans[i].OnInteractEnded += delegate { heating = false; if (sound != null)
                                                   {
                                                       sound.StopSound(); sound = null;
                                                   }
                                                   return; };
            int x = i;
            Beans[i].OnHighlight      += delegate { BeanHovered(x); return; };
            Beans[i].OnHighlightEnded += delegate { BeanHoverEnded(); return; };
        }
    }
コード例 #14
0
    KMSelectable.OnInteractHandler SetupInteraction(Light light)
    {
        return(() =>
        {
            if (light.speed == 0 || Solved || syncPause)
            {
                return false;
            }

            light.gObject.GetComponent <KMSelectable>().AddInteractionPunch(0.5f);

            if (SelectAudioRef != null)
            {
                SelectAudioRef.StopSound();
                SelectAudioRef = null;
                StopCoroutine(SelectSFXCoroutine);
            }

            if (SelectedLight == null)
            {
                SelectAudioRef = Audio.PlaySoundAtTransformWithRef("Select", transform);
                SelectSFXCoroutine = StartCoroutine(StopSelectSFX());

                ApplyToSpeed(light, l =>
                {
                    l.selection.SetActive(true);
                    l.StopFlashing();
                });

                SelectedLight = light;
            }
            else
            {
                if (SelectedLight.speed == light.speed)
                {
                    ApplyToSpeed(light, l =>
                    {
                        l.selection.SetActive(false);
                        l.StartFlashing();
                    });

                    SelectedLight = null;
                    SelectAudioRef = Audio.PlaySoundAtTransformWithRef("Deselect", transform);
                    SelectSFXCoroutine = StartCoroutine(StopSelectSFX());
                }
                else
                {
                    Audio.PlaySoundAtTransform("Syncing", transform);
                    StartCoroutine(SyncLights(light));
                }
            }

            return false;
        });
    }
コード例 #15
0
    private IEnumerator RotateDial(int ix)
    {
        cantPress = true;
        var count    = 300 * (ix + 1);
        var target   = 180f + (.1f * count);
        var elapsed  = 0f;
        var duration = 0f;

        if (ix == 0 || ix == 1 || ix == 2)
        {
            duration = .5f;
        }
        else if (ix == 3 || ix == 4 || ix == 5)
        {
            duration = .75f;
        }
        else if (ix == 6 || ix == 7 || ix == 8)
        {
            duration = 1f;
        }
        else
        {
            duration = 1.25f;
        }
        audio.PlaySoundAtTransform("dial", transform);
        while (elapsed < duration)
        {
            dial.localEulerAngles = new Vector3(0f, Mathf.Lerp(180f, target, elapsed / duration), 0f);
            yield return(null);

            elapsed += Time.deltaTime;
        }
        dial.localEulerAngles = new Vector3(0f, target, 0f);
        yield return(new WaitForSeconds(.25f));

        elapsed  = 0f;
        audioRef = audio.PlaySoundAtTransformWithRef("rewind", transform);
        while (elapsed < duration)
        {
            dial.localEulerAngles = new Vector3(0f, Mathf.Lerp(target, 180f, elapsed / duration), 0f);
            yield return(null);

            elapsed += Time.deltaTime;
        }
        audioRef.StopSound();
        audioRef = null;
        dial.localEulerAngles = new Vector3(0f, 180f, 0f);
        cantPress             = false;

        if (input.Length == 3)
        {
            CheckAnswer();
        }
    }
コード例 #16
0
ファイル: FakeNeedy.cs プロジェクト: yazici/ktanemod-factory
        private IEnumerator PlayFakeNeedy()
        {
            _ref = _audio.PlayGameSoundAtTransformWithRef(KMSoundOverride.SoundEffect.NeedyWarning, transform);

            yield return(new WaitForSeconds(5.0f));

            _ref.StopSound();
            _ref = null;

            gameObject.SetActive(false);
        }
コード例 #17
0
 private bool ButtonPress()
 {
     if(leakSfxRef != null) leakSfxRef.StopSound();
     steamPlaying = false;
     Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform);
     Button.GetComponent<KMSelectable>().AddInteractionPunch();
     buttonPressed = true;
     buttonSinglePressTimer = 0;
     Button.gameObject.transform.Translate(
         Vector3.Scale(ButtonPushedOffset, transform.parent.parent.localScale));
     return false;
 }
コード例 #18
0
 void shiftleft()
 {
     if (inputMode)
     {
         if (!(moduleSolved || inputNumber <= 1))
         {
             StopAllCoroutines();
             if (soundRef != null)
             {
                 soundRef.StopSound();
             }
             inputNumber--;
             StartCoroutine(playSound());
             if (inputNumber < 10)
             {
                 NumDisp.text = "0" + inputNumber.ToString();
             }
             else
             {
                 NumDisp.text = inputNumber.ToString();
             }
         }
     }
 }
コード例 #19
0
    private void StopAmbient()
    {
        if (_ambientRef != null)
        {
            _ambientRef.StopSound();
            _ambientRef = null;
        }

        try
        {
            GameMusicControl.GameMusicVolume = _defaultGameMusicVolume;
        }
        catch (Exception)
        {
        }
    }
コード例 #20
0
    // Update is called once per frame
    void Update()
    {
        StartCoroutine(doingAnActualStage());

        if (moduleSolved == true)
        {
            time += Time.deltaTime;
            if (Math.Floor(time) == 2)
            {
                soundEffect.StopSound();
            }
        }

        if (strikeGet == true)
        {
            time += Time.deltaTime;
            if (Math.Floor(time) == 2)
            {
                soundEffect.StopSound();
                strikeGet = false;
                canClick  = true;
            }
        }

        if (animating == true)
        {
            otherTime += Time.deltaTime;
            if (Math.Floor(otherTime) == 1)
            {
                texts[7].text = "$" + correctStages + ",000";
            }
            else if (Math.Floor(otherTime) == 2)
            {
                otherTime = 0;
                animating = false;
                canClick  = true;
                StartCoroutine(doingAnActualStage());
            }
        }
    }
コード例 #21
0
    private void PlaySound(int i)
    {
        if (_audioRef != null && _sounds[i] == "HiHat")
        {
            _audioRef.StopSound();
            _audioRef = null;
        }

        if (_sounds[i] == "OpenHiHat" && Audio.HandlePlaySoundAtTransformWithRef != null)
        {
            _audioRef = Audio.HandlePlaySoundAtTransformWithRef(_sounds[i], transform, false);
        }
        else
        {
            Audio.PlaySoundAtTransform(_sounds[i], transform);
        }
    }
コード例 #22
0
        private IEnumerator WobbleTime(float duration)
        {
            _postProcess = CameraPostProcess.AddPostProcess(Material);

            _ref = _audio.PlaySoundAtTransformWithRef(WobbleAudio.name, transform);

            float finalTime = Random.Range(0, 2) == 0 ? Random.Range(0.4f, 0.6f) : Random.Range(1.2f, 1.3f);
            float sign      = Mathf.Sign(finalTime - 1.0f);

            float startTime = Time.realtimeSinceStartup;

            while ((Time.realtimeSinceStartup - startTime) < (duration * 0.8f))
            {
                float delta = (Time.realtimeSinceStartup - startTime) / (duration * 0.9f);

                Time.timeScale = Mathf.SmoothStep(1.0f, finalTime, delta);
                Material.SetFloat("_Stretch", Mathf.Lerp(1.0f, 1.0f - sign, delta));
                Material.SetFloat("_Vignette", Mathf.Lerp(0.0f, sign * -2.0f, delta));

                yield return(null);
            }

            yield return(new WaitForSeconds(duration * 0.1f));

            startTime = Time.realtimeSinceStartup;
            while ((Time.realtimeSinceStartup - startTime) < (duration * 0.1f))
            {
                float delta = (Time.realtimeSinceStartup - startTime) / (duration * 0.1f);

                Time.timeScale = Mathf.SmoothStep(finalTime, 1.0f, delta);
                Material.SetFloat("_Stretch", Mathf.Lerp(1.0f - sign, 1.0f, delta));
                Material.SetFloat("_Vignette", Mathf.Lerp(sign * -2.0f, 0.0f, delta));

                yield return(null);
            }

            Time.timeScale = 1.0f;

            _ref.StopSound();
            _ref = null;

            DestroyImmediate(_postProcess);
            _postProcess = null;

            gameObject.SetActive(false);
        }
コード例 #23
0
    private void PressButton(KMSelectable button)
    {
        button.AddInteractionPunch(.25f);
        var ix = Array.IndexOf(buttons, button);

        if (!easterEggUsed && ix != 2)
        {
            easterEggUsed = true;
            audio.PlaySoundAtTransform(ix == 0 ? "fellInLuv" : ix == 1 ? "shoota" : "kidCudi", transform);
        }
        if (moduleSolved)
        {
            return;
        }
        switch (buttonDirections[ix])
        {
        case 0:
            currentLocation += currentLocation / 5 == 0 ? 20 : -5;
            break;

        case 1:
            currentLocation += currentLocation % 5 == 4 ? -4 : 1;
            break;

        case 2:
            currentLocation += currentLocation / 5 == 4 ? -20 : 5;
            break;

        case 3:
            currentLocation += currentLocation % 5 == 0 ? 4 : -1;
            break;

        default:
            throw new Exception(string.Format("buttonDirections[{0}] has an unexpected value.", ix));
        }
        if (audioRef != null)
        {
            audioRef.StopSound();
            audioRef = null;
        }
        audioRef = audio.HandlePlaySoundAtTransformWithRef(buttonLyrics[ix], button.transform, false);
    }
コード例 #24
0
    IEnumerator Blacken()
    {
        if (SoundIThink != null)
        {
            SoundIThink.StopSound();
            SoundIThink = null;
        }
        float    fadeOutTime = 2.0f;
        Material originalMat = Background.GetComponent <Renderer>().material;

        for (float t = 0.01f; t < fadeOutTime; t += Time.deltaTime)
        {
            Background.GetComponent <Renderer>().material.Lerp(originalMat, Static[10], Mathf.Min(1, t / fadeOutTime));
            yield return(null);
        }
        yield return(new WaitForSeconds(1f));

        AutosolveWait = false;
    }
コード例 #25
0
        private IEnumerator Bumps(float duration)
        {
            _ref = _audio.PlaySoundAtTransformWithRef(RumbleAudio.name, transform);

            while (duration >= 0.0f)
            {
                Vector3 punchPosition          = new Vector3(Random.Range(-10.0f, 10.0f), Random.Range(0.0f, 10.0f), Random.Range(-10.0f, 10.0f));
                float   bumpAmount             = Random.Range(MinimumBump, MaximumBump);
                float   punchDuration          = Random.Range(MinimumPunchDuration, MaximumPunchDuration);
                float   punchOscillationPeriod = Random.Range(MinimumPunchOscillationPeriod, MaximumPunchOscillationPeriod);

                KTInputManager.Instance.AddInteractionPunch(punchPosition, bumpAmount, punchDuration, punchOscillationPeriod);

                yield return(new WaitForSeconds(0.1f));

                duration -= 0.1f;
            }

            _ref.StopSound();
            _ref = null;

            gameObject.SetActive(false);
        }
コード例 #26
0
 void PressButton()
 {
     Button.AddInteractionPunch();
     playedTheDamnSound = false;
     if (moduleSolved == false && canClick == true)
     {
         if (stage == 0)
         {
             stage        += 1;
             texts[3].text = "";
             texts[4].text = "";
             texts[0].text = "";
             bigWordOrder.Shuffle();
             smallWordOrder.Shuffle();
             soundEffect = Audio.PlaySoundAtTransformWithRef("blank", transform);
             soundEffect.StopSound();
             soundEffect = Audio.PlaySoundAtTransformWithRef("Chunk 1", transform);
             Debug.LogFormat("[Jack Attack #{0}] The big word is: \"{1}\"", moduleId, PhraseList.phrases[anchor + (bigWordOrder[stage - 1] + 1)].Replace("\n", " "));
             Debug.LogFormat("[Jack Attack #{0}] The correct small word is: \"{1}\"", moduleId, PhraseList.phrases[anchor + (bigWordOrder[stage - 1] + 9)].Replace("\n", " "));
         }
         else
         {
             if (texts[2].text == PhraseList.phrases[anchor + (bigWordOrder[stage - 1] + 9)])
             {
                 smallWordOrder.Shuffle();
                 correctStages += 1;
                 time           = -2;
                 stage         += 1;
                 soundEffect.StopSound();
                 soundEffect = Audio.PlaySoundAtTransformWithRef("correct", transform);
                 back.GetComponent <MeshRenderer>().material   = mats[1];
                 Button.GetComponent <MeshRenderer>().material = mats[1];
                 Debug.LogFormat("[Jack Attack #{0}] Stage {1} is correct. Current correct stages: {2}", moduleId, stage - 1, correctStages);
                 Check(1);
                 if (moduleSolved == false)
                 {
                     Debug.LogFormat("[Jack Attack #{0}] The big word is: \"{1}\"", moduleId, PhraseList.phrases[anchor + (bigWordOrder[stage - 1] + 1)].Replace("\n", " "));
                     Debug.LogFormat("[Jack Attack #{0}] The correct small word is: \"{1}\"", moduleId, PhraseList.phrases[anchor + (bigWordOrder[stage - 1] + 9)].Replace("\n", " "));
                 }
             }
             else
             {
                 Debug.LogFormat("[Jack Attack #{0}] Stage {1} striked. Module reset.", moduleId, stage);
                 time         = 0;
                 stage        = 0;
                 missedStages = 0;
                 bigWordOrder.Shuffle();
                 smallWordOrder.Shuffle();
                 if (cycleInstead == true)
                 {
                     dontDisp = true;
                 }
                 texts[0].text = PhraseList.phrases[anchor];
                 texts[1].text = "";
                 texts[2].text = "";
                 texts[3].text = "JACK";
                 texts[4].text = "ATTACK";
                 strikeGet     = true;
                 canClick      = false;
                 soundEffect.StopSound();
                 soundEffect = Audio.PlaySoundAtTransformWithRef("scream", transform);
                 GetComponent <KMBombModule>().HandleStrike();
             }
         }
     }
     else
     {
         Debug.Log("YOU CANNOT CLICK RIGHT NOW");
     }
 }
コード例 #27
0
ファイル: exoplanets.cs プロジェクト: Kuroshii/exoplanets
    void Awake()
    {
        moduleId = moduleIdCounter++;
        foreach (KMSelectable button in planetButtons)
        {
            button.OnInteract += delegate() { PressPlanet(button); return(false); }
        }
        ;
        starButton.OnInteract += delegate() { PressStar(); return(false); };
        bomb.OnBombExploded   += delegate { HandleDetonation(); };
    }

    void Start()
    {
        StartCoroutine(DisableDummies());
        statusLight.SetActive(false);
        starCcw      = rnd.Range(0, 2) != 0;
        planetSizes  = Enumerable.Range(0, 3).ToList().Shuffle().ToArray();
        planetSpeeds = speeds.ToList().Shuffle().Take(3).ToArray();
        for (int i = 0; i < 3; i++)
        {
            planetSurfaces[i] = rnd.Range(0, 10);
            planetsCcw[i]     = rnd.Range(0, 2) != 0;
            spinningCcw[i]    = rnd.Range(0, 2) != 0;
            Debug.LogFormat("[Exoplanets #{0}] The {1} planet has an angular velocity of {2}.", moduleId, positionNames[i], (int)planetSpeeds[i]);
            Debug.LogFormat("[Exoplanets #{0}] The {1} planet is {2}.", moduleId, positionNames[i], sizeNames[planetSizes[i]]);
        }
        for (int i = 0; i < 3; i++)
        {
            orbits[i] = StartCoroutine(Orbit(pivots[i], i));
        }
        foreach (Renderer planet in planets)
        {
            var ix = Array.IndexOf(planets, planet);
            planet.material.mainTexture = surfaces[planetSurfaces[ix]];
            var sizecord = sizes[planetSizes[ix]];
            planet.transform.localScale           = new Vector3(sizecord, sizecord, sizecord);
            dummyPlanets[ix].transform.localScale = new Vector3(sizecord, sizecord, sizecord);
            planet.transform.localRotation        = rnd.rotation;
            tilts[ix] = StartCoroutine(Spinning(planet, ix));
        }
        starSpinning = StartCoroutine(StarMovement());
        GenerateSolution();
    }

    void GenerateSolution()
    {
        if (!planetsCcw.Contains(true))
        {
            targetPlanet = 0;
            Debug.LogFormat("[Exoplanets #{0}] All planets are oribiting clockwise, so the initial target planet is the one closest to the star.", moduleId);
        }
        else if (!planetsCcw.Contains(false))
        {
            targetPlanet = 2;
            Debug.LogFormat("[Exoplanets #{0}] All planets are orbiting counterclockwise, so the initial target planet is the one farthest from the star.", moduleId);
        }
        else
        {
            if (planetsCcw.Count(x => x) == 2)
            {
                targetPlanet = Array.IndexOf(planetsCcw, planetsCcw.First(x => !x));
            }
            else
            {
                targetPlanet = Array.IndexOf(planetsCcw, planetsCcw.First(x => x));
            }
            Debug.LogFormat("[Exoplanets #{0}] The {1} planet is orbiting {2}, so it is the initial target planet.", moduleId, positionNames[targetPlanet], planetsCcw[targetPlanet] ? "counterclockwise" : "clockwise");
        }
        targetDigit         = planetSurfaces[targetPlanet];
        startingTargetDigit = targetDigit;
        Debug.LogFormat("[Exoplanets #{0}] The initial target digit is {1}.", moduleId, targetDigit);
        tablePosition = (tablePosition + bomb.GetBatteryCount() * (starCcw ? 7 : 1)) % 8;
        Debug.LogFormat("[Exoplanets #{0}] The star is rotating {1} and there are {2} batteries.", moduleId, !starCcw ? "clockwise" : "counterclockwise", bomb.GetBatteryCount());
        tableRing = targetPlanet;
        for (int i = 0; i < 3; i++)
        {
            Modify(i);
        }
        Debug.LogFormat("[Exoplanets #{0}] The final solution is to press the {1} planet on a {2}.", moduleId, positionNames[targetPlanet], targetDigit);
    }

    void Modify(int j)
    {
        var offset = ((int)planetSpeeds[tableRing]);

        if (bomb.GetBatteryHolderCount() != 0)
        {
            offset %= bomb.GetBatteryHolderCount();
        }
        else
        {
            offset %= 5;
        }
        offset       += bomb.GetPortCount();
        tablePosition = (tablePosition + offset * (planetsCcw[tableRing] ? 7 : 1)) % 8;
        var prevPlanet = targetPlanet;
        var prevDigit  = targetDigit;

        Debug.LogFormat("[Exoplanets #{0}] Using rule {1}.", moduleId, table[tableRing][tablePosition]);
        switch (table[tableRing][tablePosition])
        {
        case "A":
            if (planetSizes[targetPlanet] == 2)
            {
                targetPlanet = Array.IndexOf(planetSizes, 0);
            }
            else
            {
                targetPlanet = Array.IndexOf(planetSizes, planetSizes.Where(x => x > planetSizes[targetPlanet]).Min());
            }
            break;

        case "B":
            targetDigit = (targetDigit + startingTargetDigit) % 10;
            break;

        case "C":
            if (planetSizes[targetPlanet] == 0)
            {
                targetPlanet = Array.IndexOf(planetSizes, 2);
            }
            else
            {
                targetPlanet = Array.IndexOf(planetSizes, planetSizes.Where(x => x < planetSizes[targetPlanet]).Max());
            }
            break;

        case "D":
            var differencesMax = new int[3];
            for (int i = 0; i < 3; i++)
            {
                differencesMax[i] = planetSurfaces[targetPlanet] - planetSurfaces[i];
                if (differencesMax[i] < 0)
                {
                    differencesMax[i] *= -1;
                }
            }
            targetPlanet = Array.IndexOf(differencesMax, differencesMax.Max());
            break;

        case "E":
            targetDigit = 9 - targetDigit;
            break;

        case "F":
            if (planetsCcw.Distinct().Count() == 0)
            {
                targetPlanet = 1;
            }
            else
            {
                targetPlanet = Array.IndexOf(planetsCcw, planetsCcw.First(x => x == planetsCcw[targetPlanet]));
            }
            break;

        case "G":
            targetPlanet = Array.IndexOf(planetsCcw, planetsCcw.First(x => x == planetsCcw[targetPlanet]));
            break;

        case "H":
            targetDigit = (targetDigit + bomb.GetSerialNumberNumbers().Sum()) % 10;
            break;

        case "I":
            if (planetSurfaces[targetPlanet] == planetSurfaces.Max())
            {
                targetPlanet = Array.IndexOf(planetSurfaces, planetSurfaces.Min());
            }
            else
            {
                targetPlanet = Array.IndexOf(planetSurfaces, planetSurfaces.Where(x => x > planetSurfaces[targetPlanet]).Min());
            }
            break;

        case "J":
            targetDigit = (targetDigit + bomb.GetModuleNames().Count()) % 10;
            break;

        case "K":
            targetPlanet--;
            if (targetPlanet == -1)
            {
                targetPlanet = 2;
            }
            break;

        case "L":
            targetDigit = (targetDigit + bomb.GetSerialNumberNumbers().First()) % 10;
            break;

        case "M":
            var differencesMin = new int[3];
            for (int i = 0; i < 3; i++)
            {
                differencesMin[i] = planetSurfaces[targetPlanet] - planetSurfaces[i];
                if (differencesMin[i] < 0)
                {
                    differencesMin[i] *= -1;
                }
            }
            var differencesMinList = differencesMin.ToList();
            differencesMinList.Remove(differencesMinList[targetPlanet]);
            targetPlanet = Array.IndexOf(differencesMin, differencesMinList.Min());
            break;

        case "N":
            targetDigit = (targetDigit + bomb.GetSerialNumberNumbers().ToArray()[1]) % 10;
            break;

        case "O":
            if (targetPlanet == Array.IndexOf(planetSpeeds, planetSpeeds.Min()))
            {
                targetPlanet = Array.IndexOf(planetSpeeds, planetSpeeds.Max());
            }
            else
            {
                targetPlanet = Array.IndexOf(planetSpeeds, planetSpeeds.Where(x => x < planetSpeeds[targetPlanet]).Max());
            }
            break;

        case "P":
            targetPlanet = targetPlanet == 0 ? 2 : 0;
            break;

        case "Q":
            targetDigit = (targetDigit + bomb.GetPortCount()) % 10;
            break;

        case "R":
            targetDigit = (targetDigit + 5) % 10;
            break;

        case "S":
            if (targetPlanet == Array.IndexOf(planetSpeeds, planetSpeeds.Max()))
            {
                targetPlanet = Array.IndexOf(planetSpeeds, planetSpeeds.Min());
            }
            else
            {
                targetPlanet = Array.IndexOf(planetSpeeds, planetSpeeds.Where(x => x > planetSpeeds[targetPlanet]).Min());
            }
            break;

        case "T":
            targetDigit = (targetDigit + bomb.GetSerialNumberNumbers().Last()) % 10;
            break;

        case "U":
            targetPlanet = (targetPlanet + 1) % 3;
            break;

        case "V":
            targetDigit = (targetDigit + bomb.GetBatteryCount()) % 10;
            break;

        case "W":
            var indicators = bomb.GetIndicators().SelectMany(x => x.ToUpperInvariant().ToCharArray());
            var count      = 0;
            foreach (Char c in indicators)
            {
                if (!"AEIOU".Contains(c))
                {
                    count++;
                }
            }
            targetDigit = (targetDigit + count) % 10;
            break;

        default:
            if (planetSurfaces[targetPlanet] == planetSurfaces.Min())
            {
                targetPlanet = Array.IndexOf(planetSurfaces, planetSurfaces.Max());
            }
            else
            {
                targetPlanet = Array.IndexOf(planetSurfaces, planetSurfaces.Where(x => x < planetSurfaces[targetPlanet]).Min());
            }
            break;
        }
        if (targetPlanet != prevPlanet)
        {
            Debug.LogFormat("[Exoplanets #{0}] The target planet is now the {1} planet.", moduleId, positionNames[targetPlanet]);
        }
        if (targetDigit != prevDigit)
        {
            Debug.LogFormat("[Exoplanets #{0}] The target digit is now {1}.", moduleId, targetDigit);
        }
        if (j != 2)
        {
            tableRing--;
            if (tableRing == -1)
            {
                tableRing = 2;
            }
            Debug.LogFormat("[Exoplanets #{0}] Moving inward...", moduleId);
        }
    }

    void PressPlanet(KMSelectable button)
    {
        var ix            = Array.IndexOf(planetButtons, button);
        var submittedTime = ((int)bomb.GetTime()) % 10;
        var oridinals     = new string[] { "1st", "2nd", "3rd" };

        Debug.LogFormat("[Exoplanets #{0}] You pressed the {1} planet.", moduleId, oridinals[ix]);
        var planetCorrect = targetPlanet == ix;
        var timeCorrect   = targetDigit == submittedTime;

        if (planetCorrect && timeCorrect)
        {
            module.HandlePass();
            moduleSolved = true;
            if (ambianceRef != null)
            {
                ambianceRef.StopSound();
                ambianceRef = null;
            }
            Debug.LogFormat("[Exoplanets #{0}] That was correct. Module solved!", moduleId);
            audio.PlaySoundAtTransform("explosion", transform);
            StartCoroutine(SolveAnimation());
        }
        else
        {
            if (!planetCorrect && !timeCorrect)
            {
                Debug.LogFormat("[Exoplanets #{0}] Neither the planet nor the time were correct.", moduleId);
            }
            else if (!planetCorrect && timeCorrect)
            {
                Debug.LogFormat("[Exoplanets #{0}] The planet wasn’t correct, but the time was.", moduleId);
            }
            else
            {
                Debug.LogFormat("[Exoplanets #{0}] The planet was correct, but the time wasn’t.", moduleId);
            }
            module.HandleStrike();
            Debug.LogFormat("[Exoplanets #{0}] Strike!", moduleId);
        }
    }

    void PressStar()
    {
        if (isMoving && !moduleSolved)
        {
            return;
        }
        if (moduleSolved)
        {
            return;
        }
        else
        {
            foreach (Renderer planet in planets)
            {
                var ix = Array.IndexOf(planets, planet);
                if (!planetsHidden)
                {
                    savedPositions[ix] = planet.transform.localPosition;
                }
                StartCoroutine(MovePlanets(planet, ix));
            }
        }
    }

    IEnumerator MovePlanets(Renderer planet, int ix)
    {
        isMoving = true;
        var elapsed  = 0f;
        var duration = 1f;

        while (elapsed < duration)
        {
            if (!planetsHidden)
            {
                planet.transform.localPosition = new Vector3(Easing.InOutQuad(elapsed, savedPositions[ix].x, 0, duration), Easing.InOutQuad(elapsed, savedPositions[ix].y, .0314f, duration), Easing.InOutQuad(elapsed, savedPositions[ix].z, 0, duration));
            }
            else
            {
                planet.transform.localPosition = new Vector3(Easing.InOutQuad(elapsed, 0, savedPositions[ix].x, duration), Easing.InOutQuad(elapsed, .0314f, savedPositions[ix].y, duration), Easing.InOutQuad(elapsed, 0, savedPositions[ix].z, duration));
            }
            yield return(null);

            elapsed += Time.deltaTime;
        }
        isMoving      = false;
        planetsHidden = !planetsHidden;
    }

    IEnumerator Orbit(Transform pivot, int ix)
    {
        var startAngle = rnd.Range(0, 360);
        var elapsed    = 0f;
        var speed      = planetSpeeds[ix];

        if (planetsCcw[ix])
        {
            speed = -speed;
        }
        while (true)
        {
            pivot.localEulerAngles = new Vector3(0, elapsed / speed * 360 + startAngle, 0);
            yield return(null);

            elapsed += Time.deltaTime;
        }
    }

    IEnumerator Spinning(Renderer planet, int ix)
    {
        var startAngle = rnd.Range(0, 360);
        var pX = planet.transform.localEulerAngles.x;
        var pZ = planet.transform.localEulerAngles.z;
        var elapsed = 0f;
        var speed = new float[] { 4f, 6f, 7f, 8f }.PickRandom();

        if (!planetsCcw[ix])
        {
            speed = -speed;
        }
        while (true)
        {
            planet.transform.localEulerAngles = new Vector3(pX, elapsed / speed * 360 + startAngle, pZ);
            yield return(null);

            elapsed += Time.deltaTime;
        }
    }

    IEnumerator StarMovement()
    {
        var starScrollSpeed = .02f;

        if (starCcw)
        {
            starScrollSpeed = -starScrollSpeed;
        }
        while (true)
        {
            var offsetStar = Time.time * starScrollSpeed;
            star.material.mainTextureOffset = new Vector2(offsetStar, 0f);
            yield return(null);
        }
    }

    IEnumerator BackgroundMoveMent()
    {
        var horizontalScrollSpeed = .001f;
        var verticalScrollSpeed   = .001f;

        while (true)
        {
            var offsetY = Time.time * horizontalScrollSpeed;
            var offsetZ = Time.time * verticalScrollSpeed;
            background.material.mainTextureOffset = new Vector2(offsetY, offsetZ);
            yield return(null);
        }
    }

    IEnumerator SolveAnimation()
    {
        var elapsed  = 0f;
        var duration = 6f;

        for (int i = 0; i < 3; i++)
        {
            savedPositions[i] = planets[i].transform.localPosition;
            StopCoroutine(orbits[i]);
            StopCoroutine(tilts[i]);
        }
        StopCoroutine(starSpinning);
        while (elapsed < duration)
        {
            var fade = Mathf.Lerp(1f, 0f, elapsed / duration);
            foreach (Renderer planet in planets)
            {
                planet.material.color = new Color(fade, fade, fade);
            }
            yield return(null);

            elapsed += Time.deltaTime;
        }
        for (int i = 0; i < 3; i++)
        {
            planets[i].gameObject.SetActive(false);
            dummyPlanets[i].transform.SetParent(pivots[i], false);
            dummyPlanets[i].gameObject.SetActive(true);
            dummyPlanets[i].transform.localPosition = savedPositions[i];
        }
        elapsed  = 0f;
        duration = 3f;
        while (elapsed < duration)
        {
            var fade = Mathf.Lerp(1f, 0f, elapsed / duration);
            star.material.color = new Color(fade, fade, fade);
            yield return(null);

            elapsed += Time.deltaTime;
        }
        star.gameObject.SetActive(false);
        dummyStar.gameObject.SetActive(true);
        elapsed  = 0f;
        duration = 3.5f;
        while (elapsed < duration)
        {
            var fade = Mathf.Lerp(1f, 0f, elapsed / duration);
            dummyStar.material.color = new Color(0f, 0f, 0f, fade);
            foreach (Renderer planet in dummyPlanets)
            {
                planet.material.color = new Color(0f, 0f, 0f, fade);
            }
            yield return(null);

            elapsed += Time.deltaTime;
        }
        dummyStar.gameObject.SetActive(false);
        foreach (Renderer planet in dummyPlanets)
        {
            planet.gameObject.SetActive(false);
        }
        yield return(new WaitForSeconds(.75f));

        background.material.color = solveColor;
        audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
    }

    IEnumerator DisableDummies()
    {
        yield return(null);

        ambianceRef = audio.PlaySoundAtTransformWithRef("ambiance", star.transform);
        dummyStar.gameObject.SetActive(false);
        foreach (Renderer planet in dummyPlanets)
        {
            planet.gameObject.SetActive(false);
        }
    }

    void HandleDetonation()
    {
        StopAllCoroutines();
        if (ambianceRef != null)
        {
            ambianceRef.StopSound();
            ambianceRef = null;
        }
    }
コード例 #28
0
    public IEnumerator ProcessTwitchCommand(string command)
    {
        command = command.Replace(',', ' ');
        string[] split = command.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

        Dictionary <string, KMSelectable> cmdButtons = new Dictionary <string, KMSelectable>()
        {
            { "bigred", Red },
            { "biggreen", Green },
            { "bigblue", Blue },
            { "smallred", Multiply },
            { "smallgreen", Reset },
            { "smallblue", Submit },
        };

        Dictionary <string, string> statusLightColors = new Dictionary <string, string>()
        {
            { "usegreenonsolve", "green" },
            { "useredonsolve", "red" },
            { "useoffonsolve", "off" },
            { "userandomonsolve", "random" }
        };

        KMSelectable currentSelect    = null;
        string       statusLightColor = "green";

        foreach (string cmd in split)
        {
            if (cmdButtons.ContainsKey(cmd))
            {
                currentSelect = cmdButtons[cmd];
            }
            else if (statusLightColors.ContainsKey(cmd))
            {
                statusLightColor = statusLightColors[cmd];
            }
            else
            {
                int selectCount = 0;
                if (int.TryParse(cmd, out selectCount))
                {
                    if (currentSelect == null)
                    {
                        continue;
                    }

                    if (currentSelect == Submit)
                    {
                        yield return(null);

                        HandlePressSubmit(statusLightColor);
                        if (solved)
                        {
                            yield return("solve");
                        }
                    }
                    else
                    {
                        while (selectCount != 0)
                        {
                            yield return(null);

                            currentSelect.OnInteract();
                            selectCount--;
                            yield return(new WaitForSeconds(0.1f));
                        }
                    }
                }
            }
        }
        if (split[0] == "troll")
        {
            yield return("antitroll Sorry, I am not going to press each button 75 times");

            yield return("Color Generator");

            yield return("waiting music");

            yield return("sendtochat /me HAHAHAHA");

            Reset.OnInteract();
            yield return(new WaitForSeconds(0.1f));

            KMSelectable[] buttons = new KMSelectable[] { Red, Green, Blue };
            int[]          values  = new int[] { 25, 25, 25 };
            for (int i = 0; i < 3; i++)
            {
                for (int index = 0; index < 3; index++)
                {
                    for (int x = 0; x < values[index]; x++)
                    {
                        buttons[index].OnInteract();
                        displayText.text = "HAHAHAHA";
                        yield return(new WaitForSeconds(0.1f));
                    }
                }
            }

            Reset.OnInteract();
        }
        else if (split[0] == "fakestrike")
        {
            yield return("antitroll Sorry, I am not going to generate a fake strike.");

            yield return(null);

            yield return("multiple strikes");

            Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.Strike, transform);
        }
        else if (split[0] == "needystart")
        {
            yield return("antitroll Sorry, I am not going to act like a needy module.");

            yield return(null);

            Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.NeedyActivated, transform);
        }
        else if (split[0] == "needyend")
        {
            yield return("antitroll Sorry, I am not going to act like a needy module.");

            yield return(null);

            KMAudio.KMAudioRef audioRef = this.Audio.PlayGameSoundAtTransformWithRef(KMSoundOverride.SoundEffect.NeedyWarning, base.transform);
            yield return(new WaitForSeconds(5f));

            audioRef.StopSound();
        }
        else if (split[0] == "tellmeastory")
        {
            yield return("antitroll Sorry, I am not currently in the mood to tell you a story.");

            yield return(null);

            yield return("waiting music");

            string story = "#000000 once upon a time, there was a bomb with the seed " + RealBombModule.Bomb.Seed.ToString() + ", and it had a color generator module. a random lunatic decided to input an incorrect answer, and detonated the bomb. the end #000000";

            for (int i = 0; i < story.Length - 6; i++)
            {
                string subStory = story.Substring(i, 7);
                displayText.text = subStory;
                yield return(new WaitForSeconds(0.1f));
            }
        }
    }
コード例 #29
0
    private IEnumerator SolvingKugel()
    {
        sphereTextMesh.text = "";
        solve       = true;
        totalsolved = true;
        basecol     = new float[] { 1f, 1f, 1f };
        KMAudio.KMAudioRef noise = null;
        for (int i = -10; scale >= 0.01f; i++)
        {
            if (i == -5)
            {
                if (sound != null)
                {
                    sound.StopSound();
                    sound = null;
                }
                noise = Audio.PlaySoundAtTransformWithRef("Decay", Module.transform);
            }
            sphereTextMesh.text = "";
            sphereMeshRenderer.material.color = new Color(basecol[0], basecol[1], basecol[2]);
            shinyMeshRenderer.color           = new Color(basecol[0], basecol[1], basecol[2], 0.5f);
            scale -= i / 5000f;
            yield return(new WaitForSeconds(0.02f));

            basecol[0] = (statuslight[0] + basecol[0] * 31f) / 32f; basecol[1] = (statuslight[1] + basecol[1] * 31f) / 32f; basecol[2] = (statuslight[2] + basecol[2] * 31f) / 32f;
            for (int j = 0; j < 7; j++)
            {
                x[j] *= 0.92f; y[j] *= 0.92f; z[j] *= 0.92f;
                Orbs[j].transform.localPosition = new Vector3(x[j], y[j], z[j]);
            }
            Sphere.transform.localScale = new Vector3(scale, scale, scale);
            shinyMeshRenderer.range     = scale / 2f + 0.05f;
        }
        Sphere.transform.localScale = new Vector3(0.025f, 0.025f, 0.025f);
        shinyMeshRenderer.range     = 0.0375f;
        for (int j = 0; j < 7; j++)
        {
            Orbs[j].transform.localPosition = new Vector3(0f, 0f, 0f);
            Orbs[j].transform.localScale    = new Vector3(0f, 0f, 0f);
            GlowLight[j].range = 0f;
        }
        sphereMeshRenderer.material.color = new Color(statuslight[0], statuslight[1], statuslight[2]);
        shinyMeshRenderer.color           = new Color(statuslight[0], statuslight[1], statuslight[2], 0.5f);
        noise.StopSound();
        noise = null;

        /*if (something idk)
         * {
         *      KMSelectable clone;
         *      clone = Instantiate(Sphere, Module.transform);
         *      float[] clonecol = { 1f, 1f, 1f };
         *      for (int i = 0; i < 25; i++)
         *      {
         *              basecol[0] = (1f + basecol[0] * 31f) / 32f; basecol[1] = (0.5f + basecol[1] * 31f) / 32f; basecol[2] = (0f + basecol[2] * 31f) / 32f;
         *              clonecol[0] = (0f + clonecol[0] * 31f) / 32f; clonecol[1] = (0.5f + clonecol[1] * 31f) / 32f; clonecol[2] = (1f + clonecol[2] * 31f) / 32f;
         *              sphereMeshRenderer.material.color = new Color(basecol[0], basecol[1], basecol[2]);
         *              //Justified GetComponent in this case
         *              clone.GetComponent<MeshRenderer>().material.color = new Color(clonecol[0], clonecol[1], clonecol[2]);
         *              Sphere.GetComponentInChildren<Light>().color = new Color(basecol[0], basecol[1], basecol[2], 0.5f);
         *              clone.GetComponentInChildren<Light>().color = new Color(clonecol[0], clonecol[1], clonecol[2], 0.5f);
         *              Sphere.transform.localPosition = new Vector3(Sphere.transform.localPosition.x - 0.001f, Sphere.transform.localPosition.y, Sphere.transform.localPosition.z);
         *              clone.transform.localPosition = new Vector3(clone.transform.localPosition.x + 0.001f, clone.transform.localPosition.y, clone.transform.localPosition.z);
         *              yield return new WaitForSeconds(0.02f);
         *      }
         * }*/
        Module.HandlePass();
    }
コード例 #30
0
    void Awake()
    {
        kugelcount         = 0;
        struck             = 0;
        totalsolved        = false;
        controlSequence    = "[";
        sphereMeshRenderer = Sphere.GetComponent <MeshRenderer>();
        sphereTextMesh     = Sphere.GetComponentInChildren <TextMesh>();
        shinyMeshRenderer  = Shiny.GetComponent <Light>();
        foreach (GameObject orb in Orbs)
        {
            OrbsMeshRenderer.Add(orb.GetComponent <MeshRenderer>());
        }

        foreach (GameObject light in Glow)
        {
            GlowLight.Add(light.GetComponent <Light>());
        }

        currentModID = modID++;
        colorblind   = CBM.ColorblindModeActive;

        if (ignoredModules == null)
        {
            ignoredModules = GetComponent <KMBossModule>().GetIgnoredModules("Kugelblitz", new string[] {
                "Forget Me Not",
                "Forget Everything",
                "Turn The Key",
                "Souvenir",
                "The Time Keeper",
                "Simon's Stages",
                "Forget It Not",
                "Forget This",
                "Forget Them All",
                "Divided Squares",
                "Übermodule",
                "Encryption Bingo",
                "Organization",
                "Ultimate Custom Night",
                "RPS Judging",
                "Cookie Jar",
                "Brainf---",
                "Kugelblitz"                 //for the sake of safety
            });
        }

        Sphere.OnInteract += delegate()
        {
            if (solved != Display.Length)
            {
                Module.HandleStrike(); sphereMeshRenderer.material.color = new Color(0.5f, 0f, 0f); basecol = new float[] { 0.5f, 0f, 0f }; hold = false;
                struck = (struck + 1) % (solved + 1);
            }
            else
            {
                if (!solve)
                {
                    sphereMeshRenderer.material.color = new Color(1f, 1f, 1f);
                    shinyMeshRenderer.color           = new Color(1f, 1f, 1f, 0.5f);
                    basecol = new float[] { 1f, 1f, 1f };
                }
                hold          = true;
                userSequence += '[';
                if (userSequence == "[")
                {
                    sound = Audio.PlaySoundAtTransformWithRef("VoidSucc", Module.transform);
                }
            }
            return(false);
        };
        Sphere.OnInteractEnded += delegate()
        {
            if (solved == Display.Length && hold)
            {
                hold          = false;
                userSequence += ']';
            }
        };
        BombInfo.OnBombExploded += delegate()
        {
            if (sound != null)
            {
                sound.StopSound();
                sound = null;
            }
        };

        GetComponent <KMBombModule>().OnActivate += ActivateModule;

        for (int i = 0; i < 7; i++)
        {
            r[i]  = Rnd.Range(0.055f, 0.09f);
            x[i]  = Rnd.Range(-1f, 1f); y[i] = Rnd.Range(-1f, 1f); z[i] = Rnd.Range(-1f, 1f);
            r2[i] = Mathf.Pow(Mathf.Pow(x[i], 2f) + Mathf.Pow(y[i], 2f) + Mathf.Pow(z[i], 2f), 0.5f);
            x[i]  = x[i] * r[i] / r2[i]; y[i] = y[i] * r[i] / r2[i]; z[i] = z[i] * r[i] / r2[i];
            vx[i] = Rnd.Range(-.1f, .1f); vy[i] = Rnd.Range(-.1f, .1f); vz[i] = Rnd.Range(-.1f, .1f);
            Orbs[i].transform.localPosition = new Vector3(x[i], y[i], z[i]);
            vmod[i] = 0.001f / Mathf.Pow(r[i], 2f);
        }
        sphereTextMesh.text = "";
    }