private void ModuleFinish(bool forced = false)
 {
     if (forced)
     {
         _bombModule.Log("Module force-solved!");
     }
     else
     {
         _bombModule.Log("Module defused!");
     }
     _audio.PlaySoundAtTransform(BigPopSound.name, transform);
     _smoke.Play();
     _bombModule.HandlePass();
 }
Пример #2
0
    bool IsBobPresent()
    {
        var bobPresent = BombInfo.GetBatteryCount() == 5 && BombInfo.GetBatteryHolderCount() == 3 &&
                         BombInfo.IsIndicatorPresent(KMBombInfoExtensions.KnownIndicatorLabel.BOB);

        if (!bobPresent || _baseOffsetGenerated)
        {
            return(bobPresent);
        }
        _baseOffsetGenerated = true;
        BombModule.LogFormat("Bob, Our true lord and savior has come to save the Day.: Press any solution that would be valid for any characters present on the serial number at any time.");
        var serial = BombInfo.GetSerialNumber().ToUpperInvariant();

        if (_rotateCounterClockwise)
        {
            BombModule.Log("Circle is spinning counter-clockwise.");
        }
        else
        {
            BombModule.Log("Circle is spinning clockwise.");
        }
        for (var i = 0; i < serial.Length; i++)
        {
            var index      = serial.Substring(i, 1);
            var colorIndex = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".IndexOf(index, StringComparison.Ordinal);
            if (colorIndex < 0)
            {
                BombModule.LogFormat("Unrecognized Serial number character: {0} - Passing the module now", index);
                StartCoroutine(FadeCircle(_wedgeColors[(int)WedgeColors.Red]));
                return(false);
            }
            var lookup = new List <WedgeColors>(colorLookup[colorIndex / 3]);
            if (_rotateCounterClockwise)
            {
                lookup.Reverse();
            }

            if (ValidBOBColors.Any(x => x[0] == lookup[0] && x[1] == lookup[1] && x[2] == lookup[2]))
            {
                continue;
            }

            ValidBOBColors.Add(lookup.ToArray());
        }
        ValidBOBColors = ValidBOBColors.OrderBy(x => x[0].ToString()).ThenBy(x => x[1].ToString()).ToList();
        for (var i = 0; i < ValidBOBColors.Count; i++)
        {
            var lookup = ValidBOBColors[i];
            BombModule.LogFormat("Bob Solution #{3}: {0}, {1}, {2}", lookup[0], lookup[1], lookup[2], i + 1);
        }

        _currentSolution = new WedgeColors[3];
        return(true);
    }
    private void HandleModulePass()
    {
        if (_alreadyHandledPass)
        {
            return;
        }
        _alreadyHandledPass = true;
        switch (FakeStatusLight.SetLightColor(FakeStatusLight.PassColor))
        {
        case StatusLightState.Red:
            BombModule.LogFormat("Setting the status light to Red. Did you want that with a side of strikes? Keepo");
            FakeStatusLight.HandlePass(StatusLightState.Red);
            break;

        case StatusLightState.Green:
            BombModule.LogFormat("Setting the status light to its normal Green color for solved.");
            FakeStatusLight.HandlePass(StatusLightState.Green);
            break;

        //case StatusLightState.Off:
        default:
            BombModule.LogFormat("Turning off the Status light. Kappa");
            FakeStatusLight.HandlePass();
            break;
        }
        BombModule.Log("Module Solved");
    }
    private void StartAppreciatingArt()
    {
        _module.Log("Art is being appreciated.");
        _appreciationStartTime = Time.time;

        _audio.PlaySoundAtTransform(AppreciationStartedClip.RandomPick().name, _transform);
        _ambientRef = _audio.PlaySoundAtTransformWithRef(AppreciationAmbientClip.name, _transform);

        try
        {
            GameMusicControl.GameMusicVolume = 0.0f;
        }
        catch (Exception)
        {
        }

        StopAllCoroutines();
        StartCoroutine(FadeIn());
    }
