Example #1
0
    private IEnumerator CheckForBomb()
    {
        yield return(new WaitUntil(() => SceneManager.Instance.GameplayState.Bombs != null && SceneManager.Instance.GameplayState.Bombs.Count > 0));

        yield return(new WaitForSeconds(2.0f));

        Bombs.AddRange(SceneManager.Instance.GameplayState.Bombs);
        int i = 0;

        string[] keyModules =
        {
            "SouvenirModule", "MemoryV2", "TurnTheKey", "TurnTheKeyAdvanced", "theSwan", "HexiEvilFMN", "taxReturns"
        };
        foreach (Bomb bomb in Bombs)
        {
            BombCommanders.Add(new BombCommander(bomb, i));
            foreach (BombComponent bombComponent in bomb.BombComponents)
            {
                ComponentTypeEnum componentType = bombComponent.ComponentType;
                bool   keyModule  = false;
                string moduleName = string.Empty;

                switch (componentType)
                {
                case ComponentTypeEnum.Empty:
                case ComponentTypeEnum.Timer:
                    continue;

                case ComponentTypeEnum.NeedyCapacitor:
                case ComponentTypeEnum.NeedyKnob:
                case ComponentTypeEnum.NeedyVentGas:
                case ComponentTypeEnum.NeedyMod:
                    moduleName = bombComponent.GetModuleDisplayName();
                    keyModule  = true;
                    break;

                case ComponentTypeEnum.Mod:
                    KMBombModule KMModule = bombComponent.GetComponent <KMBombModule>();
                    keyModule = keyModules.Contains(KMModule.ModuleType);
                    goto default;

                default:
                    moduleName = bombComponent.GetModuleDisplayName();
                    break;
                }
                Module module = new Module(bombComponent, i)
                {
                    ComponentType = componentType,
                    IsKeyModule   = keyModule,
                    ModuleName    = moduleName
                };

                Modules.Add(module);
            }
            i++;
        }
        BombActive = true;
    }
Example #2
0
    private Module GetFocusedModule()
    {
        Module focused = null;

        foreach (Module module in Modules)
        {
            if (module.IsHeld())
            {
                focused = module;
            }
        }
        return(focused);
    }
Example #3
0
    private IEnumerator CheckNewModule(Action <Module> OnNew)
    {
        Module OldModule = null;

        while (true)
        {
            yield return(null);

            var NewModule = GetFocusedModule();
            if (NewModule != OldModule)
            {
                OnNew(NewModule);
                OldModule = NewModule;
            }
        }
    }