// Update is called once per frame
 void Update()
 {
     if (active)
     {
         transform.Rotate(Vector3.up * needy.GetNeedyTimeRemaining());
     }
 }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        float timeLeft = needyModule.GetNeedyTimeRemaining();

        if (timeLeft >= 0 && timeLeft < 5 && !iswarning)
        {
            StartCoroutine(WarnFlash());
        }
    }
예제 #3
0
    // Update is called once per frame
    void Update()
    {
        //Debug.Log("Please F**k me");

        if (NeedyActive)
        {
            //This keeps the timer number set to the selected number
            if (Needy.GetNeedyTimeRemaining().ToString() != SelectedNumber.ToString())
            {
                Needy.SetNeedyTimeRemaining(SelectedNumber);
            }
        }
        //This calls the Coroutine to evaluate if the last solve was correct
        if (Solves != _Bomb.GetSolvedModuleNames().Count())
        {
            MostRecent = GetLatestSolve(_Bomb.GetSolvedModuleNames(), SolveList);
            SolveList.Add(MostRecent);
            MostRecent = SolveList[Solves];
            Solves     = _Bomb.GetSolvedModuleNames().Count();

            if (NeedyActive)
            {
                LastSolveEvaluation();
                return;
            }
            else
            {
                return;
            }
        }
    }
예제 #4
0
    IEnumerator HandleLight()
    {
        int flickerIndex = 0;

        while (!isDisabled)
        {
            if (!lightsAreOn)
            {
                // Pause the timer if the lights turn off.
                if (isLive)
                {
                    float time = bombModule.GetNeedyTimeRemaining();
                    bombModule.SetNeedyTimeRemaining((float)Math.Round(time));
                }
                currentScreenColor.a = __flicker[flickerIndex++] * 2.0f;
            }
            else
            {
                currentScreenColor.a = 1.0f - __flicker[flickerIndex++];
            }

            mainScreen.color = currentScreenColor;
            flickerIndex    %= __flicker.Length;
            yield return(new WaitForSeconds(0.1f));
        }
    }
예제 #5
0
    IEnumerator timeGlitchiness()
    {
        while (!moduleSolved)
        {
            int displayedtimeremaining = Convert.ToInt32(Math.Floor(module.GetNeedyTimeRemaining()));
            yield return(new WaitForSeconds(0.25f));

            while (solvedPercentage - module.GetNeedyTimeRemaining() >= 2)
            {
                yield return(null);

                module.SetNeedyTimeRemaining(module.GetNeedyTimeRemaining() + 1);
                yield return(new WaitForSeconds(0.25f));
            }
            module.SetNeedyTimeRemaining(solvedPercentage);
        }
    }
예제 #6
0
    protected void AddTime()
    {
        float time = NeedyModule.GetNeedyTimeRemaining();

        if (time > 0)
        {
            NeedyModule.SetNeedyTimeRemaining(Mathf.Min(time + timeGain, timeMax));
        }
    }
    // Update is called once per frame

    IEnumerator FlashGoalOnWarning()
    {
        while (needySelf.GetNeedyTimeRemaining() > 0)
        {
            for (int x = 0; x < goalLeds.Count(); x++)
            {
                goalLeds[x].material = buttonStatus[0];
            }
            yield return(new WaitForSeconds(0.25f));

            for (int pos = 0; pos < goalLights.Count(); pos++)
            {
                goalLeds[pos].material = (mustInvert ^ goalLights[pos]) ? buttonStatus[0] : buttonStatus[1];
            }
            yield return(new WaitForSeconds(0.25f));
        }
        yield return(null);
    }
예제 #8
0
    protected bool AddTime()
    {
        float time = NeedyModule.GetNeedyTimeRemaining();

        if (time > 0)
        {
            NeedyModule.SetNeedyTimeRemaining(Mathf.Min(time + timeGain, timeMax));
        }
        return(false);
    }
