protected virtual void QueryModule()
    {
        int idx = -1;

        for (int x = 0; x < allQueries.Count; x++)
        {
            if (currentInputs.SequenceEqual(allQueries[x]))
            {
                idx = x;
                break;
            }
        }
        if (idx != -1)
        {
            correctBothDisplay.text  = queryCorrectColorAndPos[idx].ToString();
            correctColorDisplay.text = queryCorrectColorNotPos[idx].ToString();
            queryLeftDisplay.text    = queriesLeft.ToString();
        }
        else
        {
            queriesLeft--;
            // Process correct inputs.
            int correctColors = 0, correctPosandColors = 0;
            for (int x = 0; x < maxPossible; x++) // Start by filtering out each color separately to determine the states of each
            {
                var filteredCorrectInputs = correctInputs.Select(a => a == x ? a : -1);
                var filteredCurrentInputs = currentInputs.Select(a => a == x ? a : -1);
                var filteredWrongIdxes    = Enumerable.Range(0, selectableRenderer.Length).Where(a => filteredCorrectInputs.ElementAt(a) == -1);
                int correctInOnePos       = 0;
                int correctColorOnly      = 0;
                correctInOnePos = Enumerable.Range(0, selectableRenderer.Length)
                                  .Count(y => filteredCurrentInputs.ElementAt(y) != -1 && filteredCorrectInputs.ElementAt(y) != -1 &&
                                         filteredCorrectInputs.ElementAt(y) == filteredCurrentInputs.ElementAt(y));
                // Count the number of correct positions for that correct color.
                // If both are not -1 and they are equal in value, add 1 for that occurance.
                // Compacted from a for loop
                correctColorOnly = Mathf.Min(filteredWrongIdxes.Count(a => filteredCurrentInputs.ElementAt(a) == x),
                                             filteredCorrectInputs.Count(a => a != -1) - correctInOnePos);
                // Count the number of correct colors in the wrong positions.
                // This is done by counting the number of colors in their wrong positions, and then capping it based on how many correct colors there should be, minus how many that are actually in the correct positions.
                correctColors       += correctColorOnly;
                correctPosandColors += correctInOnePos;
                //Debug.LogFormat("{0},{1}", correctInOnePos, correctColorOnly);
            }


            // Display the result of this query
            correctBothDisplay.text  = correctPosandColors.ToString();
            correctColorDisplay.text = correctColors.ToString();
            queryLeftDisplay.text    = queriesLeft.ToString();
            allQueries.Add(currentInputs.ToArray());
            queryCorrectColorAndPos.Add(correctPosandColors);
            queryCorrectColorNotPos.Add(correctColors);

            QuickLog(string.Format("Query: [{0}]. Result: {1} correct color(s) in correct position, {2} correct color(s) not in correct position.",
                                   currentInputs.Select(a => colorblindLetters[a]).Join(), correctPosandColors, correctColors));

            if (currentInputs.SequenceEqual(correctInputs))
            {
                QuickLog(string.Format("FOUR HITS! Module disarmed."));
                StartCoroutine(RevealCorrectAnim());
                audioKM.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                modSelf.HandlePass();
                interactable = false;
            }
            else if (queriesLeft <= 0)
            {
                interactable = false;
                QuickLog(string.Format("You've ran out of queries to get the correct answer. Strike! The module will now reveal correct answer and then reset."));
                StartCoroutine(HandleQueryExhaustAnim());
            }
        }
    }
Beispiel #2
0
    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;
        }
    }
Beispiel #3
0
    protected void ChangeState(State state)
    {
        if (!gameObject.activeInHierarchy)
        {
            return;
        }

        StopAllCoroutines();
        currentState = state;

        switch (currentState)
        {
        case State.Idle:
        {
            currentQuery[0] = '_';
            currentQuery[1] = '_';
            UpdateDisplay();
        }
        break;

        case State.Working:
        {
            UpdateDisplay();
            StartCoroutine(DelayedStateChangeCoroutine(TimeWorking, State.ShowingResult));
        }
        break;

        case State.ShowingResult:
        {
            string currentQueryString = GetCurrentQueryString();

            if (queryResponses.ContainsKey(currentQueryString))
            {
                lastResult = queryResponses[currentQueryString];
            }

            UpdateDisplay();
            StartCoroutine(DelayedStateChangeCoroutine(TimeShowingResult, State.Idle));
        }
        break;

        case State.ShowingError:
        {
            UpdateDisplay();
            StartCoroutine(FlashErrorCoroutine(ERROR_STRING));
        }
        break;

        case State.SubmittingResult:
        {
            KMAudio.PlaySoundAtTransform("processing", transform);
            UpdateDisplay();

            if (CalculateCorrectSubmission().Equals(GetCurrentQueryString()))
            {
                StartCoroutine(DelayedStateChangeCoroutine(TimeSubmitting, State.Complete));
            }
            else
            {
                StartCoroutine(DelayedStateChangeCoroutine(TimeSubmitting, State.IncorrectSubmission));
            }
        }
        break;

        case State.IncorrectSubmission:
        {
            HandleError();
        }
        break;

        case State.Complete:
        {
            Debug.LogFormat("[Two Bits #{0}] Module solved", _moduleId);
            module.HandlePass();
            UpdateDisplay();
        }
        break;
        }
    }
Beispiel #4
0
    IEnumerator TheCorrect()
    {
        string Analysis = TextBox.text;

        TextBox.text = "";
        Debug.LogFormat("[Customer Identification #{0}] Text that was submitted: {1}", moduleId, Analysis);
        if (Analysis == SeedPacketIdentifier[Unique[Stages]].name)
        {
            Stages++;
            Playable  = false;
            Enterable = false;
            if (Stages == 3)
            {
                Animating1 = true;
                Debug.LogFormat("[Customer Identification #{0}] You solved the module three times in a row. GG!", moduleId);
                SecondMusic.clip = NotBuffer[8];
                SecondMusic.Play();
                StartCoroutine(RoulleteToWin());
                while (SecondMusic.isPlaying)
                {
                    LightBulbs[0].material = TheLights[0];
                    LightBulbs[1].material = TheLights[0];
                    LightBulbs[2].material = TheLights[1];
                    yield return(new WaitForSecondsRealtime(0.02f));

                    LightBulbs[0].material = TheLights[0];
                    LightBulbs[1].material = TheLights[1];
                    LightBulbs[2].material = TheLights[0];
                    yield return(new WaitForSecondsRealtime(0.02f));

                    LightBulbs[0].material = TheLights[1];
                    LightBulbs[1].material = TheLights[0];
                    LightBulbs[2].material = TheLights[0];
                    yield return(new WaitForSecondsRealtime(0.02f));
                }
                LightBulbs[0].material = TheLights[1];
                LightBulbs[1].material = TheLights[1];
                LightBulbs[2].material = TheLights[1];
                Debug.LogFormat("[Customer Identification #{0}] The module is done.", moduleId);
                Module.HandlePass();
                Animating1 = false;
            }

            else
            {
                Debug.LogFormat("[Customer Identification #{0}] The text matches the name of the customer. Good job!", moduleId);
                Animating1           = true;
                AnotherShower.sprite = SeedPacketIdentifier[Unique[Stages - 1]];
                int Decider = UnityEngine.Random.Range(0, 2); if (Decider == 1)
                {
                    SecondMusic.clip = NotBuffer[2];
                }
                else
                {
                    SecondMusic.clip = NotBuffer[4];
                }
                SecondMusic.Play();
                while (SecondMusic.isPlaying)
                {
                    yield return(new WaitForSecondsRealtime(0.075f));
                }
                LightBulbs[Stages - 1].material = TheLights[1];
                SeedPacket.sprite = DefaultSprite;
                Playable          = true;
                Toggleable        = true;
                Animating1        = false;
            }
        }

        else
        {
            Debug.LogFormat("[Customer Identification #{0}] The text does not match the name of the customer. Oh no!", moduleId);
            Animating1       = true;
            SecondMusic.clip = NotBuffer[5 + UnityEngine.Random.Range(0, 3)];
            SecondMusic.Play();
            Enterable = false;
            LightBulbs[0].material = TheLights[2];
            LightBulbs[1].material = TheLights[2];
            LightBulbs[2].material = TheLights[2];
            Debug.LogFormat("[Customer Identification #{0}] You died!", moduleId);
            while (SecondMusic.isPlaying)
            {
                yield return(new WaitForSecondsRealtime(0.075f));
            }
            SeedPacket.sprite      = DefaultSprite;
            LightBulbs[0].material = TheLights[0];
            LightBulbs[1].material = TheLights[0];
            LightBulbs[2].material = TheLights[0];
            Playable   = true;
            Toggleable = true;
            Animating1 = false;
            Stages     = 0;
            Module.HandleStrike();
            Debug.LogFormat("[Customer Identification #{0}] The module resetted and striked as a cost for giving an incorrect answer.", moduleId);
            UniquePlay();
        }
    }
Beispiel #5
0
    void Press(int duckPart)
    {
        switch (correctApproach)
        {
        case 0:
            switch (iDidntPlanThisThroughSoICantNameThisVariableItemSelectedSadface)
            {
            case 0:
                duckPartSequence = new int[3] {
                    5, 6, 3
                };
                break;

            case 4:
                duckPartSequence = new int[1] {
                    4
                };
                break;

            default:
                duckPartSequence = new int[3] {
                    3, 5, 2
                };
                break;
            }
            break;

        case 1:
            switch (iDidntPlanThisThroughSoICantNameThisVariableItemSelectedSadface)
            {
            case 0:
                duckPartSequence = new int[3] {
                    4, 3, 1
                };
                break;

            default:
                duckPartSequence = new int[3] {
                    0, 5, 6
                };
                break;
            }
            break;

        case 2:
            duckPartSequence = new int[6] {
                1, 0, 2, 6, 5, 3
            };
            break;

        case 3:
            duckPartSequence = new int[1] {
                2
            };
            break;

        case 4:
            switch (iDidntPlanThisThroughSoICantNameThisVariableItemSelectedSadface)
            {
            case 0:
                duckPartSequence = new int[4] {
                    3, 2, 1, 5
                };
                break;

            default:
                duckPartSequence = new int[1] {
                    0
                };
                break;
            }
            break;

        default:
            duckPartSequence = new int[1] {
                1
            };
            break;
        }

        Debug.LogFormat("[The Cruel Duck #{0}] You should now press the duck's {1}.", _moduleId, possibleParts[duckPartSequence[duckPartIndex]]);

        if (duckPart != duckPartSequence[duckPartIndex])
        {
            Module.HandleStrike();
            Debug.LogFormat("[The Cruel Duck #{0}] You pressed {1}. Strike.", _moduleId, possibleParts[duckPart]);
            Init();
        }

        else if (correctApproach == 0 && iDidntPlanThisThroughSoICantNameThisVariableItemSelectedSadface == 0 && duckPartIndex == 1 && !Bomb.GetFormattedTime().Contains('5'))
        {
            Module.HandleStrike();
            Debug.LogFormat("[The Cruel Duck #{0}] You were supposed to press the right foot when there was a 5 in the timer!", _moduleId, possibleParts[duckPart]);
            Init();
        }

        else if (correctApproach == 0 && iDidntPlanThisThroughSoICantNameThisVariableItemSelectedSadface == 4 && (int)Bomb.GetTime() % 10 + ((int)(Bomb.GetTime() % 60 / 10)) != 7)
        {
            Module.HandleStrike();
            Debug.LogFormat("[The Cruel Duck #{0}] You were supposed to press the eye when the seconds digits added up to 7!", _moduleId, possibleParts[duckPart]);
            Init();
        }

        else if (correctApproach == 1 && iDidntPlanThisThroughSoICantNameThisVariableItemSelectedSadface == 3 && duckPartIndex == 1 && (int)Bomb.GetTime() % 10 + ((int)(Bomb.GetTime() % 60 / 10)) != 6)
        {
            Module.HandleStrike();
            Debug.LogFormat("[The Cruel Duck #{0}] You were supposed to press the tail when the seconds digits added up to 6!", _moduleId, possibleParts[duckPart]);
            Init();
        }

        else if (correctApproach == 2 && duckPartIndex == 0 && Bomb.GetSolvedModuleNames().Count() % 2 == 1)
        {
            Module.HandleStrike();
            Debug.LogFormat("[The Cruel Duck #{0}] You were supposed to press the afro when there were an even number of solves!", _moduleId, possibleParts[duckPart]);
            Init();
        }

        else if (Random.Range(0, duckPartSequence.Length) != 0 && duckPartIndex != duckPartSequence.Length - 1)
        {
            Audio.PlaySoundAtTransform("quack", Module.transform);
            Debug.LogFormat("[The Cruel Duck #{0}] Quack.", _moduleId);
            duckPartIndex++;
        }
        else
        {
            Module.HandlePass();
            Audio.PlaySoundAtTransform("cruelSolveSound", Module.transform);
            solved = true;
            Debug.LogFormat("[The Cruel Duck #{0}] That was correct! Module solved.", _moduleId);
            surface.material = open[3];

            for (int i = 0; i < 7; i++)
            {
                duckParts[i].gameObject.SetActive(false);
                duckParts[i].enabled = false;
            }
        }
    }
    void Awake()
    {
        moduleId = moduleIdCounter++;
        foreach (KMSelectable button in buttons)
        {
            button.OnInteract += delegate() { ButtonPress(button); return(false); }
        }
        ;
        isCorasComputer = Environment.MachineName == "CREAMMACHINE";
        Debug.LogFormat("<Symbolic Tasha #{0}> System name is {1}.", moduleId, Environment.MachineName);
        colorblindText.gameObject.SetActive(GetComponent <KMColorblindMode>().ColorblindModeActive);
    }

    void Start()
    {
        float scalar = transform.lossyScale.x;

        for (int i = 0; i < 4; i++)
        {
            lights[i].range  *= scalar;
            lights[i].enabled = false;
        }
        buttonColors = buttonColors.Shuffle().ToArray();
        var letters = "IGYB".Select(x => x.ToString()).ToArray();

        colorblindText.text = string.Format("  {0}  \n{1}    {2}\n  {3}  ", letters[(int)buttonColors[0]], letters[(int)buttonColors[3]], letters[(int)buttonColors[1]], letters[(int)buttonColors[2]]);
        soundNames          = soundNames.Shuffle().ToArray();
        for (int i = 0; i < 4; i++)
        {
            btnRenderers[i].material.color = materialColors[(int)buttonColors[i]];
            lights[i].color   = materialColors[(int)buttonColors[i]];
            presentSymbols[i] = (stSymbol)rnd.Range(1, 19);
            buttonSymbols[i].material.mainTexture = symbols[(int)presentSymbols[i] - 1];
            Debug.LogFormat("[Symbolic Tasha #{0}] The {1} button is {2}, with the symbol titled '{3}'.", moduleId, positionNames[i], buttonColors[i], presentSymbols[i]);
        }
        string[] ordinals = new string[5] {
            "First", "Second", "Third", "Fourth", "Fifth"
        };
        for (int i = 0; i < 5; i++)
        {
            flashing[i] = rnd.Range(0, 4);
        }
        Debug.LogFormat("[Symbolic Tasha #{0}] Flashing Colors: {1}: {2} | {3}: {4} | {5}: {6} | {7}: {8} | {9}: {10}", moduleId, ordinals[0], buttonColors[flashing[0]], ordinals[1], buttonColors[flashing[1]], ordinals[2], buttonColors[flashing[2]], ordinals[3], buttonColors[flashing[3]], ordinals[4], buttonColors[flashing[4]]);
        solution.Add(CalculateStage());
        Debug.LogFormat("[Symbolic Tasha #{0}] The first color to press is {1}.", moduleId, solution[0]);
        sequenceFlashing = StartCoroutine(SequenceFlash());
    }

    void ButtonPress(KMSelectable button)
    {
        anyBtnPressed = true;
        var ix = Array.IndexOf(buttons, button);

        button.AddInteractionPunch(2);
        audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, button.transform);
        audio.PlaySoundAtTransform(soundNames[ix], button.transform);
        if (!cracked[ix])
        {
            cracked[ix]        = true;
            presentSymbols[ix] = (stSymbol)(-(int)presentSymbols[ix]);
            btnRenderers[ix].material.mainTexture = crackedTexture;
            buttonSymbols[ix].gameObject.SetActive(false);
            if (!isCorasComputer)
            {
                audio.PlaySoundAtTransform("shatter" + rnd.Range(1, 5), button.transform);
            }
            if (!moduleSolved)
            {
                Debug.LogFormat("[Symbolic Tasha #{0}] The {1} button cracked!", moduleId, buttonColors[ix]);
            }
        }
        if (moduleSolved)
        {
            return;
        }
        if (enteringStage == 0)
        {
            StopCoroutine(sequenceFlashing);
            foreach (Light l in lights)
            {
                l.enabled = false;
            }
        }
        StartCoroutine(SingleFlash(ix));
        if (waiting != null)
        {
            StopCoroutine(waiting);
            waiting = null;
        }
        waiting = StartCoroutine(Wait());
        if (buttonColors[ix] != solution[enteringStage])
        {
            enteringStage = 0;
            Debug.LogFormat("[Symbolic Tasha #{0}] You pressed the {1} button. That was incorrect. Strike!", moduleId, buttonColors[ix]);
            if (waiting != null)
            {
                StopCoroutine(waiting);
                waiting = null;
            }
            module.HandleStrike();
            StopCoroutine(sequenceFlashing);
            sequenceFlashing = StartCoroutine(SequenceFlash());
        }
        else
        {
            enteringStage++;
        }
        if (enteringStage > stage)
        {
            enteringStage = 0;
            if (waiting != null)
            {
                StopCoroutine(waiting);
                waiting = null;
            }
            AdvanceStage();
        }
    }

    void AdvanceStage()
    {
        stage++;
        if (bomb.GetStrikes() >= 2 && !trueConditions[0])
        {
            trueConditions[0] = true;
            Debug.LogFormat("[Symbolic Tasha #{0}] The number of strikes has reached 2 or more. The first condition is now true.", moduleId);
        }
        if (cracked.Count(b => b) >= 2 && !trueConditions[1])
        {
            trueConditions[1] = true;
            Debug.LogFormat("[Symbolic Tasha #{0}] The number of cracked buttons has reached 2 or more. The second condition is now true.", moduleId);
        }
        if (bomb.GetPortPlates().Any(x => x.Length == 0))
        {
            trueConditions[2] = true;
        }
        currentTable = Array.IndexOf(trueConditions, true);
        if (stage == 5)
        {
            module.HandlePass();
            moduleSolved = true;
            if (waiting != null)
            {
                StopCoroutine(waiting);
            }
            StopCoroutine(sequenceFlashing);
            foreach (Light l in lights)
            {
                l.enabled = false;
            }
            Debug.LogFormat("[Symbolic Tasha #{0}] Module solved!", moduleId);
        }
        else
        {
            solution.Add(CalculateStage());
            sequenceFlashing = StartCoroutine(SequenceFlash());
            var colorName            = solution[stage].ToString();
            var capitalizedColorName = colorName[0].ToString().ToUpperInvariant() + colorName.Substring(1);
            Debug.LogFormat("[Symbolic Tasha #{0}] {1} was added to the sequence of colors to press.", moduleId, capitalizedColorName);
        }
    }

    IEnumerator SingleFlash(int ix)
    {
        flashingButtons[ix] = true;
        lights[ix].enabled  = true;
        yield return(new WaitForSeconds(.5f));

        lights[ix].enabled  = false;
        flashingButtons[ix] = false;
    }

    IEnumerator SequenceFlash()
    {
        while (flashingButtons.Contains(true))
        {
            yield return(null);
        }
        yield return(new WaitForSeconds(1.75f));

sequenceReset:
        for (int i = 0; i <= stage; i++)
        {
            int ix = flashing[i];
            lights[ix].enabled = true;
            if (anyBtnPressed)
            {
                audio.PlaySoundAtTransform(soundNames[ix], buttons[ix].transform);
            }
            yield return(new WaitForSeconds(.8f));

            lights[ix].enabled = false;
            yield return(new WaitForSeconds(.4f));
        }
        yield return(new WaitForSeconds(3.5f));

        goto sequenceReset;
    }

    IEnumerator Wait()
    {
        yield return(new WaitForSeconds(7f));

        enteringStage    = 0;
        sequenceFlashing = StartCoroutine(SequenceFlash());
    }

    stColor CalculateStage()
    {
        Debug.LogFormat("[Symbolic Tasha #{0}] Rule being applied for Stage {1}: {2} ", moduleId, stage + 1, rules[currentTable]);
        stSymbol usingSymbol = presentSymbols[flashing[stage]];

        for (int i = 0; i < 12; i++)
        {
            if (Tables.symbolColumns[currentTable][i].Contains(usingSymbol))
            {
                return(Tables.colorRows[currentTable][Array.IndexOf(trueColors, buttonColors[flashing[stage]])][i]);
            }
        }
        return(stColor.pink);
    }
Beispiel #7
0
    void Awake()
    {
        moduleId = moduleIdCounter++;
        boxingGlove.OnInteract   += delegate() { PressBoxingGlove(); return(false); };
        hireButton.OnInteract    += delegate() { Hire(); return(false); };
        abstainButton.OnInteract += delegate() { Abstain(); return(false); };
        foreach (KMSelectable arrowButton in arrowButtons)
        {
            arrowButton.OnInteract += delegate() { PressArrowButton(arrowButton); return(false); }
        }
        ;
        GetComponent <KMBombModule>().OnActivate += OnActivate;
    }

    void Start()
    {
        contestantStrengths = Enumerable.Range(0, 5).ToList().Shuffle().ToArray();
        contestantIndices   = Enumerable.Range(0, 25).ToList().Shuffle().Take(5).ToArray();
        var ordinals = new string[5] {
            "1st", "2nd", "3rd", "4th", "5th"
        };
        var count = 0;

        for (int i = 0; i < 5; i++)
        {
            lastNameIndices[i]           = rnd.Range(0, possibleLastNames.Length);
            substituteIndices[i]         = rnd.Range(0, possibleSubstituteNames.Length);
            substituteLastNameIndices[i] = rnd.Range(0, possibleLastNames.Length);
            var value1         = contestantStrengths[contestantIndices[i] / 5];
            var value2         = contestantStrengths[contestantIndices[i] % 5];
            var contestantChar = alphabet[5 * value1 + value2];
            var letterPresent  = possibleNames[contestantIndices[i]].ToUpperInvariant().Contains(contestantChar) || possibleLastNames[lastNameIndices[i]].ToUpperInvariant().Contains(contestantChar) || possibleSubstituteNames[substituteIndices[i]].ToUpperInvariant().Contains(contestantChar) || possibleLastNames[substituteLastNameIndices[i]].ToUpperInvariant().Contains(contestantChar);
            if (letterPresent)
            {
                count += 1 << (4 - i);
            }
            Debug.LogFormat("[Boxing #{0}] The {1} contestant is {2} {3}, with punch strength {4}, and his substitute is {5} {6}. His base 5 pair forms the letter {7}, which is{8} present on the page.", moduleId, ordinals[i], possibleNames[contestantIndices[i]], possibleLastNames[lastNameIndices[i]], contestantStrengths[i], possibleSubstituteNames[substituteIndices[i]], possibleLastNames[substituteLastNameIndices[i]], contestantChar, letterPresent ? "" : " not");
        }
        var unmodifiedCount = count;

        count %= 6;
        Debug.LogFormat("[Boxing #{0}] The final number is {1}, modulo 6 is {2}.", moduleId, unmodifiedCount, count % 6);
        switch (count)
        {
        case 5:
            solution = 10;
            Debug.LogFormat("[Boxing #{0}] Every contestant is on steroids. Abstain from participating.", moduleId);
            break;

        case 4:
            solution = Array.IndexOf(contestantStrengths, 0);
            Debug.LogFormat("[Boxing #{0}] The strongest contestant not on steroids is {1}.", moduleId, possibleNames[contestantIndices[solution]]);
            break;

        case 3:
            solution = Array.IndexOf(contestantStrengths, 1);
            Debug.LogFormat("[Boxing #{0}] The strongest contestant not on steroids is {1}.", moduleId, possibleNames[contestantIndices[solution]]);
            break;

        case 2:
            solution = Array.IndexOf(contestantStrengths, 2);
            Debug.LogFormat("[Boxing #{0}] The strongest contestant not on steroids is {1}.", moduleId, possibleNames[contestantIndices[solution]]);
            break;

        case 1:
            solution = Array.IndexOf(contestantStrengths, 3);
            Debug.LogFormat("[Boxing #{0}] The strongest contestant not on steroids is {1}.", moduleId, possibleNames[contestantIndices[solution]]);
            break;

        default:
            solution = Array.IndexOf(contestantStrengths, 4);
            Debug.LogFormat("[Boxing #{0}] The strongest contestant not on steroids is {1}.", moduleId, possibleNames[contestantIndices[solution]]);
            break;
        }
        screenTexts[0].text = "";
        screenTexts[1].text = "";
        screenTexts[2].text = "";
        screenTexts[3].text = "";
    }

    void OnActivate()
    {
        var oldMessages = new string[4] {
            screenTexts[0].text, screenTexts[1].text, screenTexts[2].text, screenTexts[3].text
        };
        var newMessages = new string[4] {
            possibleNames[contestantIndices[chosenContestant]], possibleLastNames[lastNameIndices[chosenContestant]], possibleSubstituteNames[substituteIndices[chosenContestant]], possibleLastNames[substituteLastNameIndices[chosenContestant]]
        };

        for (int i = 0; i < 4; i++)
        {
            StartCoroutine(CycleText(screenTexts[i], oldMessages[i], newMessages[i]));
        }
    }

    void PressBoxingGlove()
    {
        if (moduleSolved)
        {
            return;
        }
        boxingGlove.AddInteractionPunch(strengths[contestantStrengths[chosenContestant]]);
        audio.PlaySoundAtTransform("punch" + rnd.Range(0, 6).ToString(), boxingGlove.transform);
    }

    void PressArrowButton(KMSelectable button)
    {
        audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, button.transform);
        button.AddInteractionPunch(.5f);
        if (moduleSolved)
        {
            return;
        }
        var offsets = new int[2] {
            -1, 1
        };
        var ix = Array.IndexOf(arrowButtons, button);

        if (!(chosenContestant == 0 && ix == 0) && !(chosenContestant == 4 && ix == 1))
        {
            chosenContestant += offsets[ix];
            StopAllCoroutines();
            var oldMessages = new string[4] {
                screenTexts[0].text, screenTexts[1].text, screenTexts[2].text, screenTexts[3].text
            };
            var newMessages = new string[4] {
                possibleNames[contestantIndices[chosenContestant]], possibleLastNames[lastNameIndices[chosenContestant]], possibleSubstituteNames[substituteIndices[chosenContestant]], possibleLastNames[substituteLastNameIndices[chosenContestant]]
            };
            for (int i = 0; i < 4; i++)
            {
                StartCoroutine(CycleText(screenTexts[i], oldMessages[i], newMessages[i]));
            }
        }
        else
        {
            audio.PlaySoundAtTransform("error", button.transform);
        }
    }

    void Hire()
    {
        audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, hireButton.transform);
        hireButton.AddInteractionPunch(.75f);
        if (moduleSolved)
        {
            return;
        }
        if (chosenContestant == solution)
        {
            module.HandlePass();
            Debug.LogFormat("[Boxing #{0}] You submitted {1}. That is correct. Module solved!", moduleId, possibleNames[contestantIndices[chosenContestant]]);
            moduleSolved = true;
            var oldMessages = new string[4] {
                screenTexts[0].text, screenTexts[1].text, screenTexts[2].text, screenTexts[3].text
            };
            var newMessages = new string[4] {
                "Ready", "for", "the", "match!"
            };
            for (int i = 0; i < 4; i++)
            {
                StartCoroutine(CycleText(screenTexts[i], oldMessages[i], newMessages[i]));
            }
            audio.PlaySoundAtTransform("bell", hireButton.transform);
        }
        else
        {
            module.HandleStrike();
            Debug.LogFormat("[Boxing #{0}] You submitted {1}. That is incorrect. Strike!", moduleId, possibleNames[contestantIndices[chosenContestant]]);
            audio.PlaySoundAtTransform("strike", hireButton.transform);
        }
    }

    void Abstain()
    {
        audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, abstainButton.transform);
        abstainButton.AddInteractionPunch(.75f);
        if (moduleSolved)
        {
            return;
        }
        if (solution == 10)
        {
            module.HandlePass();
            Debug.LogFormat("[Boxing #{0}] You abstained from participating. That is correct. Module solved!", moduleId);
            audio.PlaySoundAtTransform("abstain", abstainButton.transform);
            moduleSolved = true;
            var oldMessages = new string[4] {
                screenTexts[0].text, screenTexts[1].text, screenTexts[2].text, screenTexts[3].text
            };
            var newMessages = new string[4] {
                "No", "contest", "this", "time..."
            };
            for (int i = 0; i < 4; i++)
            {
                StartCoroutine(CycleText(screenTexts[i], oldMessages[i], newMessages[i]));
            }
        }
        else
        {
            module.HandleStrike();
            Debug.LogFormat("[Boxing #{0}] You abstained from participating. That is incorrect. Strike!", moduleId);
            audio.PlaySoundAtTransform("strike", abstainButton.transform);
        }
    }

    IEnumerator CycleText(TextMesh display, string oldMessage, string newMessage)
    {
        var currentMessage = oldMessage;
        var messageLength  = currentMessage.Length;

        for (int i = 0; i < messageLength; i++)
        {
            currentMessage = currentMessage.Remove(currentMessage.Length - 1);
            display.text   = currentMessage;
            audio.PlaySoundAtTransform("beep", display.transform);
            yield return(new WaitForSeconds(.05f));
        }
        currentMessage = "";
        if (!moduleSolved)
        {
            display.color = Color.white; //sss
        }
        else
        {
            display.color = solveColor;
        }
        for (int i = 0; i < newMessage.Length; i++)
        {
            currentMessage = currentMessage + newMessage[i];
            display.text   = currentMessage;
            audio.PlaySoundAtTransform("beep", display.transform);
            yield return(new WaitForSeconds(.05f));
        }
    }
Beispiel #8
0
    IEnumerator Starlighting()
    {
        bool Mistake = false;

        for (int x = 0; x < 10; x++)
        {
            if (SiphoneAnswer[x] != Siphone[x])
            {
                Mistake = true;
                break;
            }
        }
        Audio.PlaySoundAtTransform(StarMusical[6].name, transform);

        Stars[0].material = Colors[2];
        yield return(new WaitForSecondsRealtime(0.74f));

        Stars[1].material = Colors[2];
        yield return(new WaitForSecondsRealtime(0.74f));

        Stars[2].material = Colors[2];
        yield return(new WaitForSecondsRealtime(0.74f));

        Stars[3].material = Colors[2];
        yield return(new WaitForSecondsRealtime(0.74f));

        Stars[4].material = Colors[2];
        yield return(new WaitForSecondsRealtime(0.94f));

        for (int x = 0; x < Stars.Count(); x++)
        {
            Stars[x].material = Colors[4];
        }
        yield return(new WaitForSecondsRealtime(0.81f));

        for (int a = 0; a < Stars.Count(); a++)
        {
            Stars[a].material = Colors[2];
        }
        yield return(new WaitForSecondsRealtime(1.9f));

        Stars[0].material = Colors[3];
        yield return(new WaitForSecondsRealtime(0.74f));

        Stars[1].material = Colors[3];
        yield return(new WaitForSecondsRealtime(0.74f));

        Stars[2].material = Colors[3];
        yield return(new WaitForSecondsRealtime(0.74f));

        Stars[3].material = Colors[3];
        yield return(new WaitForSecondsRealtime(0.74f));

        Stars[4].material = Colors[3];
        yield return(new WaitForSecondsRealtime(0.96f));

        for (int x = 0; x < Stars.Count(); x++)
        {
            Stars[x].material = Colors[4];
        }
        yield return(new WaitForSecondsRealtime(0.82f));

        for (int a = 0; a < Stars.Count(); a++)
        {
            Stars[a].material = Colors[3];
        }
        yield return(new WaitForSecondsRealtime(1.7f));

        if (Mistake == true)
        {
            Debug.LogFormat("[Stars #{0}] The sequence given is incorrect. A strike was given.", moduleId);
            Module.HandleStrike();
            for (int x = 0; x < 10; x++)
            {
                SiphoneAnswer[x] = 0;
            }
            Default = 0;
            for (int x = 0; x < Stars.Count(); x++)
            {
                Stars[x].material = Colors[0];
            }
            yield return(new WaitForSecondsRealtime(0.6f));

            for (int x = 0; x < Stars.Count(); x++)
            {
                Stars[x].material = Colors[3];
            }
        }

        else
        {
            Debug.LogFormat("[Stars #{0}] The sequence given is correct. Module solved.", moduleId);
            Module.HandlePass();
            Audio.PlaySoundAtTransform(StarMusical[7].name, transform);
            ModuleSolved = true;
            Number.text  = "";
            for (int x = 0; x < Stars.Count(); x++)
            {
                Stars[x].material = Colors[1];
                yield return(new WaitForSecondsRealtime(0.2f));
            }
        }

        Animating = false;
    }
Beispiel #9
0
    IEnumerator Starlighting()
    {
        bool Mistake = false;

        if (InputtedString != FinalSolutionString)
        {
            Mistake = true;
        }
        Audio.PlaySoundAtTransform(StarMusical[6].name, transform);


        //Yellow flashes
        Stars[0].material = Colors[2];
        yield return(new WaitForSecondsRealtime(1.05f));

        Stars[1].material = Colors[2];
        yield return(new WaitForSecondsRealtime(1.05f));

        Stars[2].material = Colors[2];
        yield return(new WaitForSecondsRealtime(1.05f));

        Stars[3].material = Colors[2];
        yield return(new WaitForSecondsRealtime(1.05f));

        Stars[4].material = Colors[2];
        yield return(new WaitForSecondsRealtime(1.05f));

        for (int x = 0; x < Stars.Count(); x++)
        {
            Stars[x].material = Colors[4];
        }
        yield return(new WaitForSecondsRealtime(1f));

        for (int a = 0; a < Stars.Count(); a++)
        {
            Stars[a].material = Colors[4];
        }

        //Fast red flashes
        Stars[0].material = Colors[0];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[1].material = Colors[0];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[2].material = Colors[0];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[3].material = Colors[0];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[4].material = Colors[0];
        yield return(new WaitForSecondsRealtime(0.05f));

        //Fast white flashes
        Stars[0].material = Colors[4];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[1].material = Colors[4];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[2].material = Colors[4];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[3].material = Colors[4];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[4].material = Colors[4];
        yield return(new WaitForSecondsRealtime(0.05f));

        //Fast red flashes
        Stars[0].material = Colors[0];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[1].material = Colors[0];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[2].material = Colors[0];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[3].material = Colors[0];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[4].material = Colors[0];
        yield return(new WaitForSecondsRealtime(0.05f));

        //Fast white flashes
        Stars[0].material = Colors[4];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[1].material = Colors[4];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[2].material = Colors[4];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[3].material = Colors[4];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[4].material = Colors[4];
        yield return(new WaitForSecondsRealtime(0.05f));

        //Fast red flashes
        Stars[0].material = Colors[0];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[1].material = Colors[0];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[2].material = Colors[0];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[3].material = Colors[0];
        yield return(new WaitForSecondsRealtime(0.05f));

        Stars[4].material = Colors[0];
        yield return(new WaitForSecondsRealtime(0.05f));


        yield return(new WaitForSecondsRealtime(0.03f));

        for (int x = 0; x < Stars.Count(); x++)
        {
            Stars[x].material = Colors[4];
        }
        yield return(new WaitForSecondsRealtime(0.03f));

        for (int a = 0; a < Stars.Count(); a++)
        {
            Stars[a].material = Colors[0];
        }

        yield return(new WaitForSecondsRealtime(0.03f));

        for (int x = 0; x < Stars.Count(); x++)
        {
            Stars[x].material = Colors[4];
        }
        yield return(new WaitForSecondsRealtime(0.03f));

        for (int a = 0; a < Stars.Count(); a++)
        {
            Stars[a].material = Colors[0];
        }

        yield return(new WaitForSecondsRealtime(0.03f));

        for (int x = 0; x < Stars.Count(); x++)
        {
            Stars[x].material = Colors[4];
        }
        yield return(new WaitForSecondsRealtime(0.03f));

        for (int a = 0; a < Stars.Count(); a++)
        {
            Stars[a].material = Colors[0];
        }

        yield return(new WaitForSecondsRealtime(0.03f));

        for (int x = 0; x < Stars.Count(); x++)
        {
            Stars[x].material = Colors[4];
        }



        yield return(new WaitForSecondsRealtime(0.65f));

        Stars[0].material = Colors[3];
        yield return(new WaitForSecondsRealtime(1.04f));

        Stars[1].material = Colors[3];
        yield return(new WaitForSecondsRealtime(1.04f));

        Stars[2].material = Colors[3];
        yield return(new WaitForSecondsRealtime(1.04f));

        Stars[3].material = Colors[3];
        yield return(new WaitForSecondsRealtime(1.04f));

        Stars[4].material = Colors[3];
        yield return(new WaitForSecondsRealtime(1.04f));

        for (int x = 0; x < Stars.Count(); x++)
        {
            Stars[x].material = Colors[4];
        }
        yield return(new WaitForSecondsRealtime(0.90f));

        for (int a = 0; a < Stars.Count(); a++)
        {
            Stars[a].material = Colors[3];
        }
        yield return(new WaitForSecondsRealtime(1.7f));

        if (Mistake == true)
        {
            Debug.LogFormat("[Cruel Stars #{0}] The sequence given is incorrect. A strike was given.", moduleId);
            Module.HandleStrike();

            InputtedString = "";
            for (int x = 0; x < Stars.Count(); x++)
            {
                Stars[x].material = Colors[0];
            }
            yield return(new WaitForSecondsRealtime(0.6f));

            for (int x = 0; x < Stars.Count(); x++)
            {
                Stars[x].material = Colors[3];
            }

            for (int i = 0; i < 5; i++)
            {
                Stars[i].material = OrderColors[ColorsOfButtons[i]];
            }
        }

        else
        {
            Debug.LogFormat("[Cruel Stars #{0}] The sequence given is correct. Module solved.", moduleId);
            Module.HandlePass();
            Audio.PlaySoundAtTransform(StarMusical[7].name, transform);
            ModuleSolved = true;
            Number.text  = "";
            for (int x = 0; x < Stars.Count(); x++)
            {
                Stars[x].material = Colors[1];
                yield return(new WaitForSecondsRealtime(0.2f));
            }
        }

        Animating = false;
    }
    private IEnumerator Advance()
    {
        if (!moduleSolved[modInstance])
        {
            Debug.LogFormat("[Macro Memory #{0}] Button {1} in position {2} on module {3} pressed. {4}.", moduleID, push[0] + 1, push[2] + 1, moduleIDCounter - push[1], pass ? "Correct" : "Incorrect");
        }
        if (modInstance == selectedmod[1])
        {
            labels[0].text = string.Empty;
            if (pass)
            {
                presses.Add(push);
                leds[stage[modInstance]].material = onoff[1];
                stage[modInstance]++;
                if (stage[modInstance] > 4)
                {
                    moduleSolved[modInstance] = true;
                    Debug.LogFormat("[Macro Memory #{0}] Module solved.", moduleID);
                    if (!tpon)
                    {
                        module.HandlePass();
                    }
                }
                else
                {
                    Debug.LogFormat("[Macro Memory #{0}] Advancing to stage {1}.", moduleID, stage[modInstance] + 1);
                }
            }
            else
            {
                module.HandleStrike();
                presses.Clear();
            }
        }
        else if (pass && !moduleSolved[modInstance])
        {
            if (stage[selectedmod[1]] > 4)
            {
                Debug.LogFormat("[Macro Memory #{0}] Module {1} solved.", moduleID, moduleIDCounter - selectedmod[1]);
            }
            else
            {
                Debug.LogFormat("[Macro Memory #{0}] Module {2} advances to stage {1}.", moduleID, stage[selectedmod[1]] + 1, moduleIDCounter - selectedmod[1]);
            }
        }
        for (int i = 0; i < 4; i++)
        {
            yield return(new WaitForSeconds(0.1f));

            buttonobjs[i].transform.localPosition -= new Vector3(0, 0.03f, 0);
        }
        if (moduleSolved.Any(x => x == false))
        {
            if (!pass && !moduleSolved[modInstance])
            {
                leds[stage[modInstance]].material = onoff[1];
                stage[modInstance] = 0;
            }
            if (modInstance == selectedmod[1])
            {
                if (!moduleSolved[modInstance])
                {
                    leds[stage[modInstance]].material = onoff[0];
                }
                values         = values.Shuffle();
                selectedmod[1] = Random.Range(0, selectedmod[0]);
                rule           = Random.Range(0, 9);
                while (moduleSolved[selectedmod[1]])
                {
                    selectedmod[1] = Random.Range(0, selectedmod[0]);
                }
                next = true;
            }
            if (!pass && !moduleSolved[modInstance])
            {
                leds[stage[modInstance]].material = onoff[0];
                Debug.LogFormat("[Macro Memory #{0}] Memory deleted. Reset to stage 1.", moduleID);
            }
            while (!next)
            {
                yield return(null);
            }
            yield return(new WaitForSeconds(0.2f));

            for (int i = 0; i < 4; i++)
            {
                Label(values[(4 * modInstance) + i] + 1, i + 1);
                buttonobjs[i].transform.localPosition += new Vector3(0, 0.03f, 0);
                yield return(new WaitForSeconds(0.1f));
            }
            if (modInstance == selectedmod[1])
            {
                labels[0].text = (rule + 1).ToString();
                Debug.LogFormat("[Macro Memory #{0}] Activation {1}/Stage {2}: The displayed digit is {3}.", moduleID, presses.Count() + 1, stage[modInstance] + 1, rule + 1);
            }
            else if (!moduleSolved[modInstance])
            {
                Debug.LogFormat("[Macro Memory #{0}] Activation {1}: The digit {2} is displayed on module {3}.", moduleID, presses.Count() + 1, rule + 1, moduleIDCounter - selectedmod[1]);
            }
        }
        else
        {
            next = true;
        }
    }
Beispiel #11
0
 void correct()
 {
     solved = true;
     module.HandlePass();
     Debug.LogFormat("[Name Changer #{0}] The letter deleted is correct!", moduleId);
 }
Beispiel #12
0
    void ButtonPress(int Press)
    {
        if (!ModuleSolved)
        {
            if (Cubes[Press].GetComponentInChildren <TextMesh>().color.r != 0f)
            {
                switch (Cubes[Press].GetComponentInChildren <TextMesh>().text)
                {
                case "":
                    Cubes[Press].GetComponentInChildren <TextMesh>().text = "1";
                    break;

                case "9":
                    Cubes[Press].GetComponentInChildren <TextMesh>().text = "";
                    break;

                default:
                    Cubes[Press].GetComponentInChildren <TextMesh>().text = (Int32.Parse(Cubes[Press].GetComponentInChildren <TextMesh>().text) + 1).ToString();
                    break;
                }
            }

            for (int x = 0; x < 3; x++)
            {
                switch (x)
                {
                case 0:
                    for (int y = 0; y < 9; y++)
                    {
                        int Number = 0;
                        for (int z = 0; z < 9; z++)
                        {
                            if (Cubes[y * 9 + z].GetComponentInChildren <TextMesh>().text == "")
                            {
                                return;
                            }
                            Number += Int32.Parse(Cubes[y * 9 + z].GetComponentInChildren <TextMesh>().text);
                        }

                        if (Number != 45)
                        {
                            return;
                        }
                    }
                    break;

                case 1:
                    for (int y = 0; y < 9; y++)
                    {
                        int Number = 0;
                        for (int z = 0; z < 9; z++)
                        {
                            if (Cubes[z * 9 + y].GetComponentInChildren <TextMesh>().text == "")
                            {
                                return;
                            }
                            Number += Int32.Parse(Cubes[z * 9 + y].GetComponentInChildren <TextMesh>().text);
                        }

                        if (Number != 45)
                        {
                            return;
                        }
                    }
                    break;

                case 2:
                    for (int y = 0; y < 3; y++)
                    {
                        for (int z = 0; z < 3; z++)
                        {
                            int Number = 0;
                            for (int a = 0; a < 3; a++)
                            {
                                for (int b = 0; b < 3; b++)
                                {
                                    if (Cubes[((y * 3) + a) * 9 + ((z * 3) + b)].GetComponentInChildren <TextMesh>().text == "")
                                    {
                                        return;
                                    }
                                    Number += Int32.Parse(Cubes[((y * 3) + a) * 9 + ((z * 3) + b)].GetComponentInChildren <TextMesh>().text);
                                }
                            }

                            if (Number != 45)
                            {
                                return;
                            }
                        }
                    }
                    break;

                default:
                    break;
                }
            }

            /*for (int x = 0; x < 9; x++)
             * {
             *      for (int y = 0; y < 9; y++)
             *      {
             *              if (Cubes[x*9 + y].GetComponentInChildren<TextMesh>().text != m_sudoku[y,x].ToString())
             *              {
             *                      return;
             *              }
             *      }
             * }
             */

            for (int x = 0; x < 81; x++)
            {
                Cubes[x].GetComponentInChildren <TextMesh>().color = Cubes[x].GetComponentInChildren <TextMesh>().color.r != 0f ? new Color(24f / 255f, 60f / 255f, 0f) : Color.black;
            }

            Module.HandlePass();
            ModuleSolved = true;
            Audio.PlaySoundAtTransform(SFX.name, transform);
        }
    }
Beispiel #13
0
    void Submit()
    {
        SubmitButton.AddInteractionPunch();
        if (!bossMode)
        {
            Debug.Log("[Forget Infinity #{0}] boss mode not active. Strike! (submit button)");
            Module.HandleStrike();
            return;
        }
        if (solveMode)
        {
            Debug.Log("[Forget Infinity #{0}] Solve mode detected! not submitting!");
            solveMode = false;
            StringBuilder sb = new StringBuilder(); // base 5
            for (int i = 0; i < 5; i++)
            {
                var j = code[i];
                if (j > 0)
                {
                    j--;
                }
                sb.Append(j.ToString());
            }
            var dec = ConvertFromBase5(sb.ToString());
            Debug.Log("[Forget Infinity #{0}] input is " + sb.ToString() + ", in base 10 that's " + dec);
            if (stages.Count() > dec && dec >= 0)
            {
                updateScreen(stages[dec].ToArray());
            }
            Module.HandleStrike();
            Screen.color = new UnityEngine.Color(1, 1, 1);
            return;
        }
        var stg = stages[solveStagePtr];

        Debug.Log("not calculated: " + ListString(stg));
        var batteries = KMBombInfoExtensions.KMBI.GetBatteryCount(Info);

        if (batteries != 0)
        {
            Debug.Log("batteries " + batteries);
            for (int i = 0; i < 5; i++)
            {
                var t = stg[i];
                t = (t + batteries) % 5;
                if (t == 0)
                {
                    t = 5;
                }
                stg[i] = t;
            }
        }
        var serial = KMBombInfoExtensions.KMBI.GetSerialNumber(Info);

        if (serial.Contains("F") || serial.Contains("I"))
        {
            Debug.Log("FI");
            for (int i = 0; i < 5; i++)
            {
                var t = stg[i];
                t = t - 1;
                if (t == 0)
                {
                    t = 5;
                }
                stg[i] = t;
            }
        }
        Debug.Log("calculated: " + ListString(stg));
        Debug.Log("solve stage ptr = " + solveStagePtr.ToString());
        Debug.Log("stage count = " + stages.Count());
        for (int i = 0; i < 5; i++)
        {
            if (code [i] != stg[i])
            {
                Debug.Log("[Forget Infinity #{0}] Code is different from the expected input of " + ListString(stg) + ". Strike!");
                Module.HandleStrike();
                Reset(true);
                solveStagePtr = 0;
                return;
            }
        }
        if (stages.Count() - 1 <= solveStagePtr)
        {
            Debug.Log("[Forget Infinity #{0}] All codes are correct! Solve!");
            solved = true;
            Module.HandlePass();
            Screen.text = "XXXXX";
            return;
        }
        solveStagePtr++;
        for (int i = 0; i < 5; i++)
        {
            this.code[i] = 0;
        }
        this.codeIndex = 0;
        updateScreen();
    }
    void Awake()
    {
        moduleId  = moduleIdCounter++;
        leftGreen = rnd.Range(0, 2) == 0;
        rightRed  = rnd.Range(0, 2) == 0;
        bases[0].material.color = leftGreen ? baseColors[0] : baseColors[1];
        bases[1].material.color = rightRed ? baseColors[2] : baseColors[3];
        foreach (KMSelectable button in buttons)
        {
            button.OnInteract += delegate() { PressButton(button); return(false); }
        }
        ;
        module.OnActivate += delegate() { StartCoroutine(ShowNames()); };
        foreach (TextMesh t in moduleNames)
        {
            t.text = "";
        }
        for (int i = 0; i < 8; i++)
        {
            leftNames[i].text  = "";
            rightNames[i].text = "";
        }
    }

    void Start()
    {
        for (int i = 0; i < 8; i++)
        {
            leftNames[i].color  = Color.white;
            rightNames[i].color = Color.white;
        }
        presentPlayers = Enumerable.Range(0, 24).ToList().Shuffle().Take(7).ToArray();
        var tempPlayers = presentPlayers.ToArray();

        Array.Sort(tempPlayers);
        orderedPlayers = leftGreen ? tempPlayers.ToArray() : presentPlayers.OrderBy(x => parenthesesNumbers[Array.IndexOf(Enumerable.Range(0, 24).ToArray(), x)]).ToArray();
        if (!rightRed)
        {
            orderedPlayers = orderedPlayers.Reverse().ToArray();
        }
        MakeChoices();
        leftCount  = choseLeft.Count(b => b);
        rightCount = choseLeft.Count(b => !b);
        if (leftCount == 7 || rightCount == 7)
        {
            solution = leftCount == 7 ? 0 : 1;
        }
        else
        {
            solution = leftCount > rightCount ? 1 : 0;
        }
        Debug.LogFormat("[Dumb Waiters #{0}] The players present, other than yourself, are {1}, and {2}.", moduleId, presentPlayers.Take(6).Select(x => names[x]).Join(", "), names[presentPlayers[6]]);
        Debug.LogFormat("[Dumb Waiters #{0}] The left elevator is {1}, so order players by their {2}. The right elevator is {3}, so {4}.", moduleId, leftGreen ? "green" : "blue", leftGreen ? "position in the table" : "number in parentheses", rightRed ? "red" : "yellow", rightRed ? "leave this order as is" : "reverse this order");
        for (int i = 0; i < 7; i++)
        {
            Debug.LogFormat("[Dumb Waiters #{0}] {1} chose the {2} elevator.", moduleId, names[orderedPlayers[i]], choseLeft[i] ? "left" : "right");
        }
        Debug.LogFormat("[Dumb Waiters #{0}] The correct elevator to pick is the {1} elevator.", moduleId, solution == 0 ? "left" : "right");
    }

    void PressButton(KMSelectable button)
    {
        button.AddInteractionPunch(.5f);
        if (animating || moduleSolved)
        {
            return;
        }
        var ix = Array.IndexOf(buttons, button);

        audio.PlaySoundAtTransform("sting", transform);
        Debug.LogFormat("[Dumb Waiters #{0}] You chose the {1} elevator.", moduleId, ix == 0 ? "left" : "right");
        StartCoroutine(SubmitAnimation(ix));
    }

    IEnumerator SubmitAnimation(int ix)
    {
        animating = true;
        var leftNamesCount  = 0;
        var rightNamesCount = 0;

        yield return(new WaitForSeconds(.75f));

        for (int i = 0; i < 7; i++)
        {
            moduleNames.First(t => t.text == names[orderedPlayers[i]]).text = "";
            if (choseLeft[i])
            {
                leftNames[leftNamesCount].text = names[orderedPlayers[i]];
                leftNamesCount++;
            }
            else
            {
                rightNames[rightNamesCount].text = names[orderedPlayers[i]];
                rightNamesCount++;
            }
            audio.PlaySoundAtTransform("swoosh", transform);
            yield return(new WaitForSeconds(.5f));
        }
        if (ix == 0)
        {
            leftNames[leftNamesCount].text = "You";
        }
        else
        {
            rightNames[rightNamesCount].text = "You";
        }
        audio.PlaySoundAtTransform("swoosh", transform);
        yield return(new WaitForSeconds(.75f));

        if (ix != solution)
        {
            foreach (TextMesh t in (ix == 0) ? leftNames : rightNames)
            {
                t.color = resultColors[0];
            }
            foreach (TextMesh t in (ix == 0) ? rightNames : leftNames)
            {
                t.color = resultColors[1];
            }
        }
        else
        {
            if ((leftCount == 7 || rightCount == 7) || ((leftCount == 3 && rightCount == 4) || (leftCount == 4 && rightCount == 3)))
            {
                foreach (TextMesh t in leftNames)
                {
                    t.color = resultColors[1];
                }
                foreach (TextMesh t in rightNames)
                {
                    t.color = resultColors[1];
                }
            }
            else
            {
                if (leftCount > rightCount)
                {
                    foreach (TextMesh t in leftNames)
                    {
                        t.color = resultColors[0];
                    }
                    foreach (TextMesh t in rightNames)
                    {
                        t.color = resultColors[1];
                    }
                }
                else
                {
                    foreach (TextMesh t in rightNames)
                    {
                        t.color = resultColors[0];
                    }
                    foreach (TextMesh t in leftNames)
                    {
                        t.color = resultColors[1];
                    }
                }
            }
        }
        yield return(new WaitForSeconds(.5f));

        if (ix != solution)
        {
            Debug.LogFormat("[Dumb Waiters #{0}] Unfortunately, you have died. Strike! Resetting...", moduleId);
            module.HandleStrike();
            StartCoroutine(HideElevatorNames(true));
        }
        else
        {
            Debug.LogFormat("[Dumb Waiters #{0}] You survived! Module solved!", moduleId);
            module.HandlePass();
            audio.PlaySoundAtTransform("solve", transform);
            moduleSolved = true;
            StartCoroutine(HideElevatorNames(false));
        }
    }

    IEnumerator ShowNames()
    {
        for (int i = 0; i < 7; i++)
        {
            moduleNames[i].text = names[presentPlayers[i]];
            audio.PlaySoundAtTransform("tap", transform);
            yield return(new WaitForSeconds(.25f));
        }
        animating = false;
    }

    IEnumerator HideElevatorNames(bool becauseStrike)
    {
        var count = leftCount > rightCount ? leftCount : rightCount;

        if ((becauseStrike && count != 7) || (count == 7 && !becauseStrike)) // this is the easiest way to do an XOR gate in C#
        {
            count++;
        }
        for (int i = 0; i < count; i++)
        {
            leftNames[i].text  = "";
            rightNames[i].text = "";
            audio.PlaySoundAtTransform("beep", transform);
            yield return(new WaitForSeconds(.25f));
        }
        if (becauseStrike)
        {
            yield return(new WaitForSeconds(1f));

            Start();
            yield return(new WaitForSeconds(.1f));

            StartCoroutine(ShowNames());
        }
    }

    void MakeChoices()
    {
        for (int i = 0; i < 7; i++)
        {
            var left = false;
            switch (names[orderedPlayers[i]])
            {
            case "TasThing":
                left = chosen.Count() % 2 == 0;
                break;

            case "Deaf":
                left = presentPlayers.Any(x => startsWithVowel.Contains(x) && !chosen.Contains(x));
                break;

            case "Blananas2":
                left = presentPlayers.Any(x => containsNumber.Contains(x) && !chosen.Contains(x));
                break;

            case "Fish":
                left = presentPlayers.Any(x => x / 6 == 1 && chosen.Contains(x));
                break;

            case "Usernam3":
                left = presentPlayers.Any(x => x / 6 == 3 && !chosen.Contains(x));
                break;

            case "EpicToast":
                left = presentPlayers.Any(x => x % 6 == 0 && chosen.Contains(x));
                break;

            case "Makebao":
                left = !presentPlayers.Any(x => x / 6 == 2 && !chosen.Contains(x));
                break;

            case "KavinKul":
                left = presentPlayers.Any(x => x / 6 == 3 && chosen.Contains(x));
                break;

            case "Crazycaleb":
                left = bomb.GetModuleNames().Any(x => x == "The Jewel Vault");
                break;

            case "Danny7007":
                left = presentPlayers.Any(x => x / 6 == 0 && !chosen.Contains(x));
                break;

            case "Fang":
                left = presentPlayers.Any(x => x % 6 == 5 && chosen.Contains(x));
                break;

            case "Vinco":
                left = !presentPlayers.Any(x => x / 6 == 0 && !chosen.Contains(x));
                break;

            case "Arceus":
                left = presentPlayers.Any(x => x % 6 == 2 && chosen.Contains(x));
                break;

            case "Xmaster":
                left = presentPlayers.Any(x => x / 6 == 2 && chosen.Contains(x));
                break;

            case "FredV":
                left = presentPlayers.Any(x => x / 6 == 1 && !chosen.Contains(x));
                break;

            case "Kaito":
                left = presentPlayers.Any(x => x % 6 == 1 && chosen.Contains(x));
                break;

            case "SillyPuppy":
                left = !presentPlayers.Any(x => x / 6 == 3 && !chosen.Contains(x));
                break;

            case "Edan":
                left = chosen.Count() % 2 == 1;
                break;

            case "Mythers":
                left = presentPlayers.Any(x => x % 6 == 3 && chosen.Contains(x));
                break;

            case "Procyon":
                left = presentPlayers.Any(x => x / 6 == 0 && chosen.Contains(x));
                break;

            case "eXish":
                left = presentPlayers.Any(x => x % 6 == 4 && chosen.Contains(x));
                break;

            case "RedPenguin":
                left = !presentPlayers.Any(x => x / 6 == 1 && !chosen.Contains(x));
                break;

            case "MCD573":
                left = presentPlayers.Any(x => new int[] { 0, 15 }.Contains(x) && chosen.Contains(x));
                break;

            case "Mr. Peanut":
                left = presentPlayers.Any(x => x / 6 == 2 && !chosen.Contains(x));
                break;

            default:
                throw new System.ArgumentException("A name that shouldn't be present is being used.");
            }
            choseLeft[i] = left;
            chosen.Add(orderedPlayers[i]);
        }
    }
Beispiel #15
0
    bool ButtonPressed(int button, bool repeat)
    {
        if (!repeat)
        {
            buttons[button].AddInteractionPunch(0.25f);
            bAnims[button].Play("AnimDown", 0, 0);
            bombAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform);

            // Work around double-press bug in the game
            if (holdRoutine != null)
            {
                StopCoroutine(holdRoutine);
            }

            // Arrow buttons can repeat if held for long enough.
            if (button <= 1)
            {
                holdRoutine = StartCoroutine(HoldRepeat(button));
            }
        }

        if (moduleSolved || moduleStruck || correctName[0] == '_')
        {
            return(false);
        }

        switch (button)
        {
        case 0:                 // Up button
            highScores[entryNum].name[cursorOn] =
                (highScores[entryNum].name[cursorOn] == 'Z') ? 'A' : (char)(highScores[entryNum].name[cursorOn] + 1);
            break;

        case 1:                 // Down button
            highScores[entryNum].name[cursorOn] =
                (highScores[entryNum].name[cursorOn] == 'A') ? 'Z' : (char)(highScores[entryNum].name[cursorOn] - 1);
            break;

        case 2:                 // Submit button
            if (++cursorOn <= 2)
            {
                highScores[entryNum].name[cursorOn] = highScores[entryNum].name[cursorOn - 1];
            }
            else if (highScores[entryNum].name.SequenceEqual(correctName))
            {
                Debug.LogFormat("[The High Score #{0}] SOLVE: Submitted '{1}'. Correct.", thisLogID, new string(highScores[entryNum].name));
                moduleSolved = true;
                bombAudio.PlaySoundAtTransform("OK", transform);
                bombModule.HandlePass();
            }
            else if (BadWordPresent(highScores[entryNum].name))
            {
                Debug.LogFormat("[The High Score #{0}] STRIKE: Submitted a word on the bad words filter. Wrong.", thisLogID);
                highScores[entryNum].name = "NO!".ToCharArray();
                moduleStruck = true;
                bombAudio.PlaySoundAtTransform("NO", transform);
                bombModule.HandleStrike();
            }
            else
            {
                Debug.LogFormat("[The High Score #{0}] STRIKE: Submitted '{1}'. Wrong.", thisLogID, new string(highScores[entryNum].name));
                moduleStruck = true;
                bombAudio.PlaySoundAtTransform("NO", transform);
                bombModule.HandleStrike();
            }
            break;

        case 3:                 // Back button
            if (cursorOn > 0)
            {
                highScores[entryNum].name[cursorOn--] = '_';
            }
            break;
        }
        return(false);
    }
Beispiel #16
0
    void PressServe()
    {
        Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, serve.transform);
        serve.AddInteractionPunch();
        if (_IsSolved)
            return;

        for (int slot = 0; slot < 2; slot++)
        {
            var prepared = slot == 1 ? slot2input : slot1input;
            var expectedDrink = slot == 1 ? expectedDrink2 : expectedDrink1;

            if (prepared.State == DrinkState.Bottled)
            {
                Debug.LogFormat("[Bartending #{0}] You served a {1}. {2} wanted {3}.", _moduleId, prepared.Drink.Name, _patronNames[currentPatron], expectedDrink == null ? "nothing" : expectedDrink.Name);
                if (prepared.Drink == expectedDrink)
                {
                    Debug.LogFormat("[Bartending #{0}] The {1} drink is correct!", _moduleId, slot == 0 ? "first" : "second");
                }
                else
                {
                    StrikeAndRegenerate();
                    return;
                }
            }
            else if (prepared.State == DrinkState.Mixed || prepared.State == DrinkState.Blended)
            {
                if (expectedDrink == null)
                {
                    Debug.LogFormat("[Bartending #{0}] You served a {2}, but {1} didn’t want a second drink.", _moduleId, _patronNames[currentPatron], prepared.Drink.Name);
                    StrikeAndRegenerate();
                    return;
                }
                if (expectedDrink.Bottled)
                {
                    Debug.LogFormat("[Bartending #{0}] You served a {3}, but {1} wanted a {2}.", _moduleId, _patronNames[currentPatron], expectedDrink.Name, prepared.Drink.Name);
                    StrikeAndRegenerate();
                    return;
                }
                var expectedRecipe = _drinktionary.First(rec => rec.Drink == expectedDrink);
                var isBigDrink = prepared.IsSameRecipeAs(expectedRecipe, true);
                Debug.LogFormat("[Bartending #{0}] You served a {1}{2} ({3}). {4} wanted a {5}{6}.", _moduleId,
                    isBigDrink ? "big " : "", prepared.Drink.Name, prepared.LoggingString(_ingNames), _patronNames[currentPatron], bigDrinkExpected ? "big " : "", expectedDrink.Name);
                if (prepared.Drink == expectedDrink && isBigDrink == bigDrinkExpected)
                {
                    Debug.LogFormat("[Bartending #{0}] The {1} drink is correct!", _moduleId, slot == 0 ? "first" : "second");
                }
                else
                {
                    StrikeAndRegenerate();
                    return;
                }
            }
            else if (prepared.State == DrinkState.Unprepared)
            {
                Debug.LogFormat("[Bartending #{0}] You served no drink in slot {1}. {2} wanted {3}.", _moduleId, slot == 0 ? 1 : 2, _patronNames[currentPatron], expectedDrink2 == null ? "1 drink" : "2 drinks");
                if (expectedDrink == null)
                {
                    Debug.LogFormat("[Bartending #{0}] The {1} drink is correct!", _moduleId, slot == 0 ? "first" : "second");
                }
                else
                {
                    Debug.LogFormat("[Bartending #{0}] You served no drink when {1} expected a drink! Strike!", _moduleId, _patronNames[currentPatron]);
                    StrikeAndRegenerate();
                    return;
                }
            }
            else
            {
                Debug.LogFormat("[Bartending #{0}] You tried to serve a failed drink!", _moduleId);
                StrikeAndRegenerate();
                return;
            }
        }

        // Both drinks were correct!
        Debug.LogFormat("[Bartending #{0}] Drinks correctly served! Module solved!", _moduleId);
        Module.HandlePass();
        if (Bomb.GetSolvedModuleNames().Count < Bomb.GetSolvableModuleNames().Count)
            Audio.PlaySoundAtTransform("solve", transform);
        for (int i = 0; i < screens.Length; i++)
            screens[i].material.mainTexture = GrayScreen;
        for (int i = 0; i < _ingNames.Length; i++)
            ingValuesText[i].text = _Blank.ToString();
        _IsSolved = true;
    }
Beispiel #17
0
 public void Solve()     // Puts The Modkit into a disarmed state.
 {
     moduleSelf.HandlePass();
     moduleSolved = true;
     StartCoroutine(PlaySolveAnim());
 }
	void setSpecies(){
		int[] columnConditions = {Info.GetIndicators ().Count (), Info.GetBatteryCount (Battery.AA) + Info.GetBatteryCount (Battery.AAx3) + Info.GetBatteryCount (Battery.AAx4),  Info.GetSerialNumberNumbers().ToArray().ElementAt(1), Info.GetModuleNames().Count(), Info.GetSerialNumberNumbers().Last()};
		int[] rowConditions = {System.DateTime.Now.Day, System.DateTime.Now.Hour, System.DateTime.Now.Month, Info.GetSolvableModuleNames ().Count, Info.GetBatteryCount (Battery.D)};
		int[,] conditions = {{rowConditions[0]*columnConditions[0],rowConditions[0]*columnConditions[1],rowConditions[0]*columnConditions[2],rowConditions[0]*columnConditions[3],rowConditions[0]*columnConditions[4]},
			{rowConditions[1]*columnConditions[0],rowConditions[1]*columnConditions[1],rowConditions[1]*columnConditions[2],rowConditions[1]*columnConditions[3],rowConditions[1]*columnConditions[4]},
			{rowConditions[2]*columnConditions[0],rowConditions[2]*columnConditions[1],rowConditions[2]*columnConditions[2],rowConditions[2]*columnConditions[3],rowConditions[2]*columnConditions[4]},
			{rowConditions[3]*columnConditions[0],rowConditions[3]*columnConditions[1],rowConditions[3]*columnConditions[2],rowConditions[3]*columnConditions[3],rowConditions[3]*columnConditions[4]},
			{rowConditions[4]*columnConditions[0],rowConditions[4]*columnConditions[1],rowConditions[4]*columnConditions[2],rowConditions[4]*columnConditions[3],rowConditions[4]*columnConditions[4]}};
		int aCellValue = -1;
		int bCellValue = -1;
		int adding = 0;

		Debug.LogFormat ("[Chemical Distillation #{0}] Path A is {1}", _moduleId, (((solPaths [baseSolution-1,0])-1)+1));
		Debug.LogFormat ("[Chemical Distillation #{0}] Path B is {1}", _moduleId, (((solPaths [baseSolution-1,1])-1)+1));
		int test = 0;
		int compt = 0;
		int aCell=0;
		int bCell=0;
		int firstID = 0, secondID = 0, thirdID = 0;


		while(compt < (hour + 2)){
			Debug.LogFormat ("[Chemical Distillation #{0}] STEP {1}", _moduleId, (compt+1));
			#region A cells
			#region Row handle
			int row = 0;


			if (25 - (pathsA [((solPaths [baseSolution - 1, 0]) - 1), compt]) <= 5) {
				row = 4;
			} else if (25 - (pathsA [((solPaths [baseSolution - 1, 0]) - 1), compt]) <= 10 && 25 - (pathsA [((solPaths [baseSolution - 1, 0]) - 1), compt]) >5) {
				row = 3;
			} else if (25 - (pathsA [((solPaths [baseSolution - 1, 0]) - 1), compt]) <= 15&& 25 - (pathsA [((solPaths [baseSolution - 1, 0]) - 1), compt]) >10) {
				row = 2;
			}	else if (25 - (pathsA [((solPaths [baseSolution - 1, 0]) - 1), compt]) <= 20&& 25 - (pathsA [((solPaths [baseSolution - 1, 0]) - 1), compt]) >15) {
				row = 1;
			} else if (25 - (pathsA [((solPaths [baseSolution - 1, 0]) - 1), compt]) <= 25&& 25 - (pathsA [((solPaths [baseSolution - 1, 0]) - 1), compt]) >20) {
				row = 0;
			}
			#endregion
			#region Column handle
			int column = (pathsA [((solPaths [baseSolution - 1, 0]) - 1), compt]);
			while (column >= 5) {
				column -= 5;
			}
			#endregion
			//Debug.LogFormat ("column is {0}", column);
			aCellValue = rowConditions [row] * columnConditions [column];
			//Debug.LogFormat ("Row conditions shows " + rowConditions [row-1]);
			//Debug.LogFormat ("Column conditions shows " + columnConditions [column]);
			Debug.LogFormat ("[Chemical Distillation #{0}] A Cell value is {1}", _moduleId, aCellValue);

			#endregion

			#region B cells
			#region Row B handle
			int rowB = 0;
			if (25 - (pathsB [((solPaths [baseSolution - 1, 1]) - 1), compt]) <= 5) {
				rowB = 4;
			} else if (25 - (pathsB [((solPaths [baseSolution - 1, 1]) - 1), compt]) <= 10 && 25 - (pathsB [((solPaths [baseSolution - 1, 1]) - 1), compt]) > 5) {
				rowB = 3;
			} else if (25 - (pathsB [((solPaths [baseSolution - 1, 1]) - 1), compt]) <= 15 && 25 - (pathsB [((solPaths [baseSolution - 1, 1]) - 1), compt])> 10) {
				rowB = 2;
			} else if (25 - (pathsB [((solPaths [baseSolution - 1, 1]) - 1), compt]) <= 20 && 25 - (pathsB [((solPaths [baseSolution - 1, 1]) - 1), compt]) > 15) {
				rowB = 1;
			} else if (25 - (pathsB [((solPaths [baseSolution - 1, 1]) - 1), compt]) <= 25 && 25 - (pathsB [((solPaths [baseSolution - 1, 1]) - 1), compt]) > 20) {
				rowB = 0;
			}
			#endregion
			#region Column B handle
			int columnB = (pathsB [((solPaths [baseSolution - 1, 1]) - 1), compt]);
			while (columnB >= 5) {
				columnB -= 5;
			}
			#endregion
			//Debug.LogFormat ("column is {0}", column);
			bCellValue = rowConditions [rowB] * columnConditions [columnB];
			//Debug.LogFormat ("Row conditions shows " + rowConditions [row-1]);
			//Debug.LogFormat ("Column conditions shows " + columnConditions [column]);
			Debug.LogFormat ("[Chemical Distillation #{0}] B Cell value is {1}", _moduleId, bCellValue);
			#endregion

			if (Info.GetSerialNumberNumbers ().First() % 2 == 0) {

				if (aCellValue > bCellValue) {
					Debug.LogFormat ("[Chemical Distillation #{0}] Correct inequality because A>B", _moduleId);
					correctInequalities [test, 0] = speciesTable [pathsA [((solPaths [baseSolution - 1, 0]) - 1), compt]];
					correctInequalities [test, 1] = speciesTable [pathsB [((solPaths [baseSolution - 1, 1]) - 1), compt]];
					test++;
				}
			} else {
				if (aCellValue < bCellValue) {
					Debug.LogFormat ("[Chemical Distillation #{0}] Correct inequality because A<B", _moduleId);
					correctInequalities [test, 0] = speciesTable [pathsA [((solPaths [baseSolution - 1, 0]) - 1), compt]];
					correctInequalities [test, 1] = speciesTable [pathsB [((solPaths [baseSolution - 1, 1]) - 1), compt]];
					test++;
				}
			}  if (aCellValue==bCellValue){
				if (Info.GetOnIndicators().Contains("BOB")){Debug.LogFormat ("[Chemical Distillation #{0}] Corect inequality because BOB is lit", _moduleId);
					correctInequalities [test, 0] = speciesTable [pathsA [((solPaths [baseSolution - 1, 0]) - 1), compt]];
					correctInequalities [test, 1] = speciesTable [pathsB [((solPaths [baseSolution - 1, 1]) - 1), compt]];
					test++;
				}
				adding++;
			}
					
			compt++;

		} 
			//int row = pathsA[((solPaths[baseSolution-1,0])-1), test];
			//int column = pathsA[((solPaths[baseSolution-1,0])-1), test];
		Debug.LogFormat("[Chemical Distillation #{0}] There is {1} correct inequalities ", _moduleId, test);
		Debug.LogFormat("[Chemical Distillation #{0}] There is {1} equalities ", _moduleId, adding);


		if (test != 0) {
			
			aCell = correctInequalities [test - 1, 0];
			Debug.LogFormat ("gezr + " + aCell);	

			for (int incr = (test - 1) / 2; incr >= 0; incr--) {
				if (correctInequalities [incr, 1] < aCell) {
					bCell = correctInequalities [incr, 1];
					Debug.LogFormat ("bonjour + " + bCell);	
					break;
				} else if (incr == 0 && correctInequalities [incr, 1] >= aCell) {
					bCell = correctInequalities [incr, 1];
					Debug.LogFormat ("bonj2our + " + bCell);	
					break;
				}
			}
			if ((Mathf.Abs (aCell - bCell)) - 1 < 0) {
				firstID = Mathf.Abs (aCell - bCell);
				Debug.LogFormat ("Negative");
			} else {
				firstID = Mathf.Abs (aCell - bCell) - 1;
				Debug.LogFormat ("Positive");
			}

			firstID += adding;



			for (int decr = 0; decr < test-1; decr++) {	
			
				Debug.LogFormat ("decr " + decr);
				Debug.LogFormat ("firstCOr " + correctInequalities [decr, 0]);
				Debug.LogFormat ("secondCor " + correctInequalities [decr, 1]);
		
				Debug.LogFormat ("eAAREZGGR " + Mathf.Abs (aCell - bCell));

				if (speciesTable [correctInequalities [decr, 0] - 1] != speciesTable [firstID]) {
					secondID =	correctInequalities [decr, 0]-1;
				
					break;
				}
			}

			//When there is only 1 correct inequality, this happens (that's ugly but that's working)
	
			if (test == 1) {
				secondID =	correctInequalities [0, 0] - 1;
			}
		
				
			if(secondID==firstID){
				if (hour - 1 != firstID) {
					secondID = hour - 1;
				}else{
					secondID = hour + 2 - 1;
			}

			thirdID = Mathf.Abs (firstID - secondID)-1;

			if (thirdID == firstID || thirdID == secondID) {
				Debug.LogFormat ("double");
				thirdID = (firstID + secondID) / 2;
			}

			Debug.LogFormat ("First id is " + (firstID+1));
			Debug.LogFormat ("Second id is " + (secondID+1));
			Debug.LogFormat ("Third id is " + (thirdID+1));
				
			firstSpecie = speciesList [firstID];
			secondSpecie = speciesList [secondID];
			thirdSpecie = speciesList [thirdID];

			Debug.LogFormat ("First specie is " + firstSpecie.name);
			Debug.LogFormat ("Second specie is " + secondSpecie.name);
			Debug.LogFormat ("Third specie is " + thirdSpecie.name);
			//	Debug.LogFormat ("Row is " + row);.



			//C:\Users\Nanyboy\Documents\Unreal Projects\MyProject\Intermediate\Android\APK\gradle\app\build\tmp\expandedArchives\classes.jar_3q4nz8ua5pk0z64flsw70toic\com\google\protobuf
			//
			//Debug.LogFormat ("Path cell is " + speciesTable[pathsA[((solPaths[baseSolution-1,0])-1), test]]);
		
				setTemperature ();

		} else {
			if(Info.GetIndicatorCount()%2==0){
				ball = false;
			erlen = true;
				Debug.LogFormat ("Grief the notebook using the erlemeyer !");
			}else{
				erlen = false;
					ball=true;
				Debug.LogFormat ("Grief the notebook using the balloon !");
				}

		}
	}
		
	void setTemperature(){
		
		int cell = 0;
		for (int decr = 24; decr > 0; decr--) {	
			
			if (correctInequalities [decr, 0] != 0 && correctInequalities [decr, 1] != 0) {

				cell = speciesTable.ToList().IndexOf(correctInequalities [decr, 1]);
				break;
			}
		}
		Debug.LogFormat ("Cell at beggining is {0}", cell+1);
		if (stain.enabled == true) {
			cell += 5;
		}
		if (Info.GetSerialNumberNumbers ().Last() % 2 != 0) {
			cell -= 2;
		}
		if (Info.GetOnIndicators ().Count() > 0) {
			cell += 9;
		}
		if (speciesList.ToList().IndexOf (firstSpecie) % 2 == 0 || speciesList.ToList().IndexOf (secondSpecie) % 2 == 0 || speciesList.ToList().IndexOf (thirdSpecie) % 2 == 0) {
			cell += 1;
		}
		if("aeiouAEIOU".IndexOf(firstSpecie.name.First())>=0||"aeiouAEIOU".IndexOf(secondSpecie.name.First())>=0||"aeiouAEIOU".IndexOf(thirdSpecie.name.First())>=0){
			cell -=7;
		}

		if (cell >= 25) {
			cell -= 25;
		}
		if (cell < 0) {
			cell += 25;
		}
		Debug.LogFormat ("Cell at end is {0}", cell+1);
		int[] finalSpecies = { firstSpecie.ebullitionTemp, secondSpecie.ebullitionTemp, thirdSpecie.ebullitionTemp };
		finalSpecies = finalSpecies.OrderByDescending (c => c).ToArray ();
		switch (extractedSpecies [cell]) {
		case 1:
			Debug.LogFormat ("There is 1 specie in the erlenmeyer");
			for (int i = finalSpecies [2]; i < finalSpecies [1]; i++) {
				if (i ==finalSpecies[2]+Info.GetPortCount()) {
					temperature = i;
					break;
				}
				if (i == finalSpecies [1] - 1) {
					temperature = finalSpecies [2] + 1;			//If the loop is ended before the first condition is reached, this part avoids the temperature to be 0
					break;
				}
			}
			break;
		case 2:
			Debug.LogFormat ("There are 2 species in the erlenmeyer");
			for (int i = finalSpecies [1]; i < finalSpecies [0]; i++) {
				if (i ==finalSpecies[1]+Info.GetPortCount()) {
					temperature = i;			
					break;
				}
				if (i == finalSpecies [0] - 1) {	
					temperature = finalSpecies [1] + 1;			//If the loop is ended before the first condition is reached, this part avoids the temperature to be 0
					break;
				}
			}
			break;
		}

		Debug.LogFormat ("The temperature was " + temperature);
	}
	// Update is called once per frame
	void handleNotebook(int text){

		writingSound ();
		switch(text){
		case 0:
			textF++;
			if (textF == 25) {
				textF = 0;
			}
			first.text = speciesList [textF].name;

			break;
		case 1:
			textS++;
			if (textS == 25) {
				textS = 0;
			}
			second.text = speciesList [textS].name;
			break;
		case 2:
			textT++;
			if (textT == 25) {
				textT = 0;
			}
			third.text = speciesList [textT].name;
			break;
		case 3:
			textF--;
			if (textF == -1||textF ==-2) {
				textF = 24;
			}
			first.text = speciesList [textF].name;
			break;
		case 4:
			textS--;
			if (textS == -1||textS ==-2) {
				textS = 24;
			}
			second.text = speciesList [textS].name;
			break;
		case 5:
			textT--;
			if (textT == -1||textT ==-2) {
				textT = 24;
			}
			third.text = speciesList [textT].name;
			break;
	}
	}

	void handleTemperature (int value){
		switch (value) {
		case 0:
			userTemp++;
		
			break;
		case 1:
			userTemp--;
			break;
		}
		temp.text = userTemp.ToString ();
	}

	void handleSubmit(){
		Debug.LogFormat("[Chemical Distillation #{0}] You submitted {1} as first specie, {2} as second and {3} as third, at the temperature {4} °C ", _moduleId, first.text, second.text, third.text, temp.text);
		if (!erlen && !ball && firstSpecie.name == first.text && secondSpecie.name == second.text && thirdSpecie.name == third.text &&userTemp==temperature) {
			Module.HandlePass ();
		} else {
			Module.HandleStrike ();
		}
	}

	void handleErlenmeyer(int phase){
		Debug.LogFormat("[Chemical Distillation #{0}] You used the erlenmeyer's solution !", _moduleId);

		switch (phase) {
		case 0:
			if (erlen) {
				Module.HandlePass ();
			} else {
				Module.HandleStrike ();
			}
			break;
		case 1:
			eSol.material.color = orange;
			break;
		case 2:
			eSol.material.color = erlenColor;
			break;
		}
	}

	void handleBalloon(int phase){
		Debug.LogFormat("[Chemical Distillation #{0}] You used the balloon's solution !", _moduleId);

		switch (phase) {
		case 0:
			if (ball) {
				Module.HandlePass ();
			} else {
				Module.HandleStrike ();
			}
			break;
		case 1:
			bSol.material.color = orange;
			break;
		case 2:
			bSol.material.color = balloonColor;
			break;
		}
	}

	void writingSound(){
		int sound = Random.Range (0, 7);

		switch (sound) {
		case 0:
			Audio.PlaySoundAtTransform ("pencil0", notebook.transform);
			break;
		case 1:
			Audio.PlaySoundAtTransform ("pencil1", notebook.transform);
			break;
		case 2:
			Audio.PlaySoundAtTransform ("pencil2", notebook.transform);
			break;
		case 3:
			Audio.PlaySoundAtTransform ("pencil3", notebook.transform);
			break;
		case 4:
			Audio.PlaySoundAtTransform ("pencil4", notebook.transform);
			break;
		case 5:
			Audio.PlaySoundAtTransform ("pencil5", notebook.transform);
			break;
		case 6:
			Audio.PlaySoundAtTransform ("pencil6", notebook.transform);
			break;
		case 7:
			Audio.PlaySoundAtTransform ("pencil7", notebook.transform);
			break;
		}
	}
	void Update () {
		}
Beispiel #19
0
 private KMSelectable.OnInteractHandler BeanPressed(int pos)
 {
     return(delegate
     {
         if (eatenbeans == 0)
         {
             for (int i = 0; i < 9; i++)
             {
                 Beans[i].GetComponent <MeshRenderer>().material.color = new Color(96 / 255f, 64 / 255f, 32 / 255f);
             }
         }
         Audio.PlaySoundAtTransform("Monch", Module.transform);
         if (eatenbeans == 3)
         {
             Debug.LogFormat("[Rotten Beans #{0}] They know...", _moduleID);
             Module.HandleStrike();
         }
         else
         {
             int solution = 0;
             bool check = true;
             for (int i = 0; i < 9 && check; i++)
             {
                 if (beansafe[referArray[i]] && beansafe[i])
                 {
                     solution = referArray[i];
                     check = false;
                 }
             }
             if (!striked)
             {
                 if (!beansafe[referArray[pos]])
                 {
                     Debug.LogFormat("[Rotten Beans #{0}] You shouldn't eat smelly beans.", _moduleID);
                     Module.HandleStrike();
                     striked = true;
                     StartCoroutine(Strike());
                 }
                 else if (!beansafe[pos])
                 {
                     Debug.LogFormat("[Rotten Beans #{0}] You shouldn't touch smelly beans.", _moduleID);
                     Module.HandleStrike();
                     striked = true;
                     StartCoroutine(Strike());
                 }
                 else if (referArray[pos] != solution)
                 {
                     Debug.LogFormat("[Rotten Beans #{0}] Why did you eat bean {1} when bean {2} was perfectly available?", _moduleID, referArray[pos] + 1, solution + 1);
                     Module.HandleStrike();
                     striked = true;
                     StartCoroutine(Strike());
                 }
             }
             else
             {
                 Debug.LogFormat("[Beans #{0}] You might not know which beans were safe, the module will not strike you again.", _moduleID);
             }
             beansafe[referArray[pos]] = false;
             //if (referArray[pos] / 3 != 0)
             //{
             //	beansafe[referArray[pos] - 3] = false;
             //}
             //if (referArray[pos] / 3 != 2)
             //{
             //	beansafe[referArray[pos] + 3] = false;
             //}
             //if (referArray[pos] % 3 != 0)
             //{
             //	beansafe[referArray[pos] - 1] = false;
             //}
             //if (referArray[pos] % 3 != 2)
             //{
             //	beansafe[referArray[pos] + 1] = false;
             //}
             eatenbeans++;
             if (eatenbeans == 3)
             {
                 Module.HandlePass();
                 Solve();
             }
         }
         //Beans[pos].GetComponent<Renderer>().enabled = false;
         Beans[referArray[pos]].transform.localScale = new Vector3(0f, 0f, 0f);
         referArray[pos] = referArray[referArray[pos]];
         return false;
     });
 }
Beispiel #20
0
 void Start()
 {
     StartCoroutine(INeedThisForStartup());
     MaxStage = Bomb.GetSolvableModuleNames().Where(a => !Ignored.Contains(a)).Count();
     if (!Application.isEditor)
     {
         if (MaxStage == Stage)
         {
             Module.HandlePass();
             BigText.text  = "AY";
             BigText.color = RandomColors[1];
             ModuleSolved  = true;
             Debug.LogFormat("[42 #{0}] No stages were able to be generated. Autosolving.", moduleId);
         }
         else
         {
             Debug.LogFormat("[42 #{0}] Welcome to 42. The maximum amount of stages possible is {1}.", moduleId, MaxStage);
         }
     }
     else
     {
         NumberCycle1 = RDM.Range(0, 100); //debug stuff
         if (NumberCycle1 == 42)
         {
             Strikeable = true;
         }
         NumberCycle2 = RDM.Range(0, 100);
         if (Strikeable == true)
         {
             if (NumberCycle2 == 42)
             {
                 NumberCycle2 = RDM.Range(10, 40);
             }
         }
         else if (NumberCycle2 == 42)
         {
             Strikeable = true;
         }
         NumberCycle3 = RDM.Range(0, 100);
         if (Strikeable == true)
         {
             if (NumberCycle3 == 42)
             {
                 NumberCycle3 = RDM.Range(10, 40);
             }
         }
         else if (NumberCycle3 == 42)
         {
             Strikeable = true;
         }
         NumberCycle4 = RDM.Range(0, 100);
         if (Strikeable == true)
         {
             if (NumberCycle4 == 42)
             {
                 NumberCycle4 = RDM.Range(10, 40);
             }
         }
         else if (NumberCycle4 == 42)
         {
             Strikeable = true;
         }
         NumberCycle5 = RDM.Range(0, 100);
         if (Strikeable == true)
         {
             if (NumberCycle5 == 42)
             {
                 NumberCycle5 = RDM.Range(10, 40);
             }
         }
         else if (NumberCycle5 == 42)
         {
             Strikeable = true;
         }
         NumberCycle6 = RDM.Range(0, 100);
         if (Strikeable == true)
         {
             if (NumberCycle6 == 42)
             {
                 NumberCycle6 = RDM.Range(10, 40);
             }
         }
         else if (NumberCycle6 == 42)
         {
             Strikeable = true;
         }
         NumberCycle7 = RDM.Range(0, 100);
         if (Strikeable == true)
         {
             if (NumberCycle7 == 42)
             {
                 NumberCycle7 = RDM.Range(10, 40);
             }
         }
         else if (NumberCycle7 == 42)
         {
             Strikeable = true;
         }
         NumberCycle8 = RDM.Range(0, 100);
         if (Strikeable == true)
         {
             if (NumberCycle8 == 42)
             {
                 NumberCycle8 = RDM.Range(10, 40);
             }
         }
         else if (NumberCycle8 == 42)
         {
             Strikeable = true;
         }
         NumberCycle9 = RDM.Range(0, 100);
         if (Strikeable == true)
         {
             if (NumberCycle9 == 42)
             {
                 NumberCycle9 = RDM.Range(10, 40);
             }
         }
         else if (NumberCycle9 == 42)
         {
             Strikeable = true;
         }
         NumberCycle10 = RDM.Range(0, 100);
         if (Strikeable == true)
         {
             if (NumberCycle10 == 42)
             {
                 NumberCycle10 = RDM.Range(10, 40);
             }
         }
         else if (NumberCycle10 == 42)
         {
             Strikeable = true;
         }
         Debug.LogFormat("[42 #{0}] Stage 0: All numbers are zeroes for convenience.", moduleId);
     }
 }
Beispiel #21
0
 private KMSelectable.OnInteractHandler BeanPressed(int pos)
 {
     return(delegate
     {
         Audio.PlaySoundAtTransform("Monch", Module.transform);
         if (eatenbeans == 3)
         {
             Debug.LogFormat("[Kidney Beans #{0}] They know...", _moduleID);
             Module.HandleStrike();
         }
         else
         {
             int solution = -1;
             bool check = true;
             for (int i = 0; i < 9 && check; i++)
             {
                 int match = 0;
                 for (int j = 0; j < 3; j++)
                 {
                     if (beanArray[(i / 3) * 3 + j] == beanArray[i % 3 + j * 3] || !beansafe[(i / 3) * 3 + j] || !beansafe[(i % 3) + j * 3])
                     {
                         match++;
                     }
                 }
                 if (match >= 2 && beanArray[i] != 0 && beansafe[i])
                 {
                     solution = i;
                     check = false;
                 }
             }
             if (solution != -1)
             {
                 int match = 0;
                 for (int j = 0; j < 3; j++)
                 {
                     if (beanArray[(pos / 3) * 3 + j] == beanArray[pos % 3 + j * 3] || !beansafe[(pos / 3) * 3 + j] || !beansafe[(pos % 3) + j * 3])
                     {
                         match++;
                     }
                 }
                 if (!beansafe[pos] || match < 2 || beanArray[pos] == 0)
                 {
                     Debug.LogFormat("[Kidney Beans #{0}] Bean {1} wasn't really edible.", _moduleID, pos + 1);
                     Module.HandleStrike();
                     StartCoroutine(Strike());
                 }
                 else
                 {
                     Debug.LogFormat("[Kidney Beans #{0}] Bean {1} was a correct bean to eat.", _moduleID, pos + 1);
                 }
             }
             else
             {
                 Debug.LogFormat("[Kidney Beans #{0}] There was no valid bean, so you will not get a strike.", _moduleID);
             }
             beansafe[pos] = false;
             eatenbeans++;
             if (eatenbeans == 3)
             {
                 Module.HandlePass();
                 Solve();
             }
         }
         Beans[pos].transform.localScale = new Vector3(0f, 0f, 0f);
         return false;
     });
 }
    // submit is pressed
    private IEnumerator handleSubmit()
    {
        isSubmitting = true;
        Debug.Log("[Game of Life Simple #" + moduleId + "] Submit pressed. Submitted states are:");
        StartCoroutine(updateDebug());
        yield return(new WaitForSeconds(TimeTiny));

        // store the submitted color values
        for (int i = 0; i < 48; i++)
        {
            ColorsSubmitted [i] = BtnColor [i].material.color;
        }

        // run a reset
        Debug.Log("[Game of Life Simple #" + moduleId + "] Original states were:");
        StartCoroutine(updateReset());
        yield return(new WaitForSeconds(TimeTiny * 20));


        // process the generations
        for (int g = 0; g < Gen; g++)
        {
            // store square color value
            for (int s = 0; s < 48; s++)
            {
                BtnColorStore [s] = BtnColor [s].material.color;
            }

            // process neighbours for each square
            for (int k = 0; k < 48; k++)
            {
                int l = k;
                nCount [l] = 0;
                // top left
                if ((k - 7 < 0) || (k % 6 == 0))
                {
                }
                else
                {
                    if (BtnColorStore [(k - 7)].Equals(Colors [1]))
                    {
                        nCount [l]++;
                    }
                }
                // top
                if (k - 6 < 0)
                {
                }
                else
                {
                    if (BtnColorStore [(k - 6)].Equals(Colors [1]))
                    {
                        nCount [l]++;
                    }
                }
                // top right
                if ((k - 5 < 0) || (k % 6 == 5))
                {
                }
                else
                {
                    if (BtnColorStore [(k - 5)].Equals(Colors [1]))
                    {
                        nCount [l]++;
                    }
                }
                // left
                if ((k - 1 < 0) || (k % 6 == 0))
                {
                }
                else
                {
                    if (BtnColorStore [(k - 1)].Equals(Colors [1]))
                    {
                        nCount [l]++;
                    }
                }
                // right
                if ((k + 1 > 47) || (k % 6 == 5))
                {
                }
                else
                {
                    if (BtnColorStore [(k + 1)].Equals(Colors [1]))
                    {
                        nCount [l]++;
                    }
                }
                // bottom left
                if ((k + 5 > 47) || (k % 6 == 0))
                {
                }
                else
                {
                    if (BtnColorStore [(k + 5)].Equals(Colors [1]))
                    {
                        nCount [l]++;
                    }
                }
                // bottom
                if (k + 6 > 47)
                {
                }
                else
                {
                    if (BtnColorStore [(k + 6)].Equals(Colors [1]))
                    {
                        nCount [l]++;
                    }
                }
                // bottom right
                if ((k + 7 > 47) || (k % 6 == 5))
                {
                }
                else
                {
                    if (BtnColorStore [(k + 7)].Equals(Colors [1]))
                    {
                        nCount [l]++;
                    }
                }

                // read nCount and decide life state
                if (BtnColor [k].material.color == Colors [1])                                  //if square is white
                {
                    if (nCount [k] < 2 || nCount [k] > 3)
                    {
                        BtnColor [l].material.color = Colors [0];
                        BtnColor1 [l] = 0;
                        BtnColor2 [l] = 0;
                    }
                }
                else                                                                                                                    //if square is black
                {
                    if (nCount [k] == 3)
                    {
                        BtnColor [l].material.color = Colors [1];
                        BtnColor1 [l] = 1;
                        BtnColor2 [l] = 1;
                    }
                }
            }

            // update squares, wait, then next generation
            //if (g < 0) {
            StartCoroutine(updateSquares());
            StartCoroutine(updateDebug());
            //}

            if (g < (Gen - 1))
            {
                yield return(new WaitForSeconds(TimeSuspend));
            }
            else
            {
                yield return(new WaitForSeconds(TimeTiny));
            }
        }

        // test last generation vs ColorsSubmitted
        for (int i = 0; i < 48; i++)
        {
            if (isSubmitting == true)
            {
                //is any square wrongly submitted, then strike
                if (BtnColor [i].material.color != ColorsSubmitted [i])
                {
                    Debug.Log("[Game of Life Simple #" + moduleId + "] First error found at square number " + (i + 1) + " in reading order. Strike");
                    Module.HandleStrike();
                    yield return(new WaitForSeconds(TimeSneak));

                    isSubmitting = false;
                    StartCoroutine(updateReset());
                }
            }
        }
        //solve!
        if (isSubmitting == true)
        {
            Debug.Log("[Game of Life Simple #" + moduleId + "] No errors found! Module passed");
            Module.HandlePass();
            isSolved = true;
        }

        yield return(false);
    }
    /// <summary>
    /// Helper method to determine whether or not the correct number has been entered and react appropriately
    /// </summary>
    private void CheckSolution()
    {
        //Movement/audio
        submitButton.AddInteractionPunch(.5f);
        bombAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonPress, transform);

        //Initial submission value
        submission = (digits[0] * 100) + (digits[1] * 10) + digits[2];
        Debug.LogFormat(@"[Modulus Manipulation #{0}] Submitted value {1}.", moduleId, submission);

        //Set up values calculated at solution check
        finalSolution           = startingNumber;
        otherModsRemainingCount = bombInfo.GetSolvableModuleNames().Count() - bombInfo.GetSolvedModuleNames().Count() - 1;
        strikeCount             = bombInfo.GetStrikes();
        minutesRemainingIsEven  = ((int)bombInfo.GetTime() / 60) % 2 == 0;
        Debug.LogFormat(@"[Modulus Manipulation #{0}] Starting value for calculations is {1}.", moduleId, startingNumber);
        Debug.LogFormat(@"[Modulus Manipulation #{0}] There are currently {1} other modules remaining.", moduleId, otherModsRemainingCount);

        //Apply calculations
        if (otherModsRemainingCount % 5 == 0)
        {
            Debug.LogFormat(@"[Modulus Manipulation #{0}] Rule set 5 is applicable.", moduleId);
            //If the bomb has more than one battery, add 400
            if (batteryCount > 1)
            {
                finalSolution += 400;
                Debug.LogFormat(@"[Modulus Manipulation #{0}] Bomb has more than one battery, adding 400. Solution is now {1}.", moduleId, finalSolution);
            }
            //If the serial number contains the number 3 or 6, subtract 40
            if (serialNumberSpecial)
            {
                finalSolution -= 40;
                Debug.LogFormat(@"[Modulus Manipulation #{0}] Serial number contains a 3 or 6, subtracting 40. Solution is now {1}.", moduleId, finalSolution);
            }
        }
        if (otherModsRemainingCount % 4 == 0)
        {
            Debug.LogFormat(@"[Modulus Manipulation #{0}] Rule set 4 is applicable.", moduleId);
            //If the bomb has at least one AA battery and at least one D battery, multiply by 2
            if (aaBatteryCount >= 1 && dBatteryCount >= 1)
            {
                finalSolution *= 2;
                Debug.LogFormat(@"[Modulus Manipulation #{0}] Bomb has at least one AA battery and one D battery, multiplying by 2. Solution is now {1}.", moduleId, finalSolution);
            }
            //If the serial number has 4 letters, subtract 290
            if (serialLetterSpecial)
            {
                finalSolution -= 290;
                Debug.LogFormat(@"[Modulus Manipulation #{0}] Serial number has 4 letters, subtracting 290. Solution is now {1}.", moduleId, finalSolution);
            }
        }
        if (otherModsRemainingCount % 3 == 0)
        {
            Debug.LogFormat(@"[Modulus Manipulation #{0}] Rule set 3 is applicable.", moduleId);
            //If the bomb has more than three batteries, subtract 160
            if (batteryCount > 3)
            {
                finalSolution -= 160;
                Debug.LogFormat(@"[Modulus Manipulation #{0}] Bomb has more than three batteries, subtracting 160. Solution is now {1}.", moduleId, finalSolution);
            }
            //If the bomb has more lit indicators than unlit indicators, add 75
            if (litIndicatorCount > unlitIndicatorCount)
            {
                finalSolution += 75;
                Debug.LogFormat(@"[Modulus Manipulation #{0}] Bomb has more lit indicators than unlit indicators, adding 75. Solution is now {1}.", moduleId, finalSolution);
            }
        }
        if (otherModsRemainingCount % 2 == 0)
        {
            Debug.LogFormat(@"[Modulus Manipulation #{0}] Rule set 2 is applicable.", moduleId);
            //If the serial number has a vowel, add 340
            if (serialVowel)
            {
                finalSolution += 340;
                Debug.LogFormat(@"[Modulus Manipulation #{0}] Serial number has a vowel, adding 340. Solution is now {1}.", moduleId, finalSolution);
            }
            //If the bomb has a PS/2, RJ-45, or Serial port, add 180
            if (containsSpecificPorts)
            {
                finalSolution += 180;
                Debug.LogFormat(@"[Modulus Manipulation #{0}] Bomb has a PS/2, RJ-45, or Serial port, adding 180. Solution is now {1}.", moduleId, finalSolution);
            }
        }
        //Anything modulus 1 is 0, so rule set 1 always applies and needs no if statement
        Debug.LogFormat(@"[Modulus Manipulation #{0}] Rule set 1 is applicable.", moduleId);
        //If the bomb has at least one strike, subtract 45
        if (strikeCount >= 1)
        {
            finalSolution -= 45;
            Debug.LogFormat(@"[Modulus Manipulation #{0}] Bomb has at least one strike, subtracting 45. Solution is now {1}.", moduleId, finalSolution);
        }
        //If the bomb has any unlit indicators, subtract 15
        if (unlitIndicatorCount > 0)
        {
            finalSolution -= 15;
            Debug.LogFormat(@"[Modulus Manipulation #{0}] Bomb has at least one unlit indicator, subtracting 15. Solution is now {1}.", moduleId, finalSolution);
        }
        //If the last digit of the serial number is even, add 150
        if (serialLastDigitEven)
        {
            finalSolution += 150;
            Debug.LogFormat(@"[Modulus Manipulation #{0}] Last digit of the serial number is even, adding 150. Solution is now {1}.", moduleId, finalSolution);
        }
        //If the number of minutes remaining on the countdown timer is even (or 0), add 6
        if (minutesRemainingIsEven)
        {
            finalSolution += 6;
            Debug.LogFormat(@"[Modulus Manipulation #{0}] Minutes remaining is even or 0, adding 6. Solution is now {1}.", moduleId, finalSolution);
        }

        //Compare final solution with input
        if (finalSolution < 0)
        {
            finalSolution = 0;
            Debug.LogFormat(@"[Modulus Manipulation #{0}] Calculated solution was negative, so final solution is 0.", moduleId);
        }
        else
        {
            finalSolution %= 1000;
            Debug.LogFormat(@"[Modulus Manipulation #{0}] Final solution is {1}.", moduleId, finalSolution);
        }
        if (submission == finalSolution)
        {
            bombModule.HandlePass();
            Debug.LogFormat(@"[Modulus Manipulation #{0}] Submission was correct. Module passed.", moduleId);
        }
        else
        {
            bombModule.HandleStrike();
            Debug.LogFormat(@"[Modulus Manipulation #{0}] Submission was incorrect. Strike occurred.", moduleId);
        }
    }
    public void Start()
    {
        Instance           = this;
        BombModule         = GetComponent <KMBombModule>();
        Audio              = GetComponent <KMAudio>();
        Submission         = Screen.Traverse <TextMesh>("Submission");
        SubmissionMaterial = Submission.GetComponent <Renderer>().material;
        moduleID           = idCounter++;

        // Setup the buttons
        for (int i = 0; i < 12; i++)
        {
            KMSelectable selectable = Numberpad[i];
            selectable.AddInteract(() =>
            {
                if (NotInteractable)
                {
                    return(false);
                }

                Audio.PlaySoundAtTransform("ButtonPress", transform);
                UserInput += selectable.gameObject.Traverse <TextMesh>("ButtonText").text;

                return(true);
            });
        }

        ClearButton.AddInteract(() =>
        {
            if (NotInteractable)
            {
                return(false);
            }

            Audio.PlaySoundAtTransform("ButtonPress", transform);
            UserInput = null;
            return(true);
        });

        SubmitButton.AddInteract(() =>
        {
            if (NotInteractable)
            {
                return(false);
            }

            if (string.IsNullOrEmpty(UserInput))
            {
                CustomDisplayText = "UNDEFINED";
            }

            Audio.PlaySoundAtTransform("ButtonPress", transform);
            decimal result;
            if ((CurrentEquation.ValueUndefined && string.IsNullOrEmpty(UserInput)) || (!CurrentEquation.ValueUndefined && decimal.TryParse(UserInput, out result) && result == CurrentEquation.Value))
            {
                isSolved = true;
                StartCoroutine(SolveAnimation());
            }
            else
            {
                StartCoroutine(StrikeAnimation());
            }

            return(true);
        });

        // Generate up to 1000 equations until we get one that doesn't throw an exception.
        for (int i = 0; i < 1000; i++)
        {
            try
            {
                CurrentEquation = Equation.Generate();
                decimal EquationValue = CurrentEquation.Value;
            }
            catch (DivideByZeroException)
            {
                // Catch any division by zero, to mark the equation as having an undefined value.
                CurrentEquation.ValueUndefined = true;
            }
            catch (OverflowException)
            {
                // The numbers on this module can get really big, too big for the decimal type:
                // "The highest possible value for an operand is 125,000,000,000 (125 trillion), which is a "?" with no shape, a "|" facing west, and a "C" exponent.
                // If all three operands are this combination, and they're all connected by multiplication only, the total adds up to...
                // 1,953,125,000,000,000,000,000,000,000,000,000 / 1.953125 x 10 ^ 33 / 1.953125 decillion" - Lumbud84
                CurrentEquation = null;
            }
            catch (Exception exception)
            {
                Log("Unexpected exception occured, solving module: ");
                Debug.LogException(exception);
                BombModule.HandlePass();
            }

            if (CurrentEquation != null)
            {
                break;
            }
        }

        // If we weren't able to generate a valid equation, force solve.
        if (CurrentEquation == null)
        {
            Log("Unable to generate a valid equation, solving module.");
            BombModule.HandlePass();
        }

        Log("Equation:\n" + CurrentEquation.LogMessage);

        CurrentEquation.Display(Screen.Traverse("Equation"));
    }
Beispiel #25
0
    void Start()
    {
        disarmButton.OnInteract += delegate {
            audioSelf.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform);
            isPressedDisarm = true;
            return(false);
        };
        disarmButton.OnInteractEnded += delegate
        {
            disarmButton.AddInteractionPunch(1f);
            audioSelf.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonRelease, transform);
            isPressedDisarm = false;
            if (isSolved)
            {
                modSelf.HandlePass();
                hasDisarmed = true;
            }
        };
        buttonFront.OnInteract += delegate
        {
            audioSelf.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonPress, transform);
            if (!isSolved && hasActivated)
            {
                singularityButtonInfo.HandleInteraction(this, (int)bombInfo.GetTime());
            }
            isPressedMain = true;
            onHoldState   = hasActivated;
            return(false);
        };
        buttonFront.OnInteractEnded += delegate
        {
            audioSelf.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonRelease, transform);
            buttonFront.AddInteractionPunch();
            if (!isSolved && hasActivated && onHoldState)
            {
                singularityButtonInfo.HandleInteraction(this, (int)bombInfo.GetTime());
            }
            isPressedMain = false;
        };
        modSelf.OnActivate += delegate
        {
            // Setup Global Interaction
            KMBomb bombAlone = entireModule.GetComponentInParent <KMBomb>();            // Get the bomb that the module is attached on. Required for intergration due to modified value.
            //Required for Multiple Bombs stable interaction in case of different bomb seeds.

            if (!groupedSingularityButtons.ContainsKey(bombAlone))
            {
                groupedSingularityButtons[bombAlone] = new SingularityButtonInfo();
            }
            singularityButtonInfo = groupedSingularityButtons[bombAlone];
            singularityButtonInfo.singularButtons.Add(this);
            colorblindDetected = colorblindMode.ColorblindModeActive;
            // Start Main Handling
            //AddOthersModulesOntoList();
            StartCoroutine(HandleGlobalModule());
            hasActivated = true;
        };
        bombInfo.OnBombExploded += delegate
        {
            singularityButtonInfo.StopAll();
        };
    }
Beispiel #26
0
    IEnumerator animation()
    {
        modulePlate.transform.localRotation = new Quaternion(0, 0, 0, -1f);
        modulePlate.transform.localPosition = new Vector3(modulePlate.transform.localPosition.x, 0.1f, modulePlate.transform.localPosition.z);
        float rotatex   = 0;
        float rotatey   = 0;
        float rotatez   = 0;
        float rotatew   = -1f;
        float positionx = modulePlate.transform.localPosition.x;
        float positiony = modulePlate.transform.localPosition.y;
        float positionz = modulePlate.transform.localPosition.z;

        for (int aa = 0; aa < 100; aa++)
        {
            rotatez   += 0.01f;
            positiony += 0.0001f;
            positionx += 0.0008f;
            modulePlate.transform.localPosition = new Vector3(positionx, positiony, positionz);
            modulePlate.transform.localRotation = new Quaternion(rotatex, rotatey, rotatez, rotatew);
            yield return(new WaitForSeconds(0.01f));
        }
        yield return(new WaitForSeconds(1f));

        for (int aa = 0; aa < 100; aa++)
        {
            rotatex   += 0.005f;
            rotatey   += 0.005f;
            positionz -= 0.0008f;
            positiony += 0.00025f;
            modulePlate.transform.localRotation = new Quaternion(rotatex, rotatey, rotatez, rotatew);
            modulePlate.transform.localPosition = new Vector3(positionx, positiony, positionz);
            yield return(new WaitForSeconds(0.005f));
        }
        for (int aa = 0; aa < 50; aa++)
        {
            rotatex   -= 0.005f;
            rotatey   -= 0.005f;
            positionz += 0.0008f;
            positiony -= 0.00025f;
            modulePlate.transform.localRotation = new Quaternion(rotatex, rotatey, rotatez, rotatew);
            modulePlate.transform.localPosition = new Vector3(positionx, positiony, positionz);
            yield return(new WaitForSeconds(0.005f));
        }
        for (int aa = 0; aa < 50; aa++)
        {
            rotatex   += 0.005f;
            rotatey   += 0.005f;
            positionz -= 0.0008f;
            positiony += 0.00025f;
            modulePlate.transform.localRotation = new Quaternion(rotatex, rotatey, rotatez, rotatew);
            modulePlate.transform.localPosition = new Vector3(positionx, positiony, positionz);
            yield return(new WaitForSeconds(0.005f));
        }
        for (int aa = 0; aa < 50; aa++)
        {
            rotatex   -= 0.005f;
            rotatey   -= 0.005f;
            positionz += 0.0008f;
            positiony -= 0.00025f;
            modulePlate.transform.localRotation = new Quaternion(rotatex, rotatey, rotatez, rotatew);
            modulePlate.transform.localPosition = new Vector3(positionx, positiony, positionz);
            yield return(new WaitForSeconds(0.005f));
        }
        for (int aa = 0; aa < 50; aa++)
        {
            rotatex   += 0.005f;
            rotatey   += 0.005f;
            positionz -= 0.0008f;
            positiony += 0.00025f;
            modulePlate.transform.localRotation = new Quaternion(rotatex, rotatey, rotatez, rotatew);
            modulePlate.transform.localPosition = new Vector3(positionx, positiony, positionz);
            yield return(new WaitForSeconds(0.005f));
        }
        for (int aa = 0; aa < 100; aa++)
        {
            positionz -= 0.02f;
            rotatew   += 0.02f;
            modulePlate.transform.localPosition = new Vector3(positionx, positiony, positionz);
            modulePlate.transform.localRotation = new Quaternion(rotatex, rotatey, rotatez, rotatew);
            yield return(new WaitForSeconds(0.005f));
        }
        modulePlate.transform.localScale = new Vector3(0f, 0f, 0f);
        audio.PlaySoundAtTransform(solveSound.name, transform);
        module.HandlePass();
    }
Beispiel #27
0
    private void Awake()
    {
        moduleId = moduleIdCounter++;
        foreach (KMSelectable button in buttons)
        {
            button.OnInteract += delegate() { PressButton(button); return(false); }
        }
        ;
        submit.OnInteract += delegate() { PressSubmit(); return(false); };
        clear.OnInteract  += delegate() { PressClear(); return(false); };
    }

    void Start()
    {
        SetupDict();
        int moduleCode = Random.Range(0, moduleNames.Length);

        answer = moduleNames[moduleCode];
        string anagram = modules[answer];

        ana.text = anagram.ToUpper();
        ans.text = "";
        foreach (GameObject but in buttonObjects)
        {
            but.SetActive(false);
        }

        foreach (char letter in answer.ToUpper().ToCharArray())
        {
            buttonObjects[keys[letter]].SetActive(true);
        }
        Debug.LogFormat("[Insanagrams #{0}] Anagram: '{1}', Answer: '{2}'", moduleId, anagram, answer);
    }

    void PressButton(KMSelectable button)
    {
        newAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, button.transform);
        button.AddInteractionPunch(.5f);
        if (moduleSolved)
        {
            return;
        }
        if (Array.IndexOf(buttons, button) == 45)
        {
            ans.text += " ";
        }
        else
        {
            ans.text += button.GetComponentInChildren <TextMesh>().text;
        }
    }

    void PressSubmit()
    {
        newAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, submit.transform);
        if (moduleSolved)
        {
            return;
        }
        if (ans.text.ToUpper().Equals(answer.ToUpper()))
        {
            module.HandlePass();
            moduleSolved = true;
            newAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, submit.transform);
            Debug.LogFormat("[Insanagrams #{0}] Solved!", moduleId);
        }
        else
        {
            module.HandleStrike();
            Debug.LogFormat("[Insanagrams #{0}] Strike! Inputted: '{1}'. If you feel like this is an error, contact TasThing#5896 on Discord with a copy of this log file.", moduleId, ans.text);
            ans.text = "";
        }
    }

    void PressClear()
    {
        newAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, submit.transform);
        if (moduleSolved)
        {
            return;
        }
        Debug.LogFormat("[Insanagrams #{0}] Clear pressed. Text cleared: '{1}'.", moduleId, ans.text);
        ans.text = "";
    }

    void SetupDict()
    {
        keys.Add('A', 0);
        keys.Add('B', 1);
        keys.Add('C', 2);
        keys.Add('D', 3);
        keys.Add('E', 4);
        keys.Add('F', 5);
        keys.Add('G', 6);
        keys.Add('H', 7);
        keys.Add('I', 8);
        keys.Add('J', 9);
        keys.Add('K', 10);
        keys.Add('L', 11);
        keys.Add('M', 12);
        keys.Add('N', 13);
        keys.Add('O', 14);
        keys.Add('P', 15);
        keys.Add('Q', 16);
        keys.Add('R', 17);
        keys.Add('S', 18);
        keys.Add('T', 19);
        keys.Add('U', 20);
        keys.Add('V', 21);
        keys.Add('W', 22);
        keys.Add('X', 23);
        keys.Add('Y', 24);
        keys.Add('Z', 25);
        keys.Add('1', 26);
        keys.Add('2', 27);
        keys.Add('3', 28);
        keys.Add('4', 29);
        keys.Add('5', 30);
        keys.Add('6', 31);
        keys.Add('7', 32);
        keys.Add('8', 33);
        keys.Add('9', 34);
        keys.Add('0', 35);
        keys.Add('-', 36);
        keys.Add('[', 37);
        keys.Add(']', 38);
        keys.Add('\'', 39);
        keys.Add('.', 40);
        keys.Add('!', 41);
        keys.Add('?', 42);
        keys.Add('&', 43);
        keys.Add('^', 44);
        keys.Add(' ', 45);
        keys.Add(',', 46);


        moduleNames = new String[] { "101 Dalmatians", "3D Maze", "3D Tunnels", "Accumulation", "Adjacent Letters", "Adventure Game", "Air Traffic Controller", "Alchemy", "Algebra", "Alphabetical Order", "Alphabet Numbers", "Alphabet", "Anagrams", "Answering Questions", "Astrology", "Backgrounds", "Bartending", "Bases", "Battleship", "Benedict Cumberbatch", "Big Circle", "Binary LEDs", "Binary Puzzle", "Binary Tree", "Bitmaps", "Bitwise Operations", "Black Hole", "Blackjack", "Blind Alley", "Blind Maze", "Blockbusters", "Blue Cipher", "Boggle", "Boolean Maze", "Boolean Venn Diagram", "Braille", "British Slang", "Broken Buttons", "Broken Guitar Chords", "Burglar Alarm", "Button Masher", "Button Sequence", "Caesar Cipher", "Calendar", "Capacitor Discharge", "Catchphrase", "Challenge & Contact", "Character Shift", "Chinese Counting", "Cheap Checkout", "Chess", "Chord Qualities", "Christmas Presents", "Coffeebucks", "Color Addition", "Color Decoding", "Colored Squares", "Colored Switches", "Color Flash", "Colorful Insanity", "Colorful Madness", "Color Generator", "Color Match", "Color Math", "Color Morse", "Combination Lock", "Command Prompt", "Complex Keypad", "Complicated Buttons", "Complicated Wires", "Connection Check", "Connection Device", "Cookie Jars", "Cooking", "Coordinates", "Countdown", "Crackbox", "Crazy Talk", "Creation", "Cruel Countdown", "Cruel Piano Keys", "Cryptography", "Curriculum", "Cursed Double-Oh", "Decolored Squares", "Determinants", "DetoNATO", "Digital Cipher", "Digital Root", "Discolored Squares", "Divided Squares", "Dominoes", "Double-Oh", "Double Color", "Dr. Doctor", "Dragon Energy", "Edgework", "Elder Futhark", "Emoji Math", "Encrypted Morse", "Encryption Bingo", "English Test", "Equations", "Error Codes", "European Travel", "Extended Password", "Factoring", "Factory Maze", "Fast Math", "Faulty Backgrounds", "Festive Piano Keys", "Filibuster", "FizzBuzz", "Flags", "Flashing Lights", "Flavor Text EX", "Flavor Text", "Flip The Coin", "Follow the Leader", "Font Select", "Foreign Exchange Rates", "Forget Everything", "Forget Me Not", "Forget This", "Free Parking", "Friendship", "Functions", "Gadgetron Vendor", "Game of Life Cruel", "Game of Life Simple", "Geometry Dash", "Genetic Sequence", "Graffiti Numbers", "Greek Calculus", "Green Cipher", "Gridlock", "Grid Matching", "Guitar Chords", "Harmony Sequence", "Hexamaze", "Hex To Decimal", "Hieroglyphics", "Hogwarts", "Homophones", "Horrible Memory", "Hot Potato", "HTTP Response", "Human Resources", "Hunting", "Ice Cream", "Identity Parade", "IKEA", "Indigo Cipher", "Insanagrams", "Instructions", "Keypad", "Knob", "Know Your Way", "Krazy Talk", "Kudosudoku", "Lasers", "Laundry", "LED Encryption", "LED Grid", "LED Math", "Left And Right", "LEGO", "Letter Keys", "Light Cycle", "Lights Out", "Lightspeed", "Lion's Share", "Listening", "Logical Buttons", "Logic Gates", "Logic", "Mad Memory", "Mafia", "Mahjong", "Maintenance", "Manometers", "Marble Tumble", "Maritime Flags", "Mashematics", "Mastermind Cruel", "Mastermind Simple", "Math", "Maze Scrambler", "Maze", "Melody Sequencer", "Memory", "Micro-Modules", "Microcontroller", "Mineseeker", "Minesweeper", "Modern Cipher", "Module Homework", "Module Maze", "Modules Against Humanity", "Modulo", "Monsplode, Fight!", "Monsplode Trading Cards", "Morse-A-Maze", "Morse Code", "Morse Identification", "Morsematics", "Morse War", "Mortal Kombat", "Motion Sense", "Mouse In The Maze", "Murder", "Mystic Square", "Needy Mrs Bob", "Neutralization", "Nonogram", "Number Nimbleness", "Number Pad", "Numbers", "Only Connect", "Orientation Cube", "Painting", "Party Time", "Passport Control", "Password", "Pattern Cube", "Pay Respects", "Periodic Table", "Perplexing Wires", "Perspective Pegs", "Piano Keys", "Pie", "Pigpen Rotations", "Playfair Cipher", "Plumbing", "Poetry", "Point of Order", "Poker", "Polyhedral Maze", "Press X", "Probing", "QR Code", "Question Mark", "Quintuples", "Radiator", "Random Number Generator", "Rapid Buttons", "Refill that Beer!", "Regular Crazy Talk", "Resistors", "Retirement", "Reverse Morse", "Rhythms", "Rock-Paper-Scissors-Lizard-Spock", "Rotary Phone", "Round Keypad", "Rubik's Clock", "Rubik's Cube", "S.E.T.", "Safety Safe", "Schlag den Bomb", "Scripting", "Sea Shells", "Semaphore", "Shape Memory", "Shapes And Bombs", "Shape Shift", "Shikaku", "Signals", "Silly Slots", "Simon's Sequence", "Simon's Stages", "Simon's Star", "Simon Samples", "Simon Says", "Simon Scrambles", "Simon Screams", "Simon Sends", "Simon Shrieks", "Simon Sings", "Simon Sounds", "Simon Speaks", "Simon Spins", "Simon Squawks", "Simon States", "Sink", "Skewed Slots", "Skinny Wires", "Skyrim", "Snooker", "Sonic & Knuckles", "Sonic the Hedgehog", "Souvenir", "Spinning Buttons", "Splitting The Loot", "Square Button", "Street Fighter", "Subways", "Sueet Wall", "Superlogic", "Switches", "Symbol Cycle", "Symbolic Coordinates", "Symbolic Password", "SYNC-125 [3]", "Synchronization", "Synonyms", "T-Words", "Tangrams", "Tap Code", "Tasha Squeals", "Tax Returns", "Ten-Button Color Code", "Tennis", "Ternary Converter", "Tetris", "Text Field", "The Bulb", "The Button", "The Clock", "The Code", "The Crystal Maze", "The Cube", "The Digit", "The Festive Jukebox", "The Fidget Spinner", "The Gamepad", "The Hangover", "The Hexabutton", "The iPhone", "The Jack-O'-Lantern", "The Jewel Vault", "The Jukebox", "The Labyrinth", "The London Underground", "The Moon", "The Number Cipher", "The Number", "The Plunger Button", "The Plunger", "The Radio", "The Screw", "The Sphere", "The Stock Market", "The Stopwatch", "The Sun", "The Swan", "The Switch", "The Time Keeper", "The Triangle", "The Wire", "Third Base", "Tic Tac Toe", "Timezone", "Tower of Hanoi", "Turn The Keys", "Turn The Key", "Turtle Robot", "Two Bits", "Ultrastores", "Uncolored Squares", "Unfair Cipher", "Unrelated Anagrams", "USA Maze", "Valves", "Varicolored Squares", "Venting Gas", "Violet Cipher", "Visual Impairment", "Waste Management", "Web Design", "Westeros", "Who's on First", "Who's That Monsplode", "Wingdings", "Wire Placement", "Wire Sequence", "Wire Spaghetti", "Wires", "Word Scramble", "Word Search", "X-Ray", "X01", "Yahtzee", "Zoni", "Zoo", "Subscribe to Pewdiepie", "Grocery Store", "Draw", "Burger Alarm", "Purgatory", "Mega Man 2", "Lombax Cubes", "The Stare", "Graphic Memory", "Quiz Buzz", "Wavetapping", "The Hypercube", "Speak English", "Stack'em", "Seven Wires", "Colored Keys", "The Troll", "Planets", "The Necronomicon", "Four-Card Monte", "Aa", "The Witness", "The Giant's Drink", "Digit String", "Alpha", "Snap!", "Hidden Colors", "Colour Code", "Vexillology", "Brush Strokes", "Odd One Out", "The Triangle Button", "Mazematics", "Equations X", "Maze^3", "Yellow Cipher", "Orange Cipher", "Red Cipher", "Faulty RGB Maze", "Forget Me Later", "Garfield Kart", "Footnotes", "Bamboozling Button", "Fruits", "The Modkit", "Tetravex", "Flower Patch", "Matchematics", "Caesar Cycle", "Playfair Cycle", "Cryptic Cycle", "Ultimate Cycle", "Bamboozling Button Grid", "Old Fogey", "The Ultracube", "Snakes and Ladders", "Module Movements", "Roman Numerals", "Red Buttons", "The Rule", "Lousy Chess", "Keypad Lock", "Eight Pages", "The Colored Maze", "White Cipher", "Gray Cipher", "Black Cipher", "The Hyperlink", "Corners", "The High Score",
                                     "Ingredients", "Intervals", "Cheep Checkout", "Spelling Bee", "Thinking Wires", "Seven Choose Four", "Object Shows", "Lunchtime", "Natures", "Neutrinos", "Scavenger Hunt", "Polygons", "Codenames", "Odd Mod Out", "Blinkstop", "Forget It Not", "Rainbow Arrows", "Passcodes", "Digital Dials", "Lines of Code", "Encrypted Dice", "Colorful Dials", "Atbash Cipher", "Addition", "Matrices", "Cruel Keypads", "The Black Page", "Simon Forgets", "Greek Letter Grid", "Going Backwards", "Scalar Dials", "Keywords", "The Crafting Table" };

        modules.Add("101 Dalmatians", "101 Natal Maids");
        modules.Add("3D Maze", "Am Zed 3");
        modules.Add("3D Tunnels", "Lend 3 Nuts");
        modules.Add("Accumulation", "I Am Uncut Cola");
        modules.Add("Adjacent Letters", "Calendar Jet Test");
        modules.Add("Adventure Game", "Meet Guava Nerd");
        modules.Add("Air Traffic Controller", "Antarctic Floor Rifler");
        modules.Add("Alchemy", "Hey Clam");
        modules.Add("Algebra", "Lab Gear");
        modules.Add("Alphabetical Order", "A Birthplace Reload");
        modules.Add("Alphabet Numbers", "A Bat Burns Me Help");
        modules.Add("Alphabet", "Bath Leap");
        modules.Add("Anagrams", "A Mr Sagan");
        modules.Add("Answering Questions", "Earn Wings Noses Quit");
        modules.Add("Astrology", "Royals Tog");
        modules.Add("Backgrounds", "Dragon Bucks");
        modules.Add("Bartending", "Intend Brag");
        modules.Add("Bases", "Sea BS");
        modules.Add("Battleship", "Hip Tablets");
        modules.Add("Benedict Cumberbatch", "Butch Em Bent Iced Crab");
        modules.Add("Big Circle", "Big Cleric");
        modules.Add("Binary LEDs", "Badly Risen");
        modules.Add("Binary Puzzle", "Early Buzz Pin");
        modules.Add("Binary Tree", "Bye Terrain");
        modules.Add("Bitmaps", "Ms Pi Bat");
        modules.Add("Bitwise Operations", "Is It Web Arose Point");
        modules.Add("Black Hole", "Be Lo Chalk");
        modules.Add("Blackjack", "Cab JK Lack");
        modules.Add("Blind Alley", "A Lend By Ill");
        modules.Add("Blind Maze", "Me Land Biz");
        modules.Add("Blockbusters", "Rubble Stocks");
        modules.Add("Blue Cipher", "Burp Lichee");
        modules.Add("Boggle", "Log Beg");
        modules.Add("Boolean Maze", "Enable A Zoom");
        modules.Add("Boolean Venn Diagram", "Drag Aim Ban Novel One");
        modules.Add("Braille", "Ill Bear");
        modules.Add("British Slang", "Snails Bright");
        modules.Add("Broken Buttons", "Stubborn Token");
        modules.Add("Broken Guitar Chords", "A Corgi Dubs Horn Trek");
        modules.Add("Burglar Alarm", "Rural Lamb Rag");
        modules.Add("Button Masher", "Share Tomb Nut");
        modules.Add("Button Sequence", "On Ten Cube Quest");
        modules.Add("Caesar Cipher", "Crisp Ear Ache");
        modules.Add("Calendar", "Red Canal");
        modules.Add("Capacitor Discharge", "It Graced His Orca Cap");
        modules.Add("Catchphrase", "Cash Chapter");
        modules.Add("Challenge & Contact", "Agent Cloth & Cancel");
        modules.Add("Character Shift", "Scratch Hat Fire");
        modules.Add("Chinese Counting", "Eugenic Notch Sin");
        modules.Add("Cheap Checkout", "Oh Cupcake Tech");
        modules.Add("Chess", "SS Ech");
        modules.Add("Chord Qualities", "Quad Ostrich Lie");
        modules.Add("Christmas Presents", "Pens Rest Charm Sits");
        modules.Add("Coffeebucks", "Beck Cue Offs");
        modules.Add("Color Addition", "Cation Lid Door");
        modules.Add("Color Decoding", "Diced Corn Logo");
        modules.Add("Colored Squares", "Dress Or Coequal");
        modules.Add("Colored Switches", "Witches Close Rod");
        modules.Add("Color Flash", "Call For Hos");
        modules.Add("Colorful Insanity", "Run So Fictionally");
        modules.Add("Colorful Madness", "Mad Focus Enrolls");
        modules.Add("Color Generator", "Lone Rotor Grace");
        modules.Add("Color Match", "Halt Mr Coco");
        modules.Add("Color Math", "Roam Cloth");
        modules.Add("Color Morse", "Mr Sore Cool");
        modules.Add("Combination Lock", "Black Coin Motion");
        modules.Add("Command Prompt", "Mr Mod Pant Comp");
        modules.Add("Complex Keypad", "My Explode Pack");
        modules.Add("Complicated Buttons", "Placed Bottom Tunics");
        modules.Add("Complicated Wires", "Rides Camel Tip Cow");
        modules.Add("Connection Check", "Chick Con One Cent");
        modules.Add("Connection Device", "Once Vented Iconic");
        modules.Add("Cookie Jars", "Is Orca Joke");
        modules.Add("Cooking", "Nick Goo");
        modules.Add("Coordinates", "Second Ratio");
        modules.Add("Countdown", "On Duct Now");
        modules.Add("Crackbox", "Cork Cab X");
        modules.Add("Crazy Talk", "Lazy Track");
        modules.Add("Creation", "Rate Icon");
        modules.Add("Cruel Countdown", "Run Coconut Weld");
        modules.Add("Cruel Piano Keys", "Recoup Sky Alien");
        modules.Add("Cryptography", "Try Choppy Rag");
        modules.Add("Curriculum", "I Curl Mu Cur");
        modules.Add("Cursed Double-Oh", "Should Cube-Redo");
        modules.Add("Decolored Squares", "A Corroded Sequels");
        modules.Add("Determinants", "Tanned Mister");
        modules.Add("DetoNATO", "To Donate");
        modules.Add("Digital Cipher", "Pi Acid Lighter");
        modules.Add("Digital Root", "Dog Tail Riot");
        modules.Add("Discolored Squares", "Careless Squid Door");
        modules.Add("Divided Squares", "Revise Dad Squid");
        modules.Add("Dominoes", "Dime Soon");
        modules.Add("Double-Oh", "Blood-hue");
        modules.Add("Double Color", "Cool Boulder");
        modules.Add("Dr. Doctor", "Cord. Trod");
        modules.Add("Dragon Energy", "Grand Grey One");
        modules.Add("Edgework", "Word Geek");
        modules.Add("Elder Futhark", "Father Lurked");
        modules.Add("Emoji Math", "He Omit Jam");
        modules.Add("Encrypted Morse", "Ms Creed Entropy");
        modules.Add("Encryption Bingo", "Benign Cry Option");
        modules.Add("English Test", "Tense Lights");
        modules.Add("Equations", "In Quote As");
        modules.Add("Error Codes", "Score Order");
        modules.Add("European Travel", "A Nepal Overture");
        modules.Add("Extended Password", "Next Spades Worded");
        modules.Add("Factoring", "Acorn Gift");
        modules.Add("Factory Maze", "To Crazy Fame");
        modules.Add("Fast Math", "That Ms Fa");
        modules.Add("Faulty Backgrounds", "Arguably Duck Fonts");
        modules.Add("Festive Piano Keys", "Pokeys Vine Fiesta");
        modules.Add("Filibuster", "Built Fires");
        modules.Add("FizzBuzz", "Bizz Fuzz");
        modules.Add("Flags", "SF Lag");
        modules.Add("Flashing Lights", "Gall Fish Things");
        modules.Add("Flavor Text EX", "To Flax Vertex");
        modules.Add("Flavor Text", "Flat Vortex");
        modules.Add("Flip The Coin", "Fiction Help");
        modules.Add("Follow the Leader", "Defeat Whole Roll");
        modules.Add("Font Select", "Elf Net Cost");
        modules.Add("Foreign Exchange Rates", "A Teachers Genre Foxing");
        modules.Add("Forget Everything", "Very Tethering Fog");
        modules.Add("Forget Me Not", "Ten Foot Germ");
        modules.Add("Forget This", "To Fighters");
        modules.Add("Free Parking", "Fire Rank Peg");
        modules.Add("Friendship", "Shred If Pin");
        modules.Add("Functions", "Unfit Cons");
        modules.Add("Gadgetron Vendor", "Not Graded Govern");
        modules.Add("Game of Life Cruel", "Cameo Figure Fell");
        modules.Add("Game of Life Simple", "Female Implies Fog");
        modules.Add("Geometry Dash", "Gated Rye Ohms");
        modules.Add("Genetic Sequence", "Get Science Queen");
        modules.Add("Graffiti Numbers", "Rift Beam Surfing");
        modules.Add("Greek Calculus", "Glue Us Crackle");
        modules.Add("Green Cipher", "He Rep Cringe");
        modules.Add("Gridlock", "Gold Rick");
        modules.Add("Grid Matching", "Mind Chart Gig");
        modules.Add("Guitar Chords", "Guard Ostrich");
        modules.Add("Harmony Sequence", "Shy Queen Romance");
        modules.Add("Hexamaze", "Haze Exam");
        modules.Add("Hex To Decimal", "Aced Hotel Mix");
        modules.Add("Hieroglyphics", "Holy Pig Riches");
        modules.Add("Hogwarts", "Raw Goths");
        modules.Add("Homophones", "No Home Hops");
        modules.Add("Horrible Memory", "Me Blimey Horror");
        modules.Add("Hot Potato", "Tattoo Hop");
        modules.Add("HTTP Response", "Hen Strep Stop");
        modules.Add("Human Resources", "Ace Nurses Humor");
        modules.Add("Hunting", "Hint Gun");
        modules.Add("Ice Cream", "Mice Race");
        modules.Add("Identity Parade", "Painted Dietary");
        modules.Add("IKEA", "I Eak");
        modules.Add("Indigo Cipher", "Heroic Pidgin");
        modules.Add("Insanagrams", "Assign An Arm");
        modules.Add("Instructions", "Us Or Instinct");
        modules.Add("Keypad", "APK Dye");
        modules.Add("Knob", "Bonk");
        modules.Add("Know Your Way", "Yuk Yo Own Raw");
        modules.Add("Krazy Talk", "Talky Ark Z");
        modules.Add("Kudosudoku", "Duo Kou Dusk");
        modules.Add("Lasers", "Re Lass");
        modules.Add("Laundry", "Run Lady");
        modules.Add("LED Encryption", "Lyric Deponent");
        modules.Add("LED Grid", "Girdled");
        modules.Add("LED Math", "Mat Held");
        modules.Add("Left And Right", "Darling Theft");
        modules.Add("LEGO", "El Go");
        modules.Add("Letter Keys", "Elk Tyre Set");
        modules.Add("Light Cycle", "Eight LLC YC");
        modules.Add("Lights Out", "Tight Soul");
        modules.Add("Lightspeed", "Hedge Split");
        modules.Add("Lion's Share", "Hon's Serial");
        modules.Add("Listening", "In Tin Legs");
        modules.Add("Logical Buttons", "Bacon Guilt Lost");
        modules.Add("Logic Gates", "Locates Gig");
        modules.Add("Logic", "I Clog");
        modules.Add("Mad Memory", "Dear Mommy");
        modules.Add("Mafia", "I Am Fa");
        modules.Add("Mahjong", "Mag John");
        modules.Add("Maintenance", "Mice Antenna");
        modules.Add("Manometers", "Rename Most");
        modules.Add("Marble Tumble", "Met Lemur Blab");
        modules.Add("Maritime Flags", "Legit Mrs Mafia");
        modules.Add("Mashematics", "Sea Mismatch");
        modules.Add("Mastermind Cruel", "Unclear Midterms");
        modules.Add("Mastermind Simple", "Smeared Mint Limps");
        modules.Add("Math", "Hat M");
        modules.Add("Maze Scrambler", "Blame Mrs Craze");
        modules.Add("Maze", "M Eaz");
        modules.Add("Melody Sequencer", "Elm Encodes Query");
        modules.Add("Memory", "Me Or My");
        modules.Add("Micro-Modules", "Room-Dice Slum");
        modules.Add("Microcontroller", "Correct Ill Moron");
        modules.Add("Mineseeker", "Me Rise Keen");
        modules.Add("Minesweeper", "Newer Pi Seem");
        modules.Add("Modern Cipher", "Perched Mr Ion");
        modules.Add("Module Homework", "Lowered Hook Mum");
        modules.Add("Module Maze", "Mum Ole Daze");
        modules.Add("Modules Against Humanity", "Yum Dalmatians Toes In Ugh");
        modules.Add("Modulo", "Om Loud");
        modules.Add("Monsplode, Fight!", "Golfed Months, Pi!");
        modules.Add("Monsplode Trading Cards", "Landscaped Dorm Sorting");
        modules.Add("Morse-A-Maze", "Mrs A-Zee-Roam");
        modules.Add("Morse Code", "Do Some Rec");
        modules.Add("Morse Identification", "A Moist Iron Deficient");
        modules.Add("Morsematics", "Scariest Mom");
        modules.Add("Morse War", "Ear Worms");
        modules.Add("Mortal Kombat", "Mr Balk Tomato");
        modules.Add("Motion Sense", "No Semitones");
        modules.Add("Mouse In The Maze", "Seem To Humanize");
        modules.Add("Murder", "Mr Rude");
        modules.Add("Mystic Square", "Yes Squirm Cat");
        modules.Add("Needy Mrs Bob", "Ye Bomb Nerds");
        modules.Add("Neutralization", "Outran Alien Zit");
        modules.Add("Nonogram", "Moron Nag");
        modules.Add("Number Nimbleness", "Nine Emblems Burns");
        modules.Add("Number Pad", "Damper Bun");
        modules.Add("Numbers", "Burns Me");
        modules.Add("Only Connect", "Cent Con Only");
        modules.Add("Orientation Cube", "Iceboat Neutrino");
        modules.Add("Painting", "Giant Pin");
        modules.Add("Party Time", "I Am Pretty");
        modules.Add("Passport Control", "Clan Troop Sports");
        modules.Add("Password", "Saw Drops");
        modules.Add("Pattern Cube", "Pecan Butter");
        modules.Add("Pay Respects", "Pease Crypts");
        modules.Add("Periodic Table", "Tidier Placebo");
        modules.Add("Perplexing Wires", "Griper Pixel News");
        modules.Add("Perspective Pegs", "I Respect Vegs Pep");
        modules.Add("Piano Keys", "Noisy Peak");
        modules.Add("Pie", "I PE");
        modules.Add("Pigpen Rotations", "Orientating Pops");
        modules.Add("Playfair Cipher", "Reply Hip Africa");
        modules.Add("Plumbing", "Blimp Gun");
        modules.Add("Poetry", "Pry Toe");
        modules.Add("Point of Order", "Portioned For");
        modules.Add("Poker", "Rope K");
        modules.Add("Polyhedral Maze", "Amazed Hype Roll");
        modules.Add("Press X", "SS Prex");
        modules.Add("Probing", "Pig Born");
        modules.Add("QR Code", "CEO Dr Q");
        modules.Add("Question Mark", "A Squirm Token");
        modules.Add("Quintuples", "Lupin Quest");
        modules.Add("Radiator", "Radio Art");
        modules.Add("Random Number Generator", "A Bartender Moon Germ Run");
        modules.Add("Rapid Buttons", "Bad Printouts");
        modules.Add("Refill that Beer!", "Fret Hill Berate!");
        modules.Add("Regular Crazy Talk", "A Larger Lazy Truck");
        modules.Add("Resistors", "Sis Resort");
        modules.Add("Retirement", "Entire Term");
        modules.Add("Reverse Morse", "Me Server Rose");
        modules.Add("Rhythms", "Mrs Hyth");
        modules.Add("Rock-Paper-Scissors-Lizard-Spock", "Socks-Carload-Crops-Zipper-Risks");
        modules.Add("Rotary Phone", "Rare Typhoon");
        modules.Add("Round Keypad", "Yup Dank Redo");
        modules.Add("Rubik's Clock", "Irk Cub's Lock");
        modules.Add("Rubik's Cube", "Rubie's Buck");
        modules.Add("S.E.T.", "E.S.T.");
        modules.Add("Safety Safe", "Eases Taffy");
        modules.Add("Schlag den Bomb", "Belch Bangs Mod");
        modules.Add("Scripting", "Pic String");
        modules.Add("Sea Shells", "Eels Slash");
        modules.Add("Semaphore", "Hear Poems");
        modules.Add("Shape Memory", "My Semaphore");
        modules.Add("Shapes And Bombs", "Mesh Bobs Pandas");
        modules.Add("Shape Shift", "The Spa Fish");
        modules.Add("Shikaku", "Us Khaki");
        modules.Add("Signals", "Is Slang");
        modules.Add("Silly Slots", "Still Lossy");
        modules.Add("Simon's Sequence", "Ms Queen's Conies");
        modules.Add("Simon's Stages", "Tango's Misses");
        modules.Add("Simon's Star", "Smart's Ions");
        modules.Add("Simon Samples", "Misnames Slop");
        modules.Add("Simon Says", "Noisy Mass");
        modules.Add("Simon Scrambles", "Blames Crimsons");
        modules.Add("Simon Screams", "Miss Romances");
        modules.Add("Simon Sends", "Noses Minds");
        modules.Add("Simon Shrieks", "Skirmish Ones");
        modules.Add("Simon Sings", "Missing Son");
        modules.Add("Simon Sounds", "Mid Suns Soon");
        modules.Add("Simon Speaks", "Eskimo Snaps");
        modules.Add("Simon Spins", "Miss No Snip");
        modules.Add("Simon Squawks", "Ms Quasi Knows");
        modules.Add("Simon States", "Season Mitts");
        modules.Add("Sink", "Inks");
        modules.Add("Skewed Slots", "Slowest Desk");
        modules.Add("Skinny Wires", "Sky Is Winner");
        modules.Add("Skyrim", "My Risk");
        modules.Add("Snooker", "Rooks En");
        modules.Add("Sonic & Knuckles", "Conk & Luckiness");
        modules.Add("Sonic the Hedgehog", "Eighth Echoed Song");
        modules.Add("Souvenir", "One Virus");
        modules.Add("Spinning Buttons", "Tin Snot Snub Ping");
        modules.Add("Splitting The Loot", "Telling Tooth Spit");
        modules.Add("Square Button", "Rants Bouquet");
        modules.Add("Street Fighter", "Register Theft");
        modules.Add("Subways", "Buy Saws");
        modules.Add("Sueet Wall", "Wallet Use");
        modules.Add("Superlogic", "Police Rugs");
        modules.Add("Switches", "Chew Sits");
        modules.Add("Symbol Cycle", "My Cos By Cell");
        modules.Add("Symbolic Coordinates", "Cabs Consider Limo Toy");
        modules.Add("Symbolic Password", "Bypass Limo Crowds");
        modules.Add("SYNC-125 [3]", "NYCs-123 [5]");
        modules.Add("Synchronization", "Crazy Thin Onions");
        modules.Add("Synonyms", "My SS Nony");
        modules.Add("T-Words", "Sword-T");
        modules.Add("Tangrams", "Grant Sam");
        modules.Add("Tap Code", "Cape Dot");
        modules.Add("Tasha Squeals", "He Salsa Squat");
        modules.Add("Tax Returns", "Ranters Tux");
        modules.Add("Ten-Button Color Code", "Outdo Nettle-Corncob");
        modules.Add("Tennis", "Nest In");
        modules.Add("Ternary Converter", "Contrary Reverent");
        modules.Add("Tetris", "Sitter");
        modules.Add("Text Field", "Fed Ex Tilt");
        modules.Add("The Bulb", "Belt Hub");
        modules.Add("The Button", "Hot Tub Ten");
        modules.Add("The Clock", "Etch Lock");
        modules.Add("The Code", "Doc Thee");
        modules.Add("The Crystal Maze", "Zesty Cream Halt");
        modules.Add("The Cube", "He Be Cut");
        modules.Add("The Digit", "It Get Hid");
        modules.Add("The Festive Jukebox", "Bee Jive Text Of Husk");
        modules.Add("The Fidget Spinner", "Deepening Thrifts");
        modules.Add("The Gamepad", "Aged Pet Ham");
        modules.Add("The Hangover", "Her Hot Vegan");
        modules.Add("The Hexabutton", "Beneath Hot Tux");
        modules.Add("The iPhone", "Oh Hip Teen");
        modules.Add("The Jack-O'-Lantern", "Can't Not-Heal-Jerk");
        modules.Add("The Jewel Vault", "We Jut Have Tell");
        modules.Add("The Jukebox", "But Hex Joke");
        modules.Add("The Labyrinth", "Try Health Bin");
        modules.Add("The London Underground", "Goldenrod Thunder Noun");
        modules.Add("The Moon", "One Moth");
        modules.Add("The Number Cipher", "Breech Hermit Pun");
        modules.Add("The Number", "Mr Hen Tube");
        modules.Add("The Plunger Button", "Tenth Upturn Globe");
        modules.Add("The Plunger", "Nether Gulp");
        modules.Add("The Radio", "Head Riot");
        modules.Add("The Screw", "Chew Rest");
        modules.Add("The Sphere", "Eh Her Step");
        modules.Add("The Stock Market", "Hack Treks Totem");
        modules.Add("The Stopwatch", "Two Step Hatch");
        modules.Add("The Sun", "Uh Sent");
        modules.Add("The Swan", "New Hats");
        modules.Add("The Switch", "Which Test");
        modules.Add("The Time Keeper", "Met Tepee Hiker");
        modules.Add("The Triangle", "Hanger Title");
        modules.Add("The Wire", "Were Hit");
        modules.Add("Third Base", "Bead Shirt");
        modules.Add("Tic Tac Toe", "Cat Cot Tie");
        modules.Add("Timezone", "Monetize");
        modules.Add("Tower of Hanoi", "Antihero Woof");
        modules.Add("Turn The Keys", "Try Hut Knees");
        modules.Add("Turn The Key", "Then Turkey");
        modules.Add("Turtle Robot", "Torture Bolt");
        modules.Add("Two Bits", "Bit Stow");
        modules.Add("Ultrastores", "Laser Tutors");
        modules.Add("Uncolored Squares", "Our Sons Lacquered");
        modules.Add("Unfair Cipher", "Hi Rip Furnace");
        modules.Add("Unrelated Anagrams", "A Guardsman Eternal");
        modules.Add("USA Maze", "Amaze Us");
        modules.Add("Valves", "Slave V");
        modules.Add("Varicolored Squares", "Discover Quasar Lore");
        modules.Add("Venting Gas", "Vegan Sting");
        modules.Add("Violet Cipher", "Hitler Cove Pi");
        modules.Add("Visual Impairment", "A Minus Lit Vampire");
        modules.Add("Waste Management", "New Nag Teammates");
        modules.Add("Web Design", "Bed Sewing");
        modules.Add("Westeros", "Two Seers");
        modules.Add("Who's on First", "Frown's Hoist");
        modules.Add("Who's That Monsplode", "Topmost How's Handle");
        modules.Add("Wingdings", "Ding Swing");
        modules.Add("Wire Placement", "Replace Me Twin");
        modules.Add("Wire Sequence", "We Quire Scene");
        modules.Add("Wire Spaghetti", "Pirates Weight");
        modules.Add("Wires", "Wiser");
        modules.Add("Word Scramble", "Marble Crowds");
        modules.Add("Word Search", "Crew Hoards");
        modules.Add("X-Ray", "Y-Arx");
        modules.Add("X01", "10X");
        modules.Add("Yahtzee", "Hey Zeta");
        modules.Add("Zoni", "I No Z");
        modules.Add("Zoo", "Ooz");
        modules.Add("Subscribe to Pewdiepie", "I Purities Deep Cobwebs");
        modules.Add("Grocery Store", "Retry Scrooge");
        modules.Add("Draw", "Ward");
        modules.Add("Burger Alarm", "Larger Umbra");
        modules.Add("Purgatory", "Yogurt Rap");
        modules.Add("Mega Man 2", "2 Name Mag");
        modules.Add("Lombax Cubes", "Able Box Scum");
        modules.Add("The Stare", "Theaters");
        modules.Add("Graphic Memory", "Impeach Mr Gyro");
        modules.Add("Quiz Buzz", "IQ Buuzzz");
        modules.Add("Wavetapping", "VIP Agent Paw");
        modules.Add("The Hypercube", "Yep Butch Here");
        modules.Add("Speak English", "Shaking Peels");
        modules.Add("Stack'em", "'Tacks Me");
        modules.Add("Seven Wires", "Reeves Wins");
        modules.Add("Colored Keys", "Yodeler Sock");
        modules.Add("The Troll", "Hell Tort");
        modules.Add("Planets", "Nest Lap");
        modules.Add("The Necronomicon", "Homer Connection");
        modules.Add("Four-Card Monte", "Unread-Comfort");
        modules.Add("Aa", "aA");
        modules.Add("The Witness", "These Twins");
        modules.Add("The Giant's Drink", "Tinker's Night Ad");
        modules.Add("Digit String", "Grid Sitting");
        modules.Add("Alpha", "Ha Pal");
        modules.Add("Snap!", "Naps!");
        modules.Add("Hidden Colors", "Scolded Rhino");
        modules.Add("Colour Code", "Louder Coco");
        modules.Add("Vexillology", "Lily Glove Ox");
        modules.Add("Brush Strokes", "Be Rush Storks");
        modules.Add("Odd One Out", "No Dude Too");
        modules.Add("The Triangle Button", "North Baguette Lint");
        modules.Add("Mazematics", "Sam Zit Acme");
        modules.Add("Equations X", "Quiet Axons");
        modules.Add("Maze^3", "Za Me^3");
        modules.Add("Yellow Cipher", "Hip Celery Owl");
        modules.Add("Orange Cipher", "Charger On Pie");
        modules.Add("Red Cipher", "Priced Her");
        modules.Add("Faulty RGB Maze", "Zebra At Fly Mug");
        modules.Add("Forget Me Later", "Telegram Forte");
        modules.Add("Garfield Kart", "Rag Dirt Flake");
        modules.Add("Footnotes", "To Soft One");
        modules.Add("Bamboozling Button", "Blab Butt Gizmo Noon");
        modules.Add("Fruits", "Surf It");
        modules.Add("The Modkit", "Kited Moth");
        modules.Add("Tetravex", "Ax Tree Tv");
        modules.Add("Flower Patch", "Chapter Wolf");
        modules.Add("Matchematics", "Schematic Mat");
        modules.Add("Organization", "A Train Oozing");
        modules.Add("Caesar Cycle", "Scarcely Ace");
        modules.Add("Playfair Cycle", "Clay Elf Piracy");
        modules.Add("Cryptic Cycle", "Cyclic Cry Pet");
        modules.Add("Ultimate Cycle", "Mutate Icy Cell");
        modules.Add("Colour Talk", "All Cork Out");
        modules.Add("Bamboozling Button Grid", "A Bubbling Ding Zoom Trot");
        modules.Add("Old Fogey", "Goofy Led");
        modules.Add("The Ultracube", "Blue Hut Crate");
        modules.Add("Snakes and Ladders", "Kens Sadder Sandal");
        modules.Add("Module Movements", "Melt Nosedove Mum");
        modules.Add("Safety Square", "Faster Queasy");
        modules.Add("Roman Numerals", "Marmoreal Nuns");
        modules.Add("Red Buttons", "Bend Trouts");
        modules.Add("The Rule", "Lee Hurt");
        modules.Add("Lousy Chess", "Holy Cusses");
        modules.Add("Keypad Lock", "Packed Yolk");
        modules.Add("Eight Pages", "Ape Egg Shit");
        modules.Add("The Colored Maze", "Reached Melt Zoo");
        modules.Add("White Cipher", "Heretic Whip");
        modules.Add("Gray Cipher", "Preachy Rig");
        modules.Add("Black Cipher", "Bar Check Lip");
        modules.Add("The Hyperlink", "Hyphen Kilter");
        modules.Add("Corners", "Scorner");
        modules.Add("The High Score", "Secret High Ho");
        modules.Add("Ingredients", "Needing Stir");
        modules.Add("Intervals", "Van Tilers");
        modules.Add("Cheep Checkout", "Heck Cope Cut He");
        modules.Add("Spelling Bee", "Legible Pens");
        modules.Add("Thinking Wires", "Shriek Twining");
        modules.Add("Seven Choose Four", "Confuse Overshoe");
        modules.Add("Object Shows", "Cob Jew Hosts");
        modules.Add("Lunchtime", "He Cum Lint");
        modules.Add("Natures", "Saunter");
        modules.Add("Neutrinos", "Nine Tours");
        modules.Add("Scavenger Hunt", "Arch Even Stung");
        modules.Add("Polygons", "Slog Pony");
        modules.Add("Codenames", "Encased Om");
        modules.Add("Odd Mod Out", "Dodo To Mud");
        modules.Add("Blinkstop", "Pink Blots");
        modules.Add("Forget It Not", "Gift No Otter");
        modules.Add("Rainbow Arrows", "Raw Barrio Snow");
        modules.Add("Passcodes", "Ed Ass Cops");
        modules.Add("Digital Dials", "A Sail Did Gilt");
        modules.Add("Lines of Code", "Encodes Foil");
        modules.Add("Encrypted Dice", "Cynic Ed Red Pet");
        modules.Add("Colorful Dials", "A Colloid Furls");
        modules.Add("Atbash Cipher", "Beach Harpist");
        modules.Add("Addition", "India Dot");
        modules.Add("Matrices", "Scream It");
        modules.Add("Cruel Keypads", "Capered Sulky");
        modules.Add("The Black Page", "Gal Kept Beach");
        modules.Add("Simon Forgets", "Feigns Motors");
        modules.Add("Greek Letter Grid", "Regretted Elk Rig");
        modules.Add("Going Backwards", "Ragbag Disc Wonk");
        modules.Add("Scalar Dials", "A Cars All Dis");
        modules.Add("Keywords", "Rod We Sky");
        modules.Add("The Crafting Table", "Fractal Beet Thing");
    }
    private void SubmitHandler()
    {
        Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, Submit.transform);
        Submit.AddInteractionPunch();
        if (Barempty)
        {
            Barempty = false;
            BarControl.gameObject.transform.localScale = new Vector3(1, 1, 1);
            Debug.LogFormat("[Waste Management #{0}] Strike avoided, continue with next stage", _moduleId);
            return;
        }

        if (!_lightsOn || _isSolved)
        {
            return;
        }

        if (!Calculated && !ForcedSolve)
        {
            //once submit button is pressed for the first time, those rules will be in effect for the rest of the bomb, unless you get a strike on this module
            CurrentTime = Mathf.FloorToInt(Info.GetTime());
            Debug.LogFormat("[Waste Management #{0}] Submit button pressed, performing final adjustments", _moduleId);
            TimeAdjustments();
        }
        switch (Stage)
        {
        case 1:
        {
            if (!ForcedSolve)
            {
                CalculateProportions();
            }
            Debug.LogFormat("[Waste Management #{0}] Received {1} for paper recycling, expected {2}", _moduleId, PaperRecycle, PaperRecycleAns);
            Debug.LogFormat("[Waste Management #{0}] Received {1} for paper waste, expected {2}", _moduleId, PaperWaste, PaperWasteAns);
            if (PaperRecycle == PaperRecycleAns && PaperWaste == PaperWasteAns)
            {
                Debug.LogFormat("[Waste Management #{0}] Paper correct!", _moduleId);
                Audio.PlaySoundAtTransform("PaperSubmit", Submit.transform);
                Stage++;
                Input           = 0;
                Screen.text     = "Plastic";
                Screen.fontSize = 70;
            }
            else
            {
                Debug.LogFormat("[Waste Management #{0}] Paper incorrect, Strike.", _moduleId);
                Module.HandleStrike();
                Strike = true;
                Init();
            }

            break;
        }

        case 2:
        {
            Debug.LogFormat("[Waste Management #{0}] Received {1} for plastic recycling, expected {2}", _moduleId, PlasticRecycle, PlasticRecycleAns);
            Debug.LogFormat("[Waste Management #{0}] Received {1} for plastic waste, expected {2}", _moduleId, PlasticWaste, PlasticWasteAns);
            if (PlasticRecycle == PlasticRecycleAns && PlasticWaste == PlasticWasteAns)
            {
                Debug.LogFormat("[Waste Management #{0}] Plastic correct!", _moduleId);
                Audio.PlaySoundAtTransform("PlasticSubmit", Submit.transform);
                Stage++;
                Input           = 0;
                Screen.text     = "Metal";
                Screen.fontSize = 75;
            }
            else
            {
                Debug.LogFormat("[Waste Management #{0}] Plastic incorrect, Strike.", _moduleId);
                Module.HandleStrike();
                Strike = true;
                Init();
            }

            break;
        }

        case 3:
        {
            Debug.LogFormat("[Waste Management #{0}] Received {1} for metal recycling, expected {2}", _moduleId, MetalRecycle, MetalRecycleAns);
            Debug.LogFormat("[Waste Management #{0}] Received {1} for metal waste, expected {2}", _moduleId, MetalWaste, MetalWasteAns);
            if (MetalRecycle == MetalRecycleAns && MetalWaste == MetalWasteAns)
            {
                if (LeftoverRecycleAns > 0 || LeftoverWasteAns > 0)
                {
                    Debug.LogFormat("[Waste Management #{0}] Metal correct!", _moduleId);
                    Audio.PlaySoundAtTransform("MetalSubmit", Submit.transform);
                    Stage++;
                    Input           = 0;
                    Screen.text     = "Leftovers";
                    Screen.fontSize = 50;
                }
                else
                {
                    Debug.LogFormat("[Waste Management #{0}] Metal correct!", _moduleId);
                    Debug.LogFormat("[Waste Management #{0}] There are no leftovers", _moduleId);
                    Debug.LogFormat("[Waste Management #{0}] Module Passed.", _moduleId);
                    _isSolved = true;                             //module is solved
                    Module.HandlePass();
                    Audio.PlaySoundAtTransform("WasteManagementSolve", Submit.transform);
                    Input           = 0;
                    Screen.text     = "";
                    Screen.fontSize = 75;
                }
            }
            else
            {
                Debug.LogFormat("[Waste Management #{0}] Metal incorrect, Strike.", _moduleId);
                Strike = true;
                Module.HandleStrike();
                Init();
            }

            break;
        }

        default:
        {
            Debug.LogFormat("[Waste Management #{0}] Received {1} for leftover recycling, expected {2}", _moduleId, LeftoverRecycle, LeftoverRecycleAns);
            Debug.LogFormat("[Waste Management #{0}] Received {1} for leftover waste, expected {2}", _moduleId, LeftoverWaste, LeftoverWasteAns);
            if (LeftoverRecycle == LeftoverRecycleAns && LeftoverWaste == LeftoverWasteAns)
            {
                Debug.LogFormat("[Waste Management #{0}] Leftovers correct!", _moduleId);
                Debug.LogFormat("[Waste Management #{0}] Module Passed.", _moduleId);
                _isSolved = true;                         //module is solved
                Module.HandlePass();
                Audio.PlaySoundAtTransform("WasteManagementSolve", Submit.transform);
                Input           = 0;
                Screen.text     = string.Empty;
                Screen.fontSize = 75;
            }
            else
            {
                Debug.LogFormat("[Waste Management #{0}] Leftovers incorrect, Strike.", _moduleId);
                Strike = true;
                Module.HandleStrike();
                Init();
            }

            break;
        }
        }

        if (Stage < 1 || Stage >= 4)
        {
            return;
        }
        int random = UnityEngine.Random.Range(1, 21);         //5% chance of bar going blank

        if (random != 1)
        {
            return;
        }
        Barempty = true;
        BarControl.gameObject.transform.localScale = new Vector3(1, 1, 0);
        Debug.LogFormat("[Waste Management #{0}] Bar empty, submit expected or strike", _moduleId);
    }
Beispiel #29
0
    KMSelectable.OnInteractHandler ButtonHandler(int j)
    {
        return(delegate
        {
            Shapes[j].AddInteractionPunch(.3f);
            if (!isActive)
            {
                return false;
            }
            switch (j)
            {
            case 0:
                if (circle.Contains(current))
                {
                    var i = Array.IndexOf(circle, current);
                    var ni = (i % 2).Equals(0) ? i + 1 : i - 1;
                    current = circle[ni];
                    visCurrent.text = states[current];
                }
                else
                {
                    goto default;
                }
                break;

            case 1:
                if (square.Contains(current))
                {
                    var i = Array.IndexOf(square, current);
                    var ni = (i % 2).Equals(0) ? i + 1 : i - 1;
                    current = square[ni];
                    visCurrent.text = states[current];
                }
                else
                {
                    goto default;
                }
                break;

            case 2:
                if (diamond.Contains(current))
                {
                    var i = Array.IndexOf(diamond, current);
                    var ni = (i % 2).Equals(0) ? i + 1 : i - 1;
                    current = diamond[ni];
                    visCurrent.text = states[current];
                }
                else
                {
                    goto default;
                }
                break;

            case 3:
                if (trap.Contains(current))
                {
                    var i = Array.IndexOf(trap, current);
                    var ni = (i % 2).Equals(0) ? i + 1 : i - 1;
                    current = trap[ni];
                    visCurrent.text = states[current];
                }
                else
                {
                    goto default;
                }
                break;

            case 4:
                if (parallel.Contains(current))
                {
                    var i = Array.IndexOf(parallel, current);
                    var ni = (i % 2).Equals(0) ? i + 1 : i - 1;
                    current = parallel[ni];
                    visCurrent.text = states[current];
                }
                else
                {
                    goto default;
                }
                break;

            case 5:
                if (triangle.Contains(current))
                {
                    var i = Array.IndexOf(triangle, current);
                    var ni = (i % 2).Equals(0) ? i + 1 : i - 1;
                    current = triangle[ni];
                    visCurrent.text = states[current];
                }
                else
                {
                    goto default;
                }
                break;

            case 6:
                if (heart.Contains(current))
                {
                    var i = Array.IndexOf(heart, current);
                    var ni = (i % 2).Equals(0) ? i + 1 : i - 1;
                    current = heart[ni];
                    visCurrent.text = states[current];
                }
                else
                {
                    goto default;
                }
                break;

            case 7:
                if (star.Contains(current))
                {
                    var i = Array.IndexOf(star, current);
                    var ni = (i % 2).Equals(0) ? i + 1 : i - 1;
                    current = star[ni];
                    visCurrent.text = states[current];
                }
                else
                {
                    goto default;
                }
                break;

            default:
                if ((current.Equals(0) || current.Equals(10)) && !(destination.Equals(0) || destination.Equals(10)))
                {
                    var stay = current;
                    while (stay.Equals(current))
                    {
                        current = UnityEngine.Random.Range(0, 50);
                    }
                    visCurrent.text = states[current];
                }
                else if ((current.Equals(0) && destination.Equals(10)) || (current.Equals(10) && destination.Equals(0)))
                {
                    visCurrent.text = states[destination];
                    Module.HandlePass();
                    isActive = false;
                }
                else
                {
                    Module.HandleStrike();
                }
                break;
            }
            if (current == destination)
            {
                Module.HandlePass();
                isActive = false;
            }
            return false;
        });
    }
Beispiel #30
0
    void Check()
    {
        if (!_lightsOn || _isSolved)
        {
            return;
        }

        Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, submit.transform);
        submit.AddInteractionPunch();

        if (correctLine == currentLine)
        {
            Debug.LogFormat("[The Witness #{0}] Expected line: {1} or {2}, input line: {3}.", _moduleId, correctLine, alternativeLine, currentLine);
            Debug.LogFormat("[The Witness #{0}] Module defused. Well done :)", _moduleId);

            Audio.PlaySoundAtTransform("disarmed", Module.transform);
            wireGray.SetActive(false);
            wireGreen.SetActive(true);
            Module.HandlePass();
            _isSolved = true;
        }
        else if (alternativeLine == currentLine)
        {
            Debug.LogFormat("[The Witness #{0}] Expected line: {1} or {2}, input line: {3}.", _moduleId, correctLine, alternativeLine, currentLine);
            Debug.LogFormat("[The Witness #{0}] Module defused. Well done :)", _moduleId);

            Audio.PlaySoundAtTransform("disarmed", Module.transform);
            wireGray.SetActive(false);
            wireGreen.SetActive(true);
            Module.HandlePass();
            _isSolved = true;
        }
        else
        {
            Debug.LogFormat("[The Witness #{0}] Expected line: {1} or {2}, input line: {3}. Strike!", _moduleId, correctLine, alternativeLine, currentLine);

            Module.HandleStrike();

            StartCoroutine(RedWireHandle());

            tl.SetActive(false);
            tr.SetActive(false);
            tsl.SetActive(false);
            tsm.SetActive(false);
            tsr.SetActive(false);
            ml.SetActive(false);
            mr.SetActive(false);
            bsl.SetActive(false);
            bsm.SetActive(false);
            bsr.SetActive(false);
            bl.SetActive(false);
            br.SetActive(false);

            tmOn = false;
            trOn = false;
            mlOn = false;
            mmOn = false;
            mrOn = false;
            blOn = false;
            bmOn = false;
            brOn = false;

            currentLine = "";
            lastPress   = 0;
            isFirst     = true;
        }
    }