コード例 #1
0
 void Awake()
 {
     moduleId = moduleIdCounter++;
     if (Boss.GetIgnoredModules(Module, Ignored) != null)
     {
         Ignored = Boss.GetIgnoredModules(Module, Ignored);
     }
     Button.OnInteract += delegate() { PressButton(); return(false); };
 }
コード例 #2
0
 void Awake()
 {
     BruhSFX2.volume = 0.6f;
     moduleId        = moduleIdCounter++;
     BigText.text    = "";
     if (Boss.GetIgnoredModules(Module, Ignored) != null)
     {
         Ignored = Boss.GetIgnoredModules(Module, Ignored);
     }
     Button.OnInteract      += delegate() { Pressed(); return(false); };
     Button.OnInteractEnded += delegate() { Unpressed(); };
 }
コード例 #3
0
    private List<string> RemoveIgnoredModules(List<string> list)
    {
        string[] ignored = BossManager.GetIgnoredModules(Module, DefaultIgnoreList);

        list.RemoveAll(module => ignored.Contains(module));
        return list;
    }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        moduleId            = moduleIdCounter++;
        ignoreList          = bossModule.GetIgnoredModules(modSelf, ignoreList);
        modSelf.OnActivate += StartBossModule;

        for (int x = 0; x < arrowRenderers.Length; x++)
        {
            arrowRenderers[x].material.color = Color.black;
        }
        textDisplay.text = "";
        firstTextColor   = textDisplay.color;
        for (int x = 0; x < arrowButtons.Length; x++)
        {
            int y = x;
            arrowButtons[x].OnInteract += delegate {
                if (!(moduleSolved || isanimating))
                {
                    MAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, arrowButtons[y].transform);
                    arrowButtons[y].AddInteractionPunch();
                    ProcessInput(y);
                }
                return(false);
            };
        }
    }
コード例 #5
0
    private void Start()
    {
        SetColorblind(ColorblindMode.ColorblindModeActive);

        _moduleId           = _moduleIdCounter++;
        _squares            = AllSquares.Select(obj => obj.GetComponent <MeshRenderer>()).ToArray();
        _squareDownAtSolved = null;
        _isSolved           = false;
        _arrangeRunning     = false;
        _animationRunning   = 0;

        var snPairs = new List <ColorPair>();

        foreach (var ch in Bomb.GetSerialNumberLetters().Distinct())
        {
            var ix = Array.IndexOf(_table, ch - 'A' + 1);
            snPairs.Add(new ColorPair(ix % Colors.Length, ix / Colors.Length));
        }
        _snColorPairs = snPairs.ToArray();
        _curSolved    = 0;

        for (int i = 0; i < AllSquares.Length; i++)
        {
            AllSquares[i].OnInteract      = mouseDown(i % 13, i / 13, i);
            AllSquares[i].OnInteractEnded = mouseUp(i % 13, i / 13, i);
        }

        _ignoredModules = BossModule.GetIgnoredModules(Module, _defaultIgnoredModules);
        Debug.LogFormat(@"<Divided Squares #{0}> Ignored modules: {1}", _moduleId, _ignoredModules.Join(", "));

        _numOtherModules = Bomb.GetSolvableModuleNames().Count(str => !_ignoredModules.Contains(str));
        StartCoroutine(Arrange(1, _curSolved));
        StartCoroutine(HideStatusLight());
    }
コード例 #6
0
 void Awake()
 {
     moduleId       = moduleIdCounter++;
     ignoredModules = BossModule.GetIgnoredModules(Module, defaultIgnoredModules);
     foreach (LightInformation button in lightDevices)
     {
         LightInformation pressedButton = button;
         button.connectedButton.OnInteract += delegate() { ButtonPress(pressedButton); return(false); };
     }
 }
コード例 #7
0
 void Start()
 {
     if (IgnoredModules == null)
     {
         IgnoredModules = Boss.GetIgnoredModules("Floor Lights", new string[] {
             "14",
             "42",
             "501",
             "A>N<D",
             "Bamboozling Time Keeper",
             "Brainf---",
             "Busy Beaver",
             "Don't Touch Anything",
             "Floor Lights",
             "Forget Any Color",
             "Forget Enigma",
             "Forget Everything",
             "Forget It Not",
             "Forget Me Later",
             "Forget Me Not",
             "Forget Perspective",
             "Forget The Colors",
             "Forget Them All",
             "Forget This",
             "Forget Us Not",
             "Iconic",
             "Keypad Directionality",
             "Kugelblitz",
             "Multitask",
             "OmegaDestroyer",
             "OmegaForget",
             "Organization",
             "Password Destroyer",
             "Purgatory",
             "RPS Judging",
             "Security Council",
             "Shoddy Chess",
             "Simon Forgets",
             "Simon's Stages",
             "Souvenir",
             "Tallordered Keys",
             "The Time Keeper",
             "The Troll",
             "The Twin",
             "The Very Annoying Button",
             "Timing is Everything",
             "Turn The Key",
             "Ultimate Custom Night",
             "Übermodule",
             "Whiteout"
         });
     }
     Module.OnActivate += StartingNumber;
 }
コード例 #8
0
    void Start()
    {
        _moduleId             = _moduleIdCounter++;
        colorblindModeEnabled = colorblindMode.ColorblindModeActive;
        listF = BossModule.GetIgnoredModules(Module, listFDefault);
        Init();
        canPress = true;
        float scalar = transform.lossyScale.x;

        theLight.range  *= scalar;
        theLight.enabled = false;
    }
コード例 #9
0
 void Start()
 {
     _displayTexts[1].text = _carNames[_carIndex];
     _displayTexts[2].text = _conditionNames[_conditionIndex];
     _today        = DateTime.Now.DayOfWeek;
     _startingTime = (int)_bomb.GetTime();
     _ignore       = _boss.GetIgnoredModules(_module, _ignore);
     _halfModules  = _bomb.GetSolvableModuleNames().Where(x => !_ignore.Contains(x)).Count() / 2;
     _ignoredTotal = _bomb.GetSolvableModuleNames().Where(x => !_ignore.Contains(x)).Count();
     Debug.LogFormat("[Burnout #{0}]: Half of the bomb solves is at {1} and the full bomb is at {2} solves.", _modID, _halfModules, _ignoredTotal);
     GenerateAnswer();
 }
コード例 #10
0
    /// <summary>
    /// Creates new arrows and logs answer.
    /// </summary>
    private void Init()
    {
        //set ignore list from bossmodulehandler
        string[] ignoredModules = Boss.GetIgnoredModules(Module, _ignore);
        if (ignoredModules != null)
        {
            _ignore = ignoredModules;
        }

        //if module is selected, start payload
        if (!_isSolved && _lightsOn)
        {
            GetComponent <KMSelectable>().OnInteract += OnInteract;
        }
    }
コード例 #11
0
 // Use this for initialization
 void Start()
 {
     if (ignoredModules == null)
     {
         ignoredModules = boss.GetIgnoredModules("Simp Me Not", new string[] {
             "14",
             "Cruel Purgatory",
             "Forget Enigma",
             "Forget Everything",
             "Forget It Not",
             "Forget Me Later",
             "Forget Me Not",
             "Forget Perspective",
             "Forget Them All",
             "Forget This",
             "Forget Us Not",
             "Organization",
             "Purgatory",
             "Simon's Stages",
             "Souvenir",
             "Tallordered Keys",
             "The Time Keeper",
             "Timing is Everything",
             "The Troll",
             "Turn The Key",
             "Übermodule",
             "Ültimate Custom Night",
             "The Very Annoying Button",
             "Simp Me Not"
         });
     }
     Module.OnActivate += delegate()
     {
         totalStages = Info.GetSolvableModuleNames().Where(a => !ignoredModules.Contains(a)).ToList().Count;
         if (totalStages <= 0)
         {
             Debug.LogFormat("[Simp Me Not #{0}] Cannot generate stages, autosolving...", curModID); Module.HandlePass();
         }
     };
     button.OnInteract += delegate()
     {
         HandleButton();
         return(false);
     };
 }
コード例 #12
0
 // Use this for initialization
 void Awake()
 {
     curmodID           = modID++;
     ignoredModuleNames = bossModuleHandler.GetIgnoredModules("Simon", new string[] {
         "14",
         "Bamboozling Time Keeper",
         "Cookie Jars",
         "The Digits",
         "Divided Squares",
         "Forget Enigma",
         "Forget Everything",
         "Forget Infinity",
         "Forget It Not",
         "Forget Me Later",
         "Forget Me Not",
         "Forget The Colors",
         "Forget Them All",
         "Forget This",
         "Forget Us Not",
         "The Heart",
         "Hogwarts",
         "Iconic",
         "Multitask",
         "Mystery Module",
         "Organization",
         "Purgatory",
         "Random Access Memory",
         "RPS Judging",
         "Simon",
         "Simon Forgets",
         "Simon's Stages",
         "Souvenir",
         "The Swan",
         "Tallordered Keys",
         "The Time Keeper",
         "Timing is Everything",
         "The Troll",
         "Turn The Key",
         "The Twin",
         "Übermodule",
         "Ultimate Custom Night",
         "The Very Annoying Button",
     });
     Debug.LogFormat("<Simon #{0}> Ignored Modules: {1}", curmodID, ignoredModuleNames.Join(","));
 }
コード例 #13
0
 void Awake()
 {
     _moduleId = _moduleIdCounter++;
     string[] ingore = Boss.GetIgnoredModules(Module, ignoredModules);
     if (ingore != null)
     {
         ignoredModules = ingore;
     }
     for (byte i = 0; i < Buttons.Length; i++)
     {
         KMSelectable btn = Buttons[i];
         btn.OnInteract += delegate
         {
             HandlePress(btn);
             return(false);
         };
     }
 }
コード例 #14
0
    //Set-up
    void Awake()
    {
        ignoredModules = BossModule.GetIgnoredModules(BombModule, defaultIgnoredModules);

        moduleId = moduleIdCounter++;
        GetComponent <KMBombModule>().OnActivate += OnActivate;
        execute.OnInteract  += delegate() { onExecute(); return(false); };
        button0.OnInteract  += delegate() { keyPress(button0); return(false); };
        button1.OnInteract  += delegate() { keyPress(button1); return(false); };
        button2.OnInteract  += delegate() { keyPress(button2); return(false); };
        button3.OnInteract  += delegate() { keyPress(button3); return(false); };
        button4.OnInteract  += delegate() { keyPress(button4); return(false); };
        button5.OnInteract  += delegate() { keyPress(button5); return(false); };
        button6.OnInteract  += delegate() { keyPress(button6); return(false); };
        button7.OnInteract  += delegate() { keyPress(button7); return(false); };
        button8.OnInteract  += delegate() { keyPress(button8); return(false); };
        button9.OnInteract  += delegate() { keyPress(button9); return(false); };
        button10.OnInteract += delegate() { keyPress(button10); return(false); };
        button11.OnInteract += delegate() { keyPress(button11); return(false); };
    }
コード例 #15
0
 void Start()
 {
     if (IgnoredModules == null)
     {
         IgnoredModules = Boss.GetIgnoredModules("RPS Judging", new string[] {
             "14",
             "Brainf---",
             "Cookie Jars",
             "Divided Squares",
             "Forget Enigma",
             "Forget Everything",
             "Forget Infinity",
             "Forget It Not",
             "Forget Me Later",
             "Forget Me Not",
             "Forget Perspective",
             "Forget The Colors",
             "Forget Them All",
             "Forget This",
             "Forget Us Not",
             "Hogwarts",
             "Organization",
             "Purgatory",
             "RPS Judging",
             "Simon Forgets",
             "Simon's Stages",
             "Souvenir",
             "Tallordered Keys",
             "The Swan",
             "The Time Keeper",
             "The Troll",
             "The Very Annoying Button",
             "Timing is Everything",
             "Turn The Key",
             "Ultimate Custom Night",
             "Übermodule"
         });
     }
     ClearFace();
     Module.OnActivate += StartingNumber;
 }
コード例 #16
0
    void Start()
    {
        SolveCheckTicks = 0;
        Score           = 0;
        TicksBuzzedIn   = 0;

        GuessText.text = "" + (char)('A' + Random.Range(0, 26));

        SolvedModuleCounts = new Dictionary <string, int>();
        TotalModulesSolved = 0;

        QueuedKlaxonModules = new Queue <string>();

        ModuleLog("Good evening and welcome to QI!");

        KlaxonIsIdle = true;
        IsSolved     = false;

        CanBuzzIn = true;

        // Puzzle generation logic

        // Put the modules in an arbitrary order
        var ModulesInLogic = BombInfo.GetSolvableModuleNames().Select(name => name.ToUpperInvariant())
                             .Except(BossModule.GetIgnoredModules(BombModule, DefaultIgnoredModules).Select(name => name.ToUpperInvariant()))
                             .ToArray();

        ModuleLog("ModulesInLogic = [{0}]", ModulesInLogic.Join(", "));

        // For each letter, build up a sorted list of indices
        var alphabetSets = Enumerable.Range(0, 26).Select(i => new List <int>()).ToArray();

        for (int i = 0; i < ModulesInLogic.Length; i++)
        {
            var moduleLetters = ModulesInLogic[i].ToUpperInvariant().Intersect("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
            foreach (char c in moduleLetters)
            {
                alphabetSets[c - 'A'].Add(i);
            }
        }

        // Turn the index lists into strings so we get key hashing for free
        var alphabetKeys = alphabetSets.Select(indices => indices.Select(i => i.ToString()).Join(",")).ToArray();

        var keysToCorrectChars = new Dictionary <string, List <char> >();

        for (int i = 0; i < alphabetKeys.Length; i++)
        {
            var key = alphabetKeys[i];
            if (!keysToCorrectChars.ContainsKey(key))
            {
                keysToCorrectChars[key] = new List <char>();
            }
            keysToCorrectChars[key].Add((char)('A' + i));
        }


        //
        var singletons = keysToCorrectChars.Where(kvp => kvp.Value.Count() == 1);

        if (singletons.Any())
        {
            CorrectLetters = new[] { singletons.PickRandom().Value.First() };
            ModuleLog("Tonight's special letter is {0}. Any module you solve containing this letter will cause the klaxon to go off.", CorrectLetters.First());
        }
        else
        {
            CorrectLetters = keysToCorrectChars[alphabetKeys.PickRandom()].ToArray();
            var OxfordCommaIfNeeded = CorrectLetters.Length >= 3 ? "," : "";             // I like the Oxford comma. Don't judge me.
            ModuleLog("Tonight we have multiple special letters: {0}{1} and {2}, {3} of which produce the same set of klaxons. Any module you solve containing {4} of these letters will cause the klaxon to go off.", CorrectLetters.Take(CorrectLetters.Length - 1).Join(", "), OxfordCommaIfNeeded, CorrectLetters.Last(), CorrectLetters.Length >= 3 ? "all" : "both", CorrectLetters.Length >= 3 ? "any" : "either");
        }
    }
コード例 #17
0
 // Use this for initialization
 void Start()
 {
     // Check on Ignore List on Repo
     if (ignoredModules == null)
     {
         ignoredModules = bossHandler.GetIgnoredModules("Forget It Not", new string[] {
             "14",
             "Cruel Purgatory",
             "Forget Enigma",
             "Forget Everything",
             "Forget It Not",
             "Forget Me Later",
             "Forget Me Not",
             "Forget Perspective",
             "Forget Them All",
             "Forget This",
             "Forget Us Not",
             "Organization",
             "Purgatory",
             "Simon's Stages",
             "Souvenir",
             "Tallordered Keys",
             "The Time Keeper",
             "Timing is Everything",
             "The Troll",
             "Turn The Key",
             "Übermodule",
             "Ültimate Custom Night",
             "The Very Annoying Button"
         });
     }
     //
     // Default Ignore Reasons:
     // Forget It Not: DON'T HANG BOMBS WITH DUPLICATES OF THIS
     // Other "Forget" modules, Tallordered Keys, Simon's Stages, Übermodule: Requires this module to be solved without Boss Module Manager updated
     // Purgatory + "Cruel" variant: Rare last condition that can hang a bomb
     // The Time Keeper, Timing is Everything, Turn The Key: Bomb Timer sensitive, bomb stalling is NOT FUN.
     // Souvenir: Requires this module to be solved, can eat time when this module is not in "finale" phase.
     // Organization: Requires this module to be solved, MUST enter force-solve phase if requested.
     // The Very Annoying Button, The Troll: Worst case senario requires this module to be solved or the bomb hangs.
     //
     modSelf.OnActivate += delegate() {
         totalstages = bombInfo.GetSolvableModuleNames().Where(a => !ignoredModules.Contains(a)).ToList().Count;
         if (totalstages > 0)
         {
             Debug.LogFormat("[Forget It Not #{0}]: {1} stage(s) generatable.", curModID, totalstages);
             // Start generating stages
             for (int x = 0; x < totalstages; x++)
             {
                 combinedDisplayString += Random.Range(0, 10).ToString();
             }
             string DebugString = "";
             int    o           = 0;
             for (int i = 0; i < combinedDisplayString.Length / 3; i++)
             {
                 //print(combinedDisplayString.Substring(i * 3, 3));
                 DebugString += combinedDisplayString.Substring(i * 3, 3) + " ";
                 o++;
             }
             DebugString += combinedDisplayString.Substring(o * 3, Mathf.Min(3, combinedDisplayString.Length - (o * 3)));
             Debug.LogFormat("[Forget It Not #{0}]: Display: {1}", curModID, DebugString.Trim());
             canStart = true;
         }
         else
         {
             Debug.LogFormat("[Forget It Not #{0}]: Auto solving... Module cannot generate stages.", curModID);
             modSelf.HandlePass();
         }
     };
     bombInfo.OnBombExploded += delegate() {
         if (curstagenum < totalstages)
         {
             if (curstagenum + 1 < totalstages)
             {
                 Debug.LogFormat("[Forget It Not #{0}]: The module displayed up to {1} stage(s) before the bomb detonated.", curModID, curstagenum + 1);
             }
             else
             {
                 Debug.LogFormat("[Forget It Not #{0}]: All {1} stage(s) were displayed before the bomb detonated.", curModID, curstagenum + 1);
             }
         }
         else if (correctinputs < totalstages)
         {
             Debug.LogFormat("[Forget It Not #{0}]: Up to {1} stage(s) were inputted correct before the bomb detonated.", curModID, correctinputs);
         }
     };
     for (int x = 0; x < digitSelectables.Count(); x++)
     {
         int y = x;
         digitSelectables[x].OnInteract += delegate() {
             digitSelectables[y].AddInteractionPunch(0.05f);
             kMAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform);
             if (curstagenum < totalstages)
             {
                 modSelf.HandleStrike();
                 Debug.LogFormat("[Forget It Not #{0}]: Not yet! Defuser pressed a digit before module is ready for input.", curModID);
                 return(false);
             }
             if (correctinputs < totalstages)
             {
                 int currentDigit = int.Parse(combinedDisplayString.Substring(correctinputs, 1));
                 if (currentDigit == y)
                 {
                     correctinputs++;
                     ShowCurrentInput();
                     if (correctinputs >= totalstages)
                     {
                         modSelf.HandlePass();
                         Debug.LogFormat("[Forget It Not #{0}]: Module defused!", curModID);
                         StartCoroutine(ActivateSolveAnim());
                     }
                 }
                 else
                 {
                     HandleIncorrectPress();
                     Debug.LogFormat("[Forget It Not #{0}]: For the input on stage {1}, {2} is incorrectly pressed.", curModID, correctinputs + 1, y);
                     modSelf.HandleStrike();
                 }
             }
             return(false);
         };
     }
 }
コード例 #18
0
 // Use this for initialization
 void Start()
 {
     _ignoredModules    = BossModule.GetIgnoredModules(module, _ignoredModulesDefault);
     module.OnActivate += OnActivate;
     RandomizeLED();
 }
コード例 #19
0
 private string[] GetIgnored()
 {
     return(BossManager.GetIgnoredModules("Mystery Widget", new string[] { "Mystery Widget", "Cookie Jars", "Divided Squares", "Encrypted Hangman", "Encryption Bingo", "Four-Card Monte", "Hogwarts", "The Heart", "The Swan", "Button Messer", "Random Access Memory", "Turn The Keys", "Tech Support", "+FullBoss", "+SemiBoss" }));
 }
コード例 #20
0
    private IEnumerator DelayedStart()
    {
        TechSupportService mysteryKeyService = GetComponent <TechSupportService>();

        while (!mysteryKeyService.SettingsLoaded)
        {
            yield return(null);
        }

        KMBossModule bossModule = GetComponent <KMBossModule>();

        string[] ignoredModules = bossModule.GetIgnoredModules(needyModule.ModuleDisplayName);

        if (ignoredModules == null || ignoredModules.Length == 0)
        {
            TechSupportLog.Log("Using backup ignorelist.");
            ignoredModules = backUpIgnoreList.text.Split('\n');
        }

        KMBombModule[] bombModules = FindObjectsOfType <KMBombModule>();

        foreach (KMBombModule bombModule in bombModules)
        {
            try
            {
                bool mustNotBeHidden = mysteryKeyService.MustNotBeHidden(bombModule.ModuleType);
                bool isIgnored       = ignoredModules.Contains(bombModule.ModuleDisplayName);

                // Ignored modules are ignored.
                if (mustNotBeHidden || isIgnored)
                {
                    TechSupportLog.LogFormat("Ignored module {0} - Must Not Be Hidden: {1}; Is Ignored {2}",
                                             bombModule.ModuleDisplayName,
                                             mustNotBeHidden,
                                             isIgnored);
                    continue;
                }

                // Collects the module's KMSelectable.
                KMSelectable selectable = bombModule.GetComponent <KMSelectable>();

                GameObject passLight   = TransformUtilities.FindChildIn(bombModule.transform, "Component_LED_PASS").gameObject;
                Transform  statusLight = passLight.transform.parent;
                GameObject strikeLight = TransformUtilities.FindChildIn(statusLight, "Component_LED_STRIKE").gameObject;
                GameObject errorLight  = Instantiate(
                    errorLightPrefab,
                    statusLight.position,
                    statusLight.rotation,
                    statusLight.transform);
                errorLight.SetActive(false);

                // Stores the acquired data.
                InterruptableModule interruptableModule = new InterruptableModule(bombModule, selectable, passLight, strikeLight, errorLight);

                interruptableModules.Add(interruptableModule);
            }
            catch (Exception exception)
            {
                TechSupportLog.LogFormat
                    ("Set-Up Interruptable ({0}) failed with message ({1}), at ({2}).",
                    bombModule.ModuleDisplayName,
                    exception.Message,
                    exception.StackTrace);
            }
        }

        TechSupportLog.LogFormat("Loaded total of {0} interruptable modules", interruptableModules.Count);
    }
コード例 #21
0
ファイル: Init.cs プロジェクト: VFlyer/EmikModules
        public void Start(ref KMBossModule Boss, ref bool colorblind, ref KMColorblindMode Colorblind, ref KMRuleSeedable Rule, ref int moduleId, ref Rule[][] rules, ref int maxStage, ref KMBombInfo BombInfo, ref List <byte> cylinder, ref List <byte> nixies, ref List <byte> gear, ref List <short> largeDisplay, ref List <int> calculatedValues, ref List <int> sineNumber, ref List <string> gearColor, ref List <string> ruleColor, ref TextMesh[] NixieTexts, ref KMAudio Audio, ref KMBombModule Module)
        {
            //boss module handler
            if (Boss.GetIgnoredModules(Module, Strings.Ignore) != null)
            {
                Strings.Ignore = Boss.GetIgnoredModules(Module, Strings.Ignore);
            }

            //enables colorblind mode if needed
            colorblind = Colorblind.ColorblindModeActive;

            //gets seed
            MonoRandom rnd = Rule.GetRNG();

            Debug.LogFormat("[Forget The Colors #{0}]: Using version {1} with rule seed: {2}.", moduleId, Strings.Version, rnd.Seed);

            if (rnd.Seed == 1)
            {
                rules = null;
            }

            else
            {
                //establishes new variable
                rules    = new Rule[2][];
                rules[0] = new Rule[21];
                rules[1] = new Rule[10];

                //applies rule seeding for cylinders
                for (byte i = 0; i < rules[0].Length; i++)
                {
                    rules[0][i] = new Rule {
                        Cylinder = (byte)rnd.Next(rules[0].Length), Operator = (byte)rnd.Next(5)
                    }
                }
                ;

                //applies rule seeding for edgework
                for (byte i = 0; i < rules[1].Length; i++)
                {
                    rules[1][i] = new Rule {
                        Edgework = (byte)rnd.Next(rules[1].Length), Operator = (byte)rnd.Next(5)
                    }
                }
                ;
            }

            //if on unity, max stage should equal the initial value assigned, otherwise set it to the proper value
            if (!Application.isEditor)
            {
                maxStage = BombInfo.GetSolvableModuleNames().Where(m => !Strings.Ignore.Contains(m)).Count();
            }

            //proper grammar!!
            if (maxStage != 1)
            {
                Debug.LogFormat("[Forget The Colors #{0}]: Welcome to FTC - This bomb will have {1} stages.", moduleId, maxStage);
            }

            else
            {
                Debug.LogFormat("[Forget The Colors #{0}]: Welcome to FTC - This bomb will have a single stage.", moduleId);
            }

            //initialization of previous stage variables
            for (ushort i = 0; i < maxStage; i++)
            {
                for (byte j = 0; j < 4; j++)
                {
                    cylinder.Add(0);
                }

                nixies.Add(0);
                nixies.Add(0);
                gear.Add(0);
                largeDisplay.Add(0);
                calculatedValues.Add(0);
                sineNumber.Add(0);
                gearColor.Add("Red");
                ruleColor.Add("Red");
            }

            //begin module
            NixieTexts[0].text = "0";
            NixieTexts[1].text = "0";
            Audio.PlaySoundAtTransform(Sounds.Ftc.Start, Module.transform);
        }
    }
}
コード例 #22
0
 // Use this for initialization
 void Start()
 {
     _ignoredModules    = BossModule.GetIgnoredModules(module, _ignoredModulesDefault);
     _moduleId          = _moduleIdCounter++;
     module.OnActivate += OnActivate;
 }
コード例 #23
0
    void Start()
    {
        _moduleId           = _moduleIdCounter++;
        LeftBtn.OnInteract  = buttonPress(LeftBtn, left: true);
        RightBtn.OnInteract = buttonPress(RightBtn, left: false);
        for (int i = 0; i < 4; i++)
        {
            Stage2Houses[i].OnInteract = stage2Select(Stage2Houses[i], (House)i);
        }
        Stage2.SetActive(false);

        _ignoredModules = BossModule.GetIgnoredModules(Module, _defaultIgnoredModules);
        Debug.LogFormat(@"<Hogwarts #{0}> Ignored modules: {1}", _moduleId, _ignoredModules.Join(", "));

        var retries = 0;

retry:
        // Find out what distinct modules are on the bomb. (Filter out Hogwartses so that it cannot softlock on itself even if the ignore list gets messed up.)
        var modules = Bomb.GetSolvableModuleNames().Where(s => s != "Hogwarts").Distinct().Except(_ignoredModules).ToList().Shuffle();
        var founders = new[] { "GODRICGRYFFINDOR", "ROWENARAVENCLAW", "SALAZARSLYTHERIN", "HELGAHUFFLEPUFF" };
        var offset   = Rnd.Range(0, 4);

        _moduleAssociations = modules.Select((m, ix) => new Assoc((House)((ix + offset) % 4), m, founders[(ix + offset) % 4].GroupBy(ch => ch).Sum(gr => gr.Count() * m.Count(c => char.ToUpperInvariant(c) == gr.Key)))).ToList();

        for (var i = 0; i < 4; i++)
        {
            var h = (House)i;
            if (!_moduleAssociations.Any(asc => asc.House == h))
            {
                _points[h] = -1;
            }
        }

        if (_moduleAssociations.Count == 0)
        {
            Debug.LogFormat(@"[Hogwarts #{0}] No suitable modules on the bomb to solve.", _moduleId);
            for (int h = 0; h < 4; h++)
            {
                _points[(House)h] = 0;
            }
            ActivateStage2();
            return;
        }
        else
        {
            select(0);
        }

        // Special case: if at least two houses have only one module, and that module gives them the same score, and this will cause a tie for the House Cup, then we can’t give a strike because the tie is unavoidable
        var info = Enumerable.Range(0, 4)
                   .Select(i => !_moduleAssociations.Any(asc => asc.House == (House)i) ? null : new
        {
            MaxPoints  = _moduleAssociations.Max(asc => asc.House == (House)i ? asc.Points : 0),
            NumModules = _moduleAssociations.Count(asc => asc.House == (House)i)
        })
                   .ToArray();

        for (int h1 = 0; h1 < 4; h1++)
        {
            for (int h2 = h1 + 1; h2 < 4; h2++)
            {
                if (info[h1] != null && info[h2] != null && info[h1].NumModules == 1 && info[h2].NumModules == 1 && info[h1].MaxPoints == info[h2].MaxPoints && Enumerable.Range(0, 4).All(h3 => h3 == h1 || h3 == h2 || info[h3] == null || info[h3].MaxPoints < info[h1].MaxPoints))
                {
                    retries++;
                    if (retries >= 100)
                    {
                        Debug.LogFormat(@"[Hogwarts #{0}] Not possible to avoid a tie for the House Cup.", _moduleId);
                        for (int h = 0; h < 4; h++)
                        {
                            _points[(House)h] = 0;
                        }
                        ActivateStage2();
                        return;
                    }
                    for (int i = 0; i < _moduleAssociations.Count; i++)
                    {
                        Debug.LogFormat(@"<Hogwarts #{0}> {1} = {2} ({3} points)", _moduleId, _moduleAssociations[i].Module, _moduleAssociations[i].House, _moduleAssociations[i].Points);
                    }
                    Debug.LogFormat(@"<Hogwarts #{0}> UNAVOIDABLE TIE! Retrying...", _moduleId);
                    goto retry;
                }
            }
        }

        for (int i = 0; i < _moduleAssociations.Count; i++)
        {
            Debug.LogFormat(@"[Hogwarts #{0}] {1} = {2} ({3} points)", _moduleId, _moduleAssociations[i].Module, _moduleAssociations[i].House, _moduleAssociations[i].Points);
        }
    }
コード例 #24
0
    void Start()
    {
        _colorblind = ColorblindMode.ColorblindModeActive;
        if (_colorblind)
        {
            ColorblindTextObject.SetActive(true);
        }
        if (_ignoredModules == null)
        {
            _ignoredModules = BossHandler.GetIgnoredModules("The Twin", new string[] {
                "14",
                "Cruel Purgatory",
                "Forget Enigma",
                "Forget Everything",
                "Forget It Not",
                "Forget Me Later",
                "Forget Me Not",
                "Forget Perspective",
                "Forget The Color",
                "Forget Them All",
                "Forget This",
                "Forget Us Not",
                "Organization",
                "Purgatory",
                "RPS Judging",
                "Simon's Stages",
                "Souvenir",
                "Tallordered Keys",
                "The Time Keeper",
                "Timing is Everything",
                "The Troll",
                "The Twin",
                "Turn The Key",
                "Übermodule",
                "Ültimate Custom Night",
                "The Very Annoying Button"
            });
        }
        for (int index = 0; index < ButtonObjects.Length; index++)
        {
            int j = index;
            _isPressed[j] = false;
            ButtonSelectables[index].OnInteract += delegate() { PressButton(j); return(false); };
        }

        FakeStatusLight = Instantiate(FakeStatusLight);
        FakeStatusLight.transform.SetParent(transform, false);
        if (Module != null)
        {
            FakeStatusLight.Module = Module;
        }

        FakeStatusLight.GetStatusLights(StatusLight);
        FakeStatusLight.SetInActive();

        var serialNumber = Info.GetSerialNumber();

        if (!_TheTwinInfos.ContainsKey(serialNumber))
        {
            _TheTwinInfos[serialNumber] = new TheTwinBombInfo();
        }
        _TheTwinInfo = _TheTwinInfos[serialNumber];
        _TheTwinInfo.Modules.Add(this);
        _modulePairId = (_TheTwinInfo.Modules.Count() + 1) / 2;
        Debug.LogFormat("[The Twin #{0}] The pair ID is {1}.", _moduleId, _modulePairId);
        if (_TheTwinInfo.Modules.Count() % 2 == 0)
        {
            ModuleObject.transform.localScale      = new Vector3(-1f, 1f, 1f);
            ScreensAndButtons.transform.localScale = new Vector3(-1f, 1f, 1f);
            Vector3 position = StatusLight.localPosition;
            position.x *= -1;
            StatusLight.localPosition = position;
            UpdateSelectable();
        }
        UpdatePairIdScreen(_modulePairId);

        _startingNumber = Rnd.Range(0, 100);
        Debug.LogFormat("[The Twin #{0}] The initial number is {1}.", _moduleId, _startingNumber);
        _stageZeroScreenNumber = _startingNumber;
        UpdateStageScreen("--");
        _startingCoordinate[0] = Rnd.Range(0, 12);
        _startingCoordinate[1] = Rnd.Range(0, 10);
        Debug.LogFormat("[The Twin #{0}] The starting coordinate in remove table is ({1}, {2}).", _moduleId, _startingCoordinate[0], _startingCoordinate[1]);
        _currentCoordinate[0]           = _startingCoordinate[0];
        _currentCoordinate[1]           = _startingCoordinate[1];
        _removeSet                      = _removeGrid[_startingCoordinate[1]][_startingCoordinate[0]];
        _startingColorGridCoordinate[0] = _startingCoordinate[0] % 6;
        _startingColorGridCoordinate[1] = _startingCoordinate[1] % 5;
        Debug.LogFormat("[The Twin #{0}] The starting coordinate in color table is ({1}, {2}).", _moduleId, _startingColorGridCoordinate[0], _startingColorGridCoordinate[1]);
        _currentColorGridCoordinate[0] = _startingColorGridCoordinate[0];
        _currentColorGridCoordinate[1] = _startingColorGridCoordinate[1];

        Module.OnActivate += delegate()
        {
            _totalStages = Math.Min(Info.GetSolvableModuleNames().Where(a => !_ignoredModules.Contains(a)).ToList().Count, 101);
            Debug.LogFormat("[The Twin #{0}] There are {1} non-ignored modules.", _moduleId, _totalStages);
            if (_totalStages < 2)
            {
                Debug.LogFormat("[The Twin #{0}] Too few non-ignored modules. Solving the module.", _moduleId);
                _autoSolved   = true;
                _moduleSolved = true;
            }
            else
            {
                _isActivated    = true;
                _sequenceLength = 2 * (_totalStages - 1);
                Debug.LogFormat("[The Twin #{0}] The initial remove set is {1}.", _moduleId, _removeSet);
                Generate();
            }
        };
    }
コード例 #25
0
 // Use this for initialization
 void Start()
 {
     _moduleId  = _moduleIdCounter++;
     exceptions = boss.GetIgnoredModules("+", new string[]
     {
         "+",
         "14",
         "42",
         "501",
         "A>N<D",
         "Bamboozling Time Keeper",
         "Brainf---",
         "Busy Beaver",
         "Don't Touch Anything",
         "Forget Any Color",
         "Forget Enigma",
         "Forget Everything",
         "Forget Infinity",
         "Forget It Not",
         "Forget Me Later",
         "Forget Me Not",
         "Forget Perspective",
         "Forget The Colors",
         "Forget Them All",
         "Forget This",
         "Forget Us Not",
         "Iconic",
         "Keypad Directionality",
         "Kugelblitz",
         "Multitask",
         "OmegaDestroyer",
         "OmegaForget",
         "Organization",
         "Password Destroyer",
         "Purgatory",
         "RPS Judging",
         "Security Council",
         "Shoddy Chess",
         "Simon Forgets",
         "Simon's Stages",
         "Souvenir",
         "Tallordered Keys",
         "The Time Keeper",
         "The Troll",
         "The Twin",
         "The Very Annoying Button",
         "Timing is Everything",
         "Turn The Key",
         "Ultimate Custom Night",
         "Übermodule",
         "Whiteout",
         "Forget Maze Not"
     });
     //Somehow Magenta doesn't appear when Range is (1,5)
     colors = new string[5] {
         "Red", "Blue", "Yellow", "Green", "Magenta"
     };
     plusBtn.OnInteract += delegate()
     {
         HandlePress();
         return(false);
     };
     plusBtn.OnInteractEnded += HandleRelease;
     Module.OnActivate       += TimeModeCheck;
     Module.OnActivate       += Activate;
 }
コード例 #26
0
ファイル: ModuleScript.cs プロジェクト: Emik03/Updog
        /// <summary>
        /// Event initializer.
        /// </summary>
        private void Awake()
        {
            // This gives a unique value of each instantiation, since moduleIdCounter is static.
            moduleId = ++moduleIdCounter;

            /*
             * The following adds all appropriate parameters for each property you assign.
             * The first if statements are to ask whether it should try adding events.
             * The other if statements are to add the events if they exist.
             */

            if (KMBombInfo != null)
            {
                if (OnBombExploded != null)
                {
                    KMBombInfo.OnBombExploded += OnBombExploded;
                }
                if (OnBombSolved != null)
                {
                    KMBombInfo.OnBombSolved += OnBombSolved;
                }
            }
            else
            {
                LogErrorIfNotNull("KMBombInfo", OnBombExploded, OnBombSolved);
            }

            if (KMBombModule != null)
            {
                if (OnActivate != null)
                {
                    KMBombModule.OnActivate += (() => isActivate = true) + OnActivate;
                }

                if (KMBossModule != null)
                {
                    IgnoreList = KMBossModule.GetIgnoredModules(KMBombModule, IgnoreList);
                }
                else if (IgnoreList != null)
                {
                    LogErrorIfNotNull("KMBossModule", IgnoreList);
                }
            }
            else
            {
                LogErrorIfNotNull("KMBombModule", OnActivate);
            }

            if (KMColorblindMode != null)
            {
                isColorblind = KMColorblindMode.ColorblindModeActive;
            }

            if (KMGameInfo != null)
            {
                if (OnAlarmClockChange != null)
                {
                    KMGameInfo.OnAlarmClockChange += OnAlarmClockChange;
                }
                if (OnLightsChange != null)
                {
                    KMGameInfo.OnLightsChange += OnLightsChange;
                }
            }
            else
            {
                LogErrorIfNotNull("KMGameInfo", OnActivateNeedy, OnNeedyActivation, OnNeedyDeactivation, OnTimerExpired);
            }

            if (KMNeedyModule != null)
            {
                if (OnActivateNeedy != null)
                {
                    KMNeedyModule.OnActivate += OnActivateNeedy;
                }
                if (OnNeedyActivation != null)
                {
                    KMNeedyModule.OnNeedyActivation += OnNeedyActivation;
                }
                if (OnNeedyDeactivation != null)
                {
                    KMNeedyModule.OnNeedyDeactivation += OnNeedyDeactivation;
                }
                if (OnTimerExpired != null)
                {
                    KMNeedyModule.OnTimerExpired += OnTimerExpired;
                }
            }
            else
            {
                LogErrorIfNotNull("KMNeedyModule", OnActivateNeedy, OnNeedyActivation, OnNeedyDeactivation, OnTimerExpired);
            }

            if (KMSelectable != null)
            {
                for (int i = 0; i < KMSelectable.Length; i++)
                {
                    for (int j = 0; j < KMSelectable[i].Length; j++)
                    {
                        AssignSelectable(KMSelectable[i][j], ref i, ref j);
                    }
                }
            }
            else
            {
                LogErrorIfNotNull("KMSelectable", OnCancel, OnDefocus, OnDeselect, OnFocus, OnHighlight, OnHighlightEnded, OnInteract, OnInteractEnded, OnLeft, OnRight, OnSelect);
            }
        }
コード例 #27
0
    // End Section
    void Start()
    {
        curmodID           = modID++;
        ignoredModuleNames = bossModuleHandler.GetIgnoredModules("Simon", new string[] {
            "+",
            "14",
            "42",
            "501",
            "Access Codes",
            "Amnesia",
            "A>N<D",
            "Bamboozling Time Keeper",
            "Black Arrows",
            "Brainf---",
            "Busy Beaver",
            "Button Messer",
            "Cookie Jars",
            "Cube Synchronization",
            "Divided Squares",
            "Don't Touch Anything",
            "Encrypted Hangman",
            "Encryption Bingo",
            "Floor Lights",
            "Forget Any Color",
            "Forget Enigma",
            "Forget Everything",
            "Forget Infinity",
            "Forget It Not",
            "Forget Me Later",
            "Forget Me Not",
            "Forget Perspective",
            "Forget The Colors",
            "Forget Them All",
            "Forget This",
            "Forget Us Not",
            "Four-Card Monte",
            "The Heart",
            "Hogwarts",
            "Iconic",
            "Keypad Directionality",
            "The Klaxon",
            "Kugelblitz",
            "Multitask",
            "Mystery Module",
            "OmegaForget",
            "OmegaDestroyer",
            "Organization",
            "Purgatory",
            "RPS Judging",
            "Security Council",
            "Shoddy Chess",
            "Simon",
            "Simon Forgets",
            "Simon's Stages",
            "Souvenir",
            "SuperBoss",
            "The Swan",
            "Tallordered Keys",
            "The Time Keeper",
            "Timing is Everything",
            "The Troll",
            "Turn The Key",
            "The Twin",
            "Übermodule",
            "Ultimate Custom Night",
            "The Very Annoying Button",
            "Whiteout",
        });
        Debug.LogFormat("<Simon #{0}> Ignored Modules: {1}", curmodID, ignoredModuleNames.Join(", "));

        if (!Application.isEditor)
        {
            unignoredModuleCount = bombInfo.GetSolvableModuleNames().Count(a => !ignoredModuleNames.Contains(a));
            Debug.LogFormat("[Simon #{0}]: Detected this many unignored modules on the bomb: {1}", curmodID, unignoredModuleCount);
        }

        idxColorList.Shuffle();
        Debug.LogFormat("[Simon #{0}]: Button Colors in reading order: {1}", curmodID, idxColorList.Select(a => debugColorString[a]).Join(", "));
        float lossyScaleSelf = moduleSelf.transform.lossyScale.x;

        for (int x = 0; x < buttonRenderers.Length; x++)
        {
            buttonRenderers[x].material.color = colorList[idxColorList[x]] * 0.5f + Color.gray * 0.5f;
        }
        for (int x = 0; x < buttonLights.Length; x++)
        {
            //buttonLights[x].color = colorList[idxColorList[x]];
            buttonLights[x].range  *= lossyScaleSelf;
            buttonLights[x].enabled = false;
        }

        moduleSelf.OnActivate += delegate {
            if (Application.isEditor)
            {
                unignoredModuleCount = bombInfo.GetSolvableModuleNames().Count(a => !ignoredModuleNames.Contains(a));
                Debug.LogFormat("[Simon #{0}]: Detected this many unignored modules on the bomb: {1}", curmodID, unignoredModuleCount);
            }
            StartCoroutine(HandleOrganMysteryModuleCore());
            // Set a random number of solves required to make Simon panic.
            if (unignoredModuleCount > 0)
            {
                solveCountActivation = uernd.Range(1, unignoredModuleCount * 3 / 4 + 1);
            }
            hasStarted = true;
        };
        buttonFlashSet = new IEnumerator[possibleButtons.Length];
        for (var x = 0; x < possibleButtons.Length; x++)
        {
            var y = x;
            possibleButtons[x].OnInteract += delegate
            {
                possibleButtons[y].AddInteractionPunch();
                mAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonRelease, possibleButtons[y].transform);
                if (!isSolved)
                {
                    HandleFlashingPress(y);
                }
                return(false);
            };
        }
    }