예제 #9
0
 // Use this for initialization
 void Start()
 {
     needyModule.OnTimerExpired += delegate() {
         if (canRun)
         {
             localstrike = true;
             Debug.LogFormat("[Time Accumulation #{0}]: Don't let this run out of time! Strike incurred.", localModID);
             needyModule.HandleStrike();
         }
     };
     selectDisable.OnInteract += delegate() {
         int curneedTime = Mathf.RoundToInt(needyModule.GetNeedyTimeRemaining());
         if (curneedTime >= 0)
         {
             value += curneedTime;
             needyModule.HandlePass();
             Debug.LogFormat("[Time Accumulation #{0}]: Adding {1} onto the counter. Counter currently at {2}.", localModID, curneedTime, value);
         }
         audioKTANE.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonPress, transform);
         forwardsAnim = true;
         return(false);
     };
     needyModule.OnNeedyActivation += delegate()
     {
         if (!canRun)
         {
             needyModule.HandlePass();
         }
     };
     needyModule.OnActivate += delegate() {
         isInTimeMode    = TimeModeActive;
         canRun          = true;
         isLightsFirstOn = true;
         if (isInTimeMode)
         {
             Debug.LogFormat("[Time Accumulation #{0}]: Module detected in Time Mode, disabling strike count for this module...", localModID);
         }
     };
     selectDisable.OnInteractEnded += delegate()
     {
         forwardsAnim = false;
         audioKTANE.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonRelease, transform);
     };
     bombInfo.OnBombExploded += delegate()
     {
         canRun = false;
     };
     bombInfo.OnBombSolved += delegate()
     {
         canRun = false;
     };
 }
예제 #10
0
    void ButtonPress()
    {
        if (!active)
        {
            return;
        }
        button.AddInteractionPunch(.5f);
        audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, button.transform);
        var timeNow = Mathf.Round(module.GetNeedyTimeRemaining()).ToString();

        if (timeNow != "0")
        {
            Debug.LogFormat("[Red Light Green Light #{0}] Pressed the button with {1} seconds remaining, that is incorrect. Strike!", moduleId, timeNow);
            module.OnStrike();
        }
        else
        {
            Debug.LogFormat("[Red Light Green Light #{0}] Pressed the button with 0 seconds remaining, that is correct. Module temporarily neutralized!", moduleId);
            OnNeedyDeactivation();
            module.OnPass();
        }
    }