Пример #5
0
    private void Start()
    {
        for (int childIndex = 0; childIndex < KMSelectable.Children.Length; ++childIndex)
        {
            KMSelectable childSelectable = KMSelectable.Children[childIndex];
            SetupSelectableNote(childSelectable, (Semitone)childIndex);
        }

        _isCruel = GenerateCruelness();

        KMBombModule.ModuleDisplayName = _isCruel ? "Cruel Piano Keys" : "Piano Keys";
        KMBombModule.ModuleType        = _isCruel ? "CruelPianoKeys" : "PianoKeys";

        KMBombModule.GenerateLogFriendlyName();

        SetupMaterial();
        MusicSymbol[] pickedSymbols = PianoIndicator.PickSymbols(_isCruel);

        StringBuilder logString = new StringBuilder();

        logString.Append("Module generated with the following symbols: ");
        logString.Append(string.Join(", ", pickedSymbols.Select((x) => x.GetDescription()).ToArray()));

        KMBombModule.Log(logString.ToString());
    }
    void Start()
    {
        StringBuilder logString = new StringBuilder();

        logString.Append("Module generated with the following word-color sequence:\n");
        logString.Append("# | Word    | Color   | Valid Response\n");
        logString.Append("--+---------+---------+----------------\n");

        string blockTitle = "";
        string condition  = "";

        GenerateModuleInformation();

        RuleButtonPressHandler ruleHandler = SetupRules(ref blockTitle, ref condition);

        SetRuleButtonPressHandler(ruleHandler);

        //Logging section
        for (int colourSequenceIndex = 0; colourSequenceIndex < _colourSequence.Length; ++colourSequenceIndex)
        {
            _currentColourSequenceIndex = colourSequenceIndex;
            ColourPair pair     = _colourSequence[_currentColourSequenceIndex];
            string     response = ruleHandler(true) ? "[YES]" : (ruleHandler(false) ? "[NO]" : "---");

            logString.AppendFormat("{0} | {1,-7} | {2,-7} | {3}\n", colourSequenceIndex + 1, pair.ColourText.ToString(), pair.ColourValue.ToString(), response);
        }
        logString.Append("\nThe sequence matched the following block title and condition statement:\n");
        logString.AppendFormat("\"{0}\"\n-> \"{1}\"\n", blockTitle, condition);

        BombModule.Log(logString.ToString());

        _currentColourSequenceIndex = -1;

        BombModule.OnActivate += HandleModuleActive;

        ButtonYes.KMSelectable.OnInteract += HandlePressYes;
        ButtonNo.KMSelectable.OnInteract  += HandlePressNo;
    }
    private void Awake()
    {
        _module = GetComponent <KMBombModule>();
        _module.GenerateLogFriendlyName();
        _module.Log("There is some art to appreciate.");

        _info = GetComponent <KMBombInfo>();
        _info.OnBombExploded += OnBombExploded;

        _audio = GetComponent <KMAudio>();

        _mainCameraTransform          = Camera.main.transform;
        _appreciationRequiredDuration = UnityEngine.Random.Range(MinimumAppreciationTime, MaximumAppreciationTime);

        try
        {
            _defaultGameMusicVolume = GameMusicControl.GameMusicVolume;
        }
        catch (Exception)
        {
        }
    }
Пример #8
0
    private void Repaint()
    {
        _bombModule.Log("Generating painting...");

        _painting.Repaint();

        SetupPaletteToPaintingLinks();

        _painting.selectionGrid.SetChildren(GetComponentsInChildren <FluidSelectable>());

        foreach (PaintingCell cell in _painting.Cells)
        {
            PaintingCell closureCell = cell;

            _bombModule.LogFormat("{0} => {1}.", closureCell.name, cell.ColorOption);

            closureCell.fluidSelectable.selectable.Parent      = _selectable;
            closureCell.fluidSelectable.selectable.OnInteract += () => OnCellInteract(closureCell);
        }
    }
    IEnumerator SetNextCharacter(bool giveStrike)
    {
        _spinning         = true;
        _twitchPlayStrike = giveStrike;
        if (_wins >= WINSTOSOLVE || _losses >= LOSSESTOSOLVE)
        {
            _solved = true;
        }

        for (int i = 0; i < 60; i++)
        {
            RandomizeCharacter();
            RandomizeInventory();
            UpdateDisplay();
            StageNumberText.text = string.Format("{0}", (_losses + 1 + i) % 10);
            yield return(null);
        }
        if (_solved)
        {
            CharacterText.text = "";
        }
        OnLED.SetActive(giveStrike);
        OffLED.SetActive(!giveStrike);

        for (int i = 0; i < 60; i++)
        {
            RandomizeInventory();
            UpdateDisplay(false, !_solved);
            StageNumberText.text = string.Format("{0}", (_losses + 1 + i) % 10);
            yield return(null);
        }
        if (_solved)
        {
            InventoryText.text = "";
            OnLED.SetActive(false);
            OffLED.SetActive(true);
        }
        else
        {
            UpdateDisplay();
        }


        for (int i = 0; i < 60; i++)
        {
            StageNumberText.text = string.Format("{0}", (_losses + 1 + i) % 10);
            yield return(null);
        }

        if (giveStrike)
        {
            BombModule.HandleStrike();
        }

        if (_solved)
        {
            SolvedScreens.OrderBy(x => Rnd.value).First().UpdateScreens(ref CharacterText, ref IncidentText, ref InventoryText);
            StageNumberText.text = "!";
            OnLED.SetActive(false);
            OffLED.SetActive(true);
            BombModule.Log("Passed");
            BombModule.HandlePass();
            Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
        }
        else
        {
            Initialize(true);
            Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.TitleMenuPressed, transform);
        }
        _spinning = false;
    }