Esempio n. 1
0
    void Awake()
    {
        PrepareLights();

        fakeInfo = gameObject.AddComponent <FakeBombInfo>();
        fakeInfo.ActivateLights += delegate()
        {
            TurnLightsOn();
            fakeInfo.OnLightsOn();
        };
        TurnLightsOff();

        Modules      = FindObjectsOfType <KMBombModule>();
        NeedyModules = FindObjectsOfType <KMNeedyModule>();
        for (int i = 0; i < Modules.Length; i++)
        {
            Handlers(Modules[i].GetComponent <KMBombInfo>());
        }
        for (int i = 0; i < NeedyModules.Length; i++)
        {
            Handlers(NeedyModules[i].GetComponent <KMBombInfo>());
        }
        ReplaceBombInfo();
        AddHighlightables();
        AddSelectables();
    }
Esempio n. 2
0
    void Awake()
    {
        //FakeInfo = gameObject.AddComponent<FakeBombInfo>();
        FakeInfo.ActivateLights += delegate()
        {
            TurnLightsOn();
            FakeInfo.OnLightsOn();
            StartCoroutine(TimerTick());
            StartCoroutine(LastMinuteWarning());
        };
        TurnLightsOff();

        ReplaceBombInfo();
        AddHighlightables();
        AddSelectables();
    }
Esempio n. 3
0
    void OnGUI()
    {
        if (GUILayout.Button("Activate Needy Modules"))
        {
            foreach (KMNeedyModule needyModule in GameObject.FindObjectsOfType <KMNeedyModule>())
            {
                if (needyModule.OnNeedyActivation != null)
                {
                    needyModule.OnNeedyActivation();
                }
            }
        }

        if (GUILayout.Button("Deactivate Needy Modules"))
        {
            foreach (KMNeedyModule needyModule in GameObject.FindObjectsOfType <KMNeedyModule>())
            {
                if (needyModule.OnNeedyDeactivation != null)
                {
                    needyModule.OnNeedyDeactivation();
                }
            }
        }

        if (GUILayout.Button("Lights On"))
        {
            TurnLightsOn();
            fakeInfo.OnLightsOn();
        }

        if (GUILayout.Button("Lights Off"))
        {
            TurnLightsOff();
            fakeInfo.OnLightsOff();
        }

        GUILayout.Label("Time remaining: " + fakeInfo.GetFormattedTime());

        GUILayout.Space(10);

        command = GUILayout.TextField(command);
        if ((GUILayout.Button("Simulate Twitch Command") || Event.current.keyCode == KeyCode.Return) && command != "")
        {
            Debug.Log("Twitch Command: " + command);

            Component[] allComponents = currentSelectable.gameObject.GetComponentsInChildren <Component>(true);
            foreach (Component component in allComponents)
            {
                System.Type type   = component.GetType();
                MethodInfo  method = type.GetMethod("ProcessTwitchCommand", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

                if (method != null)
                {
                    StartCoroutine(SimulateModule(component, currentSelectable.transform, method, command));
                }
            }

            command = "";
        }
    }
    void Awake()
    {
        fakeInfo = gameObject.AddComponent <FakeBombInfo>();
        fakeInfo.ActivateLights += delegate()
        {
            TurnLightsOn();
            fakeInfo.OnLightsOn();
        };
        TurnLightsOff();

        ReplaceBombInfo();
        AddHighlightables();
        AddSelectables();
    }
Esempio n. 5
0
    void Awake()
    {
        PrepareLights();

        fakeInfo = gameObject.AddComponent <FakeBombInfo>();
        fakeInfo.SetupEdgework(EdgeworkConfiguration);

        fakeInfo.ActivateLights += delegate()
        {
            TurnLightsOn();
            fakeInfo.OnLightsOn();
        };
        TurnLightsOff();

        ReplaceBombInfo();
        AddHighlightables();
        AddSelectables();
    }
Esempio n. 6
0
    void OnGUI()
    {
        if (GUILayout.Button("Activate Needy Modules"))
        {
            foreach (KMNeedyModule needyModule in GameObject.FindObjectsOfType <KMNeedyModule>())
            {
                if (needyModule.OnNeedyActivation != null)
                {
                    needyModule.OnNeedyActivation();
                }
            }
        }

        if (GUILayout.Button("Deactivate Needy Modules"))
        {
            foreach (KMNeedyModule needyModule in GameObject.FindObjectsOfType <KMNeedyModule>())
            {
                if (needyModule.OnNeedyDeactivation != null)
                {
                    needyModule.OnNeedyDeactivation();
                }
            }
        }

        if (GUILayout.Button("Lights On"))
        {
            TurnLightsOn();
            fakeInfo.OnLightsOn();
        }

        if (GUILayout.Button("Lights Off"))
        {
            TurnLightsOff();
            fakeInfo.OnLightsOff();
        }

        GUILayout.Label("Time remaining: " + fakeInfo.GetFormattedTime());
    }
Esempio n. 7
0
    void OnGUI()
    {
        if (GUILayout.Button("Activate Needy Modules"))
        {
            foreach (KMNeedyModule needyModule in GameObject.FindObjectsOfType <KMNeedyModule>())
            {
                if (needyModule.OnNeedyActivation != null)
                {
                    needyModule.OnNeedyActivation();
                }
            }
        }

        if (GUILayout.Button("Deactivate Needy Modules"))
        {
            foreach (KMNeedyModule needyModule in GameObject.FindObjectsOfType <KMNeedyModule>())
            {
                if (needyModule.OnNeedyDeactivation != null)
                {
                    needyModule.OnNeedyDeactivation();
                }
            }
        }

        if (GUILayout.Button("Lights On"))
        {
            TurnLightsOn();
            fakeInfo.OnLightsOn();
        }

        if (GUILayout.Button("Lights Off"))
        {
            TurnLightsOff();
            fakeInfo.OnLightsOff();
        }

        bool previous = gamepadEnabled;

        gamepadEnabled = GUILayout.Toggle(gamepadEnabled, "Emulate Gamepad");
        if (!previous && gamepadEnabled)
        {
            lastSelected = currentSelectable.GetCurrentChild();
            lastSelected.Select();
            currentSelectableArea = lastSelected.SelectableArea;
        }

        GUILayout.Label("Time remaining: " + fakeInfo.GetFormattedTime());

        GUILayout.Space(10);

        GUI.SetNextControlName("commandField");
        command = GUILayout.TextField(command);
        if ((GUILayout.Button("Simulate Twitch Command") || Event.current.keyCode == KeyCode.Return) && GUI.GetNameOfFocusedControl() == "commandField" && command != "")
        {
            Debug.Log("Twitch Command: " + command);

            foreach (var module in FindObjectsOfType <KMBombModule>().Concat <MonoBehaviour>(FindObjectsOfType <KMNeedyModule>()))
            {
                Component[] allComponents = module.gameObject.GetComponentsInChildren <Component>(true);
                foreach (var component in allComponents)
                {
                    var type   = component.GetType();
                    var method = type.GetMethod("ProcessTwitchCommand", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

                    if (method != null)
                    {
                        StartCoroutine(SimulateModule(component, module.transform, method, command));
                    }
                }
            }
            command = "";
        }
    }
    void OnGUI()
    {
        if (GUILayout.Button("Activate Needy Modules"))
        {
            foreach (KMNeedyModule needyModule in GameObject.FindObjectsOfType <KMNeedyModule>())
            {
                if (needyModule.OnNeedyActivation != null)
                {
                    needyModule.OnNeedyActivation();
                }
            }
        }

        if (GUILayout.Button("Deactivate Needy Modules"))
        {
            foreach (KMNeedyModule needyModule in GameObject.FindObjectsOfType <KMNeedyModule>())
            {
                if (needyModule.OnNeedyDeactivation != null)
                {
                    needyModule.OnNeedyDeactivation();
                }
            }
        }

        if (GUILayout.Button("Lights On"))
        {
            TurnLightsOn();
            fakeInfo.OnLightsOn();
        }

        if (GUILayout.Button("Lights Off"))
        {
            TurnLightsOff();
            fakeInfo.OnLightsOff();
        }

        GUILayout.Label(fakeInfo.GetFormattedTime());


        MessageNr = FakeBombInfo.MessageNr;
        solved    = FakeBombInfo.solved;

        if (solved)
        {
            GUILayout.Label("We did it reddit.");
        }
        if (MessageNr == 0)
        {
            GUILayout.Label("Until Self-Destruct.");
        }
        else if (MessageNr == 1)
        {
            GUILayout.Label("Until Self-Destruct. Oh no.");
        }
        else if (MessageNr == 2)
        {
            GUILayout.Label("Until Self-Destruct. Better hurry.");
        }
        else if (MessageNr == 3)
        {
            GUILayout.Label("Until Self-Destruct. We're doomed.");
        }
        else if (MessageNr == 4)
        {
            GUILayout.Label("Until Self-Destruct.");
            GUILayout.Label("Goodbye.");
        }
        else
        {
            GUILayout.Label("");
        }

        GUILayout.Space(10);

        command = GUILayout.TextField(command);
        if ((GUILayout.Button("Simulate Twitch Command") || Event.current.keyCode == KeyCode.Return) && command != "")
        {
            Debug.Log("Twitch Command: " + command);

            foreach (KMBombModule module in FindObjectsOfType <KMBombModule>())
            {
                Component[] allComponents = module.gameObject.GetComponentsInChildren <Component>(true);
                foreach (Component component in allComponents)
                {
                    System.Type type   = component.GetType();
                    MethodInfo  method = type.GetMethod("ProcessTwitchCommand", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

                    if (method != null)
                    {
                        StartCoroutine(SimulateModule(component, module.transform, method, command));
                    }
                }
            }
            command = "";
        }
    }