예제 #11
0
    void ButtonPressed(int buttonIndex)
    {
        KMSelectable button = holdableButtons[buttonIndex];

        Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, button.transform);
        button.AddInteractionPunch();
        if (isEnded || filedIndexes.Contains(buttonIndex))
        {
            return;
        }
        int expectedIndex = sortedIndexes[waitingFor];

        Audio.PlaySoundAtTransform("FilingSFX", transform);
        if (!foldersAnimating[waitingFor].isNone && foldersAnimating[waitingFor].OriginalPosition.z != 0f)
        {
            foldersAnimating[waitingFor].folder.transform.localPosition = foldersAnimating[waitingFor].OriginalPosition;
        }
        AnimatingFolder aFold = new AnimatingFolder(folders[waitingFor], finalNames[buttonIndex][0]);

        foldersAnimating[waitingFor] = aFold;
        bool isCorrect = buttonIndex == expectedIndex;

        Debug.LogFormat("[Bomb Corp. Filing #{0}] {1} filed, {2} expected. Correct: {3}, Index: {4}", _moduleId, finalNames[buttonIndex][0], finalNames[expectedIndex][0], isCorrect ? "y" : "n", buttonIndex);
        MeshRenderer renderer = button.GetComponent <MeshRenderer>();

        if (isCorrect)
        {
            float time = NeedyModule.GetNeedyTimeRemaining();
            if (time > 0)
            {
                NeedyModule.SetNeedyTimeRemaining(time + 2f);
            }
            renderer.material = buttonCorrectMat;
            filedIndexes.Add(buttonIndex);
            waitingFor++;
        }
        else
        {
            renderer.material = buttonWrongMat;
            StartCoroutine(RemoveWrongMat(renderer));
            Strike();
        }
        if (waitingFor == 6)
        {
            Solve();
        }
    }
    // Use this for initialization
    void Start()
    {
        needyModule.OnNeedyActivation += delegate
        {
            if (forceDisable)
            {
                needyModule.HandlePass();
                return;
            }
            isActive = true;
            List <int> tempSegmentsID = segmentIDs.ToList();
            curSegmentPos.Clear();
            while (tempSegmentsID.Count > 0)
            {
                int valueToAdd = tempSegmentsID[Random.Range(0, tempSegmentsID.Count)];
                curSegmentPos.Add(valueToAdd);
                tempSegmentsID.Remove(valueToAdd);
            }
            UpdateSegments();
            Debug.LogFormat("[Faulty Seven Segment Display #{0}]: The set of the seven segments scrambled for {1} needy activation(s) are:", curModID, activationCount);
            LogSegments(curSegmentPos.ToArray());
            TPDetected = TwitchPlaysActive;
            if (TPDetected)
            {
                needyModule.SetNeedyTimeRemaining(needyModule.GetNeedyTimeRemaining() * 2);
            }
        };
        needyModule.OnNeedyDeactivation += delegate
        {
            isActive = false;
        };
        needyModule.OnTimerExpired += delegate
        {
            isActive = false;
            Debug.LogFormat("[Faulty Seven Segment Display #{0}]: The current set of the seven segments when the time ran out for {1} needy activation(s):", curModID, activationCount++);
            LogSegments(curSegmentPos.ToArray());
            if (!curSegmentPos.SequenceEqual(segmentIDs.ToList()))
            {
                needyModule.HandleStrike();
                needyModule.SetResetDelayTime(15f, 40f);
            }
            else
            {
                needyModule.SetResetDelayTime(60f, 160f);
            }
        };
        foreach (GameObject objCom in segmentObjects)
        {
            localPosSeg.Add(objCom.transform.localPosition);
            localRotSeg.Add(objCom.transform.localEulerAngles);
        }
        for (int x = 0; x < segmentSelectables.Length; x++)
        {
            int temp = x;
            segmentSelectables[x].OnInteract += delegate
            {
                segmentSelectables[temp].AddInteractionPunch();
                audioSelf.PlaySoundAtTransform("tick", transform);
                if (curSegmentPos.Count > 0)
                {
                    bool isSelected  = false;
                    int  idxSelected = -1;
                    for (int u = 0; u < segmentSelectables.Length; u++)
                    {
                        var selectable = segmentSelectables[u];
                        if (selectable.Highlight.GetComponent <MeshRenderer>().enabled)
                        {
                            isSelected  = true;
                            idxSelected = u;
                        }
                    }
                    if (!isSelected)
                    {
                        segmentSelectables[temp].Highlight.GetComponent <MeshRenderer>().enabled = true;
                    }
                    else
                    {
                        SwapSegments(temp, idxSelected);
                        foreach (KMSelectable selectable in segmentSelectables)
                        {
                            selectable.Highlight.GetComponent <MeshRenderer>().enabled = false;
                        }
                    }
                }
                return(false);
            };
        }

        curModID = modID++;
        Debug.LogFormat("[Faulty Seven Segment Display #{0}]: The correct set of the seven segments are logged as the following:", curModID);
        LogSegments();
    }
예제 #13
0
    // Use this for initialization
    void Start()
    {
        curModID = modID++;

        for (int x = 0; x < 10; x++)
        {
            int y = x;
            buttonDigitsSelectables[x].OnInteract += delegate
            {
                StartCoroutine(HandleButtonAnim(buttonDigitsSelectables[y].gameObject));
                audioHandler.PlaySoundAtTransform("keyStroke", buttonDigitsSelectables[y].transform);
                if (inputText.text.Length < 6 && isActivated)
                {
                    inputText.text += y;
                }
                return(false);
            };
        }
        clrButtonSelectable.OnInteract += delegate
        {
            StartCoroutine(HandleButtonAnim(clrButtonSelectable.gameObject));
            audioHandler.PlaySoundAtTransform("keyStroke", clrButtonSelectable.transform);
            if (isActivated)
            {
                if (inputText.text.Length > 0)
                {
                    inputText.text = "";
                }
                else
                {
                    float timeLeft = needyHandler.GetNeedyTimeRemaining();
                    if (timeLeft - 5 > 0.5f && digitsHidden > 0)
                    {
                        needyHandler.SetNeedyTimeRemaining(timeLeft - 5f);
                        revealAnim = HandleRerevealDelay(digitsHidden * 1);
                        StartCoroutine(revealAnim);
                    }
                }
            }
            return(false);
        };
        subButtonSelectable.OnInteract += delegate
        {
            StartCoroutine(HandleButtonAnim(subButtonSelectable.gameObject));
            audioHandler.PlaySoundAtTransform("keyStroke", subButtonSelectable.transform);
            if (isActivated)
            {
                int givenValue = 0;
                if (inputText.text.Length > 0 && int.TryParse(inputText.text, out givenValue))
                {
                    int goalValue = currentValue - valueToSubtract;
                    if (givenValue == goalValue)
                    {
                        currentValue = givenValue;
                        debugValInput++;
                        if (currentValue < 10)
                        {
                            audioHandler.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
                            IncreaseStreak();
                        }
                        else
                        {
                            audioHandler.PlaySoundAtTransform("correct", transform);
                            digitsHidden = Mathf.Min(digitsHidden + 1, 2);
                            needyHandler.SetNeedyTimeRemaining(needyHandler.GetNeedyTimeRemaining() + (TwitchPlaysActive ? 8f : 5f));
                        }
                    }
                    else
                    {
                        QuickLog(string.Format("Strike! {0} was incorrectly entered when {1} was expected for the {2} input.", inputText.text, goalValue, debugPositionalNums[debugValInput]));
                        ResetStreak();
                        needyHandler.HandlePass();
                    }
                    inputText.text = "";
                }
            }

            return(false);
        };
        needyHandler.OnActivate += delegate {
            PrepValues();
        };
        needyHandler.OnNeedyActivation += delegate
        {
            if (forceDisable)
            {
                needyHandler.HandlePass();
                return;
            }
            digitsHidden    = 0;
            valueToSubtract = curStreak > 3 ? streakValues.Last() : streakValues[curStreak];
            currentValue    = Random.Range(85, 100);
            QuickLog(string.Format("Starting Value: {0}", currentValue));
            List <int> debugValues = new List <int>();
            for (int logValue = currentValue - valueToSubtract; logValue > 0; logValue -= valueToSubtract)
            {
                debugValues.Add(logValue);
                if (logValue < 10)
                {
                    break;
                }
            }
            QuickLog(string.Format("Answers to submit at {1} streak: [ {0} ]", debugValues.Join(", "), curStreak >= 3 ? "3+" : curStreak.ToString()));
            isActivated = true;
            if (TwitchPlaysActive)
            {
                needyHandler.SetNeedyTimeRemaining(35f);
            }
        };
        needyHandler.OnTimerExpired += delegate
        {
            QuickLog("Letting the needy timer run out was not a good idea after all.");
            ResetStreak();
        };
        needyHandler.OnNeedyDeactivation += delegate
        {
            isActivated = false;
            StopAllCoroutines();
        };
        inputText.text = "";
        for (var x = 0; x < progressRenderers.Length; x++)
        {
            progressRenderers[x].material.color = Color.green;
            progressRenderers[x].enabled        = false;
        }
        displayText.text = "";
    }
예제 #14
0
    void FixedUpdate()
    {
        if (active)
        {
            timeOnRoad = timeOnRoad + Time.fixedDeltaTime;

            if ((int)(timeOnRoad * 81) % 81 >= 54)
            {
                roadNumber = 2;
            }
            else if ((int)(timeOnRoad * 81) % 81 >= 27)
            {
                roadNumber = 1;
            }
            else
            {
                roadNumber = 0;
            }

            if (!specialPhase)
            //transform.Rotate(Vector3.up * needy.GetNeedyTimeRemaining());
            {
                if (timeOnRoad >= 28800)                 //28800
                {
                    //Wow, you kept the bus going for eight hours!
                    score++;
                    if (score > 99)
                    {
                        score = 99;
                    }
                    specialPhase       = true;
                    roadLane.enabled   = false;
                    laneMarker.enabled = false;
                    removeDigits();
                    showSpecial();
                    needy.SetNeedyTimeRemaining(60.1f);
                    timeOnRoad = 0;
                    dashboard.material.mainTexture = dashTitleSpecial[2];
                }
                else if (needy.GetNeedyTimeRemaining() < 75.1 && roadPosition == 1)
                {
                    roadPosition = 2;
                    needy.SetNeedyTimeRemaining(75.1f);
                    sphere.transform.localPosition  = new Vector3(handlePosition(), .015f, 0);
                    roadLane.material.mainTexture   = roadPos[roadPosition];
                    laneMarker.material.mainTexture = roadNum[((roadPosition * 3) + roadNumber)];
                }
                else if (needy.GetNeedyTimeRemaining() < 30.1 && roadPosition == 2)
                {
                    GetComponent <KMAudio>().PlayGameSoundAtTransformWithRef(KMSoundOverride.SoundEffect.NeedyActivated, transform);
                    roadPosition = 3;
                    needy.SetNeedyTimeRemaining(30.1f);
                    sphere.transform.localPosition  = new Vector3(handlePosition(), .015f, 0);
                    roadLane.material.mainTexture   = roadPos[roadPosition];
                    laneMarker.material.mainTexture = roadNum[((roadPosition * 3) + roadNumber)];
                }
                doClock();
                doMiles();
                laneMarker.material.mainTexture = roadNum[((roadPosition * 3) + roadNumber)];
            }
            else
            {
                if (timeOnRoad >= 60)
                {
                    //needed to press start in 60 seconds, so you get a strike :(
                    needy.OnStrike();
                    active = false;
                    removeSpecial();
                    needy.HandlePass();
                    specialPhase = false;
                    timeOnRoad   = 0;
                }
            }
        }
    }
예제 #15
0
    private int CorrectPatchFile(ErrorData errorData)
    {
        // Data where seed = 0;
        // 0 "prle.cba",
        // 1 "resble.bbc",
        // 2 "razcle.pxi",
        // 3 "wane.drf",
        // 4 "faee.sup",
        // 5 "exed.asc",
        // 6 "gilick.pxd",
        // 7 "linion.dart",
        // 8 "lonist.ftl"

        //However, if the error's source file is either satcle.bb, plor.pom, or equely.ctl, ignore all rules above and select exed.asc.
        if (errorData.SourceFileIndex == 2 ||
            errorData.SourceFileIndex == 9)
        {
            return(5);
        }

        //Otherwise, if the source file's number of vowels is equal to or greater than the number of consonants, or the column index is higher than the line index, select faee.sup.
        int v = 0;
        int c = 0;

        foreach (char l in errorData.SourceFile)
        {
            if (l == '.')
            {
                break;
            }

            bool isVowel = "aeiou".IndexOf(l) >= 0;

            if (isVowel)
            {
                v++;
            }
            else
            {
                c++;
            }
        }

        if (v >= c)
        {
            return(4);
        }

        //Otherwise, if the source file's first letter is in the last third of the alphabet, select prle.cba.
        if (StringManipulation.AlphabetToIntPlusOne(errorData.SourceFile[0])
            >= 26f / 3f * 2f)
        {
            return(0);
        }

        //Otherwise, if the less than 99 seconds is still available and the column is higher than 75, select linion.dart.
        if (needyModule.GetNeedyTimeRemaining() < 99f &&
            errorData.ColumnIndex > 75)
        {
            return(7);
        }

        //Otherwise, if the error's line and column are both even, select razcle.pxi.
        if (errorData.LineIndex % 2 == 0 &&
            errorData.ColumnIndex % 2 == 0)
        {
            return(2);
        }

        //If any of the error code's letters are contained in the crashed source file's name, select wane.drf.
        for (int i = 2; i < errorData.Error.Length; i++)
        {
            string l1 = errorData.Error[i].ToString().ToLower();
            foreach (char l in errorData.SourceFile)
            {
                string l2 = l.ToString().ToLower();
                if (l1 == l2)
                {
                    return(3);
                }
            }
        }

        //Otherwise, if this is the fourth or later crash and the cumulative line number of all previous errors is over 450, select gilick.pxd.
        if (allErrors.Count >= 4)
        {
            int cumulativeLines = 0;
            foreach (ErrorData error in allErrors)
            {
                cumulativeLines += error.LineIndex;
            }

            if (cumulativeLines >= 450)
            {
                return(6);
            }
        }

        //Otherwise, select shuttle lonist.ftl.
        return(8);
    }