void ReplaceBombInfo() { MonoBehaviour[] scripts = MonoBehaviour.FindObjectsOfType <MonoBehaviour>(); foreach (MonoBehaviour s in scripts) { IEnumerable <FieldInfo> fields = s.GetType().GetFields(); foreach (FieldInfo f in fields) { //if (f.FieldType.Equals(typeof(KMBombInfo))) //{ //Handlers((KMBombInfo)f.GetValue(s)); //continue; //} if (f.FieldType.Equals(typeof(KMGameInfo))) { KMGameInfo component = (KMGameInfo)f.GetValue(s); component.OnLightsChange += new KMGameInfo.KMLightsChangeDelegate(fakeInfo.OnLights); //component.OnAlarmClockChange += new KMGameInfo.KMAlarmClockChangeDelegate(fakeInfo.OnAlarm); continue; } if (f.FieldType.Equals(typeof(KMGameCommands))) { KMGameCommands component = (KMGameCommands)f.GetValue(s); component.OnCauseStrike += new KMGameCommands.KMCauseStrikeDelegate(fakeInfo.HandleStrike); continue; } } } }
private void Start() { GameCommands = GetComponent <KMGameCommands>(); GameInfo = GetComponent <KMGameInfo>(); BombInfo = GetComponent <KMBombInfo>(); Service = GetComponent <KMService>(); Console = GetComponent <CommandLineWindow>(); SetUpCommands(); }
private void Start() { GameCommands = GetComponent <KMGameCommands>(); GameInfo = GetComponent <KMGameInfo>(); GameInfo.OnStateChange += delegate(KMGameInfo.State state) { CurrentState = state; }; }
/// <summary> /// Unity event. /// </summary> private void Awake() { _data = GetComponent <FactoryRoomData>(); _conveyorBeltAnimator = GetComponent <Animator>(); _room = GetComponent <KMGameplayRoom>(); _audio = GetComponent <KMAudio>(); _gameCommands = GetComponent <KMGameCommands>(); _room.OnLightChange += OnLightChange; }
private void HookUpEvents() { BombComponent.OnPass += OnPass; BombComponent.OnStrike += OnStrike; KMGameCommands gameCommands = BombComponent.GetComponentInChildren <KMGameCommands>(); if (gameCommands == null) { return; } gameCommands.OnCauseStrike += x => { OnStrike(x); }; }
void Awake() { actions = new Queue <Action>(); bombInfo = GetComponent <KMBombInfo>(); bombInfo.OnBombExploded += OnBombExplodes; bombInfo.OnBombSolved += OnBombDefused; gameCommands = GetComponent <KMGameCommands>(); bombState = "NA"; // Create the thread object. This does not start the thread. workerObject = new Worker(this); workerThread = new Thread(workerObject.DoWork); // Start the worker thread. workerThread.Start(this); }
private void Awake() { Debug.Log("[Extended Mission Settings] Awakening"); DestroyImmediate(GetComponent <KMService>()); //Hide from Mod Selector _gameInfo = GetComponent <KMGameInfo>(); _gameCommands = GetComponent <KMGameCommands>(); GameObject infoObject = new GameObject("ExtendedMissionSettingsProperties"); infoObject.transform.parent = gameObject.transform; PublicProperties = infoObject.AddComponent <ExtendedMissionSettingsProperties>(); PublicProperties.MissionExtender = this; LoadMod(); _started = true; Debug.Log("[Extended Mission Settings] Awoken"); }
protected HoldableHandler(KMHoldableCommander commander, FloatingHoldable holdable) { HoldableCommander = commander; Holdable = holdable; if (!BombMessageResponder.BombActive) { return; } KMGameCommands gameCommands = holdable.GetComponent <KMGameCommands>(); if (gameCommands == null) { return; } gameCommands.OnCauseStrike += OnStrike; }
void ReplaceBombInfo() { MonoBehaviour[] scripts = MonoBehaviour.FindObjectsOfType <MonoBehaviour>(); foreach (MonoBehaviour s in scripts) { IEnumerable <FieldInfo> fields = s.GetType().GetFields(); foreach (FieldInfo f in fields) { if (f.FieldType.Equals(typeof(KMBombInfo))) { KMBombInfo component = (KMBombInfo)f.GetValue(s); component.TimeHandler += new KMBombInfo.GetTimeHandler(fakeInfo.GetTime); component.FormattedTimeHandler += new KMBombInfo.GetFormattedTimeHandler(fakeInfo.GetFormattedTime); component.StrikesHandler += new KMBombInfo.GetStrikesHandler(fakeInfo.GetStrikes); component.ModuleNamesHandler += new KMBombInfo.GetModuleNamesHandler(fakeInfo.GetModuleNames); component.SolvableModuleNamesHandler += new KMBombInfo.GetSolvableModuleNamesHandler(fakeInfo.GetSolvableModuleNames); component.SolvedModuleNamesHandler += new KMBombInfo.GetSolvedModuleNamesHandler(fakeInfo.GetSolvedModuleNames); component.WidgetQueryResponsesHandler += new KMBombInfo.GetWidgetQueryResponsesHandler(fakeInfo.GetWidgetQueryResponses); component.IsBombPresentHandler += new KMBombInfo.KMIsBombPresent(fakeInfo.IsBombPresent); continue; } if (f.FieldType.Equals(typeof(KMGameInfo))) { KMGameInfo component = (KMGameInfo)f.GetValue(s); component.OnLightsChange += new KMGameInfo.KMLightsChangeDelegate(fakeInfo.OnLights); //component.OnAlarmClockChange += new KMGameInfo.KMAlarmClockChangeDelegate(fakeInfo.OnAlarm); continue; } if (f.FieldType.Equals(typeof(KMGameCommands))) { KMGameCommands component = (KMGameCommands)f.GetValue(s); component.OnCauseStrike += new KMGameCommands.KMCauseStrikeDelegate(fakeInfo.HandleStrike); continue; } } } }