// Use this for initialization void Start() { moduleID++; thisModuleID = moduleID; CurrentNote = GenerateNote(); Answer = 0; CurrentStage = 0; RefAvailable = true; NumStrikes = 0; RedNotes = new bool[NoteNames.Length]; for (int i = 0; i < RedNotes.Length; i++) { RedNotes[i] = false; } IsSolved = false; PlayButton.OnInteract += delegate { HandlePress(0); return(false); }; ReferencePitch.OnInteract += delegate { HandlePress(1); return(false); }; CycleFlat.OnInteract += delegate { HandlePress(2); return(false); }; CycleSharp.OnInteract += delegate { HandlePress(3); return(false); }; SubmitButton.OnInteract += delegate { HandlePress(4); return(false); }; PPModule.OnPass += delegate { SolveAudio.Play(); IsSolved = true; return(true); }; Light = Instantiate(Light); Light.GetStatusLights(PPModule.GetComponent <Transform>()); Light.Module = PPModule; }
protected void Start() { moduleID = idCounter++; RealBombModule = BombModule.GetComponent <BombComponent>(); BombModule.OnActivate += getAnswer; Red.OnInteract += HandlePressRed; Green.OnInteract += HandlePressGreen; Blue.OnInteract += HandlePressBlue; Multiply.OnInteract += HandlePressMultiply; Reset.OnInteract += HandlePressReset; Submit.OnInteract += delegate { HandlePressSubmit("null"); return(false); }; Materials = new KMSelectable[] { Red, Green, Blue, Multiply, Reset, Submit }.Select(selectable => selectable.GetComponent <Renderer>().material).ToArray(); int index = 0; foreach (Material mat in Materials) { mat.color = DefaultColors[index % 3]; index++; } displayBG.GetComponent <Renderer>().material.color = RGBColor(0, 0, 0); }
public ThreeDMazeSusadminReflector(KMBombModule module) : base(module.ModuleType) { Component comp = module.GetComponent("ThreeDMazeModule"); map = GetFieldImpl(comp.GetType(), "map").GetValue(comp); if (map == null) { throw new Exception("map is null"); } Type mapType = map.GetType(); fldPlayerX = GetFieldImpl(mapType, "pl_x"); fldPlayerY = GetFieldImpl(mapType, "pl_y"); int?startPlayerX = fldPlayerX.GetValue(map) as int?; if (startPlayerX == null) { throw new Exception("start player x is null"); } this.startPlayerX = startPlayerX.Value; int?startPlayerY = fldPlayerY.GetValue(map) as int?; if (startPlayerY == null) { throw new Exception("start player y is null"); } this.startPlayerY = startPlayerY.Value; }
public SysadminSusadminReflector(KMBombModule module) : base(module.ModuleType) { comp = module.GetComponent("SysadminModule"); Type type = comp.GetType(); fldFixedErrorCodes = type.GetProperty("fixedErrorCodes", BindingFlags.Public | BindingFlags.Instance); fldAllocationsCount = GetFieldImpl(type, "allocationsCount"); }
//light on (begin allowing interactions) void Activate() { initVals(); initPuzzleSymbolic(); initDisplays(); correctAnswer = getAnswer(); _lightsOn = true; setTextColors(false); module.GetComponent <KMGameInfo>().OnLightsChange += OnLightChange; Debug.LogFormat("[Greek Calculus #{0}] Module activated.", _moduleId); }
public ThreeDTunnelsSusadminReflector(KMBombModule module) : base(module.ModuleType) { comp = module.GetComponent("ThreeDTunnels"); fldLocation = GetFieldImpl(comp.GetType(), "_location"); int?startLocation = fldLocation.GetValue(comp) as int?; if (startLocation == null) { throw new Exception("start location is null"); } this.startLocation = startLocation.Value; }
public LogicGatesSusadminReflector(KMBombModule module) : base(module.ModuleType) { comp = module.GetComponent("LogicGates"); fldCurrentInputIndex = GetFieldImpl(comp.GetType(), "_currentInputIndex"); int?startIndex = fldCurrentInputIndex.GetValue(comp) as int?; if (startIndex == null) { throw new Exception("start input index is null"); } startInputIndex = startIndex.Value; }
public DoubleOhSusadminReflector(KMBombModule module) : base(module.ModuleType) { comp = module.GetComponent("DoubleOhModule"); fldCurPos = GetFieldImpl(comp.GetType(), "_curPos"); int?startPos = fldCurPos.GetValue(comp) as int?; if (startPos == null) { throw new Exception("start position is null"); } this.startPos = startPos.Value; }
// Sections of the code used to handle Mystery Module and Organization in case the module is unable to grab data from the repo IEnumerator CheckOrganMysterySolveOrder(KMBombModule mModule = null) { while (mModule != null) { yield return(null); var organCoreScript = mModule.GetComponent("OrganizationScript"); if (organCoreScript != null) { var ignoreList = organCoreScript.GetValue <string[]>("ignoredModules"); if (ignoreList != null && !ignoreList.Contains(moduleSelf.ModuleDisplayName)) { var solveOrder = organCoreScript.GetValue <List <string> >("order"); if (solveOrder != null) { if (solveOrder.FirstOrDefault() == moduleSelf.ModuleDisplayName) { GenerateFlashes(); yield break; } } } continue; } else { var mysteryModCoreScript = mModule.gameObject.GetComponent("MysteryModuleScript"); if (mysteryModCoreScript != null) { var listKeyModules = mysteryModCoreScript.GetValue <List <KMBombModule> >("keyModules"); if (listKeyModules != null) { if (listKeyModules.Contains(moduleSelf)) { alterDefaultHandling = true; if (listKeyModules.FirstOrDefault().Equals(moduleSelf)) { GenerateFlashes(); yield break; } } } } else { yield break; } } } }
//When I created startTime/initialTime, my idea was that Zen mode would start at 0:01 at default, and a starting time would need to be specified via a setting. //Then I realized I should be using the starting time from the mission/freeplay binder. So it's not needed. public TTKComponentSolver(KMBombModule bombModule, Bomb bomb, float startTime) { module = bombModule; currentBomb = bomb; initialTime = startTime; if (Tweaks.TwitchPlaysActive) { return; // Don't modify TTKs if TP is active. } if (Tweaks.CurrentMode.Equals(Mode.Zen) && initialTime < 600) { initialTime *= 10; } _lock = (MonoBehaviour)_lockField.GetValue(module.GetComponent(_componentType)); if (SceneManager.Instance.GameplayState.Bombs != null) { _lock?.StartCoroutine(ReWriteTTK()); } module.OnActivate = OnActivate; }
//loading void Start() { _moduleId = _moduleIdCounter++; initPuzzle(); initDisplays(); _lightsOn = true; setTextColors(false); Module.GetComponent <KMGameInfo>().OnLightsChange += OnLightChange; Debug.LogFormat("[Binary Tree #{0}] Tree Structure:\n" + "(Key: (Button Color, Char, Text Color), colors are Red, Green, Blue, Magenta, Cyan, Yellow, Orange, grAy, Silver, blacK.)\n" + " ({1}, {2}, {3})\n" + " / \\\n" + " / \\\n" + " / \\\n" + " / \\\n" + " ({4}, {5}, {6}) ({7}, {8}, {9})\n" + " / \\ / \\\n" + " / \\ / \\\n" + "({10}, {11}, {12})({13}, {14}, {15}) ({16}, {17}, {18})({19}, {20}, {21})", _moduleId, orderColorChars[btnOrders[0]], btnChars[0], btnReverse[0] ? 'S' : 'K', orderColorChars[btnOrders[1]], btnChars[1], btnReverse[1] ? 'S' : 'K', orderColorChars[btnOrders[2]], btnChars[2], btnReverse[2] ? 'S' : 'K', orderColorChars[btnOrders[3]], btnChars[3], btnReverse[3] ? 'S' : 'K', orderColorChars[btnOrders[4]], btnChars[4], btnReverse[4] ? 'S' : 'K', orderColorChars[btnOrders[5]], btnChars[5], btnReverse[5] ? 'S' : 'K', orderColorChars[btnOrders[6]], btnChars[6], btnReverse[6] ? 'S' : 'K'); for (int i = 0; i < 7; i++) { int j = i; NodeBtns[i].OnInteract += delegate() { nodeBtnPress(j); return(false); }; } }
protected void Start() { isFaulty = ModuleType == Type.Faulty; ColKnobs = UnityEngine.Random.Range(0, 3); ColFaucet = UnityEngine.Random.Range(0, 3); ColPipe = UnityEngine.Random.Range(0, 3); Rules = new bool[6] { Info.GetOffIndicators().Contains("NSA"), Info.GetSerialNumberLetters().Any("AEIOU".Contains), (ColKnobs == 2), (ColFaucet == 1), (ColPipe == 0), Info.GetPorts().Contains("HDMI") || Info.GetPorts().Contains("RJ45") }; if (!isFaulty) { moduleID = sink_moduleIDCounter++; } else { Module.ModuleDisplayName = "Faulty Sink"; Module.ModuleType = "Faulty Sink"; moduleID = fSink_moduleIDCounter++; HotHandler = Hot.OnInteract; ColdHandler = Cold.OnInteract; coroutine3 = Spin(); StartCoroutine(coroutine3); spin = forceSpin + UnityEngine.Random.Range(0, 20); forceSpin = spin; if (spin > 10) { rotate = true; } faulty = UnityEngine.Random.Range(0, 5); switch (faulty) { case 0: PipeMesh.material.color = Color.black; Apply(new[] { 0, 1, 2 }); for (int i = 3; i < 6; i++) { Module.GetComponent <KMSelectable>().Children[i] = Basin; } Basin.OnInteract = delegate() { FaultyPVC(1); return(false); }; Hot.OnInteract = delegate() { FaultyPVC(0); return(false); }; Cold.OnInteract = delegate() { FaultyPVC(2); return(false); }; UpdateChildren(); DebugLog("Module status is unknown. Please submit [Hot] [Basin] to automatically disable the module."); goto start; case 1: ColPipe = 2; PipeMesh.material.color = new Color(0, 157 / 255f, 1); Rules[4] = false; Rules = Rules.Select(x => !x).ToArray(); DebugLog("Debug: PVC reported as blue."); break; case 2: var r = UnityEngine.Random.Range(0, 2); GetComponent <KMSelectable>().Children[1] = Faucet; GetComponent <KMSelectable>().Children[7] = Pipe; UpdateChildren(); while (new[] { ColFaucet, ColPipe }.All(x => x == ColKnobs) || new[] { ColFaucet, ColPipe }.All(x => x != ColKnobs)) { ColFaucet = UnityEngine.Random.Range(0, 3); ColPipe = UnityEngine.Random.Range(0, 3); } Apply(new[] { 0, 1, 2 }); PipeMesh.material.mainTexture = knobColors[ColPipe]; if (r == 0) { ColdMesh.material = null; } else { HotMesh.material = null; } Faucet.OnInteract = ButtonHandler(Faucet, 1, r); Pipe.OnInteract = ButtonHandler(Pipe, 1, r); Cold.OnInteract = ButtonHandler(Cold, 1, r); Hot.OnInteract = ButtonHandler(Hot, 1, r); Rules[3] = ColFaucet.Equals(1); Rules[4] = ColPipe.Equals(0); DebugLog("Debug: Cannot determine status of Button{0}. Please select one of the following textures:", r); DebugLog("Knobs: {0}", knobColors[ColKnobs].name); DebugLog("Faucet: {0}", FaucetMesh.material.mainTexture.name); DebugLog("Drain Pipe: {0}", PipeMesh.material.mainTexture.name); goto start; case 3: rotate = false; var s = UnityEngine.Random.Range(0, 2); Hot.OnInteract = delegate() { Module.HandleStrike(); DebugLog("Warning: Overheating"); processingInput = false; return(false); }; hotHolder = Hot; if (s == 0) { Hot = Faucet; Module.GetComponent <KMSelectable>().Children[1] = Faucet; } else { Hot = Pipe; Module.GetComponent <KMSelectable>().Children[7] = Pipe; } ColKnobs = 0; ColKnobs = 0; ColFaucet = 0; ColPipe = 2; Rules[2] = false; Rules[3] = false; Rules[4] = false; ColdMesh.material.color = Color.black; HotMesh.material.color = Color.black; FaucetMesh.material.color = Color.black; PipeMesh.material.color = Color.black; Steps(false); goto start; case 4: transform.Rotate(0, 180, 0); Steps(true); Apply(new[] { 3, 2, 1, 0 }); goto start; } } Apply(new[] { 0, 1, 2, 3 }); Steps(false); start : Module.OnActivate += delegate { canPress = true; }; }
protected void Start() { ModConfig modConfig = new ModConfig("SinkSettings", typeof(SinkSettings)); Settings = (SinkSettings)modConfig.Settings; if (moduleType == Type.Faulty && Settings.fault == "0") { moduleType = Type.Normal; BombModule.ModuleDisplayName = "Sink"; BombModule.ModuleType = "Sink"; } Sink_moduleId = Sink_moduleIdCounter++; ColKnobs = UnityEngine.Random.Range(0, 3); ColFaucet = UnityEngine.Random.Range(0, 3); ColPipe = UnityEngine.Random.Range(0, 3); Rules = new bool[6] { BombInfo.GetOffIndicators().Contains("NSA"), BombInfo.GetSerialNumberLetters().Any("AEIOU".Contains), (ColKnobs == 2), (ColFaucet == 1), (ColPipe == 0), (BombInfo.GetPorts().Contains("HDMI") || BombInfo.GetPorts().Contains("RJ45")) }; if (moduleType == Type.Normal && BombModule.GetComponent <KMSelectable>().Children.Count() > 2) { for (int i = 1; i < 8; i++) { if (i != 2) { BombModule.GetComponent <KMSelectable>().Children[i] = null; } } } if (moduleType == Type.Faulty) { spin = UnityEngine.Random.Range(0, 20); if (spin > 15) { rotate = true; } var faulty = UnityEngine.Random.Range(0, 5); Faucet = BombModule.GetComponent <KMSelectable>().Children[1]; Basin = BombModule.GetComponent <KMSelectable>().Children[3]; Pipe = BombModule.GetComponent <KMSelectable>().Children[7]; BombModule.GetComponent <KMSelectable>().Children[1] = null; for (int i = 3; i < 8; i++) { BombModule.GetComponent <KMSelectable>().Children[i] = null; } switch (faulty) { case 0: PipeMesh.material.color = Color.black; ColdMesh.material.mainTexture = knobColors[ColKnobs]; HotMesh.material.mainTexture = knobColors[ColKnobs]; FaucetMesh.material.mainTexture = knobColors[ColFaucet]; for (int i = 3; i < 6; i++) { BombModule.GetComponent <KMSelectable>().Children[i] = Basin; } Basin.OnInteract += delegate() { FaultyPVC(1); return(false); }; Hot.OnInteract += delegate() { FaultyPVC(0); return(false); }; Cold.OnInteract += delegate() { FaultyPVC(2); return(false); }; BombModule.GetComponent <KMSelectable>().UpdateChildren(); goto start; case 1: ColPipe = 2; PipeMesh.material.color = new Color(0, 157 / 255f, 1); Rules[4] = false; Rules = Rules.Select(x => !x).ToArray(); break; case 2: var r = UnityEngine.Random.Range(0, 2); ColdMesh.material.mainTexture = knobColors[ColKnobs]; HotMesh.material.mainTexture = knobColors[ColKnobs]; if (r == 0) { ColdMesh.material = null; } else { HotMesh.material = null; } BombModule.GetComponent <KMSelectable>().Children[1] = Faucet; BombModule.GetComponent <KMSelectable>().Children[7] = Pipe; BombModule.GetComponent <KMSelectable>().UpdateChildren(); while (ColFaucet == ColPipe && ColKnobs == ColPipe) { ColFaucet = UnityEngine.Random.Range(0, 3); ColPipe = UnityEngine.Random.Range(0, 3); } if (!ColFaucet.Equals(ColKnobs) && !ColPipe.Equals(ColKnobs)) { ColPipe = ColKnobs; } FaucetMesh.material.mainTexture = knobColors[ColFaucet]; PipeMesh.material.mainTexture = knobColors[ColPipe]; if (!ColPipe.Equals(ColKnobs)) { PipeMesh.material.mainTexture = null; } Faucet.OnInteract = ButtonHandler(Faucet, 1, r); Pipe.OnInteract = ButtonHandler(Pipe, 1, r); Cold.OnInteract = ButtonHandler(Cold, 1, r); Hot.OnInteract = ButtonHandler(Hot, 1, r); Rules[3] = ColFaucet.Equals(1); Rules[4] = ColPipe.Equals(0); goto start; case 3: rotate = false; var s = UnityEngine.Random.Range(0, 2); var selectable = new[] { Faucet, Pipe }; Hot.OnInteract += delegate() { BombModule.HandleStrike(); DebugLog("Warning: Overheating"); return(false); }; if (s == 0) { Hot = Faucet; BombModule.GetComponent <KMSelectable>().Children[1] = Faucet; } else { Hot = Pipe; BombModule.GetComponent <KMSelectable>().Children[7] = Pipe; } ColKnobs = 0; ColFaucet = 0; ColPipe = 2; Rules[2] = false; Rules[3] = false; Rules[4] = false; ColdMesh.material.color = Color.black; HotMesh.material.color = Color.black; FaucetMesh.material.color = Color.black; PipeMesh.material.color = Color.black; Steps(); goto start; case 4: BombModule.transform.Rotate(0, 180, 0); Rules = Rules.Reverse().ToArray(); switch (BombInfo.GetBatteryCount()) { case 0: case 1: selectedRules = new[] { 4, 6, 5 }; break; case 2: case 3: selectedRules = new[] { 1, 3, 5 }; Rules = Rules.Select(x => !x).ToArray(); break; case 4: case 5: selectedRules = new[] { 2, 6, 3 }; Rules = Rules.Select(x => !x).ToArray(); break; default: selectedRules = new[] { 4, 1, 2 }; break; } ColdMesh.material.mainTexture = knobColors[ColKnobs]; HotMesh.material.mainTexture = knobColors[ColKnobs]; FaucetMesh.material.mainTexture = knobColors[ColFaucet]; knob1 = Rules[selectedRules[0] - 1]; knob2 = Rules[selectedRules[1] - 1]; knob3 = Rules[selectedRules[2] - 1]; if (ColPipe != 2) { PipeMesh.material.mainTexture = knobColors[ColPipe]; } DebugLog("Third Knob: {0}", knob1 ? "Hot" : "Cold"); DebugLog("Second Knob: {0}", knob2 ? "Hot" : "Cold"); DebugLog("First Knob: {0}", knob3 ? "Hot" : "Cold"); DebugLog("Knobs are {0}, Faucet is {1}, Drain Pipe is {2}", textureList[ColKnobs], textureList[ColFaucet], colorList[ColPipe]); StartCoroutine(CheckForTurn()); Cold.OnInteract = ButtonHandler(Cold, 0); Hot.OnInteract = ButtonHandler(Hot, 0); canPress = true; BombModule.GetComponent <KMSelectable>().UpdateChildren(); goto start; } } ColdMesh.material.mainTexture = knobColors[ColKnobs]; HotMesh.material.mainTexture = knobColors[ColKnobs]; FaucetMesh.material.mainTexture = knobColors[ColFaucet]; if (ColPipe != 2) { PipeMesh.material.mainTexture = knobColors[ColPipe]; } Steps(); start : return; }
public MinesweeperSusadminReflector(KMBombModule module) : base(module.ModuleType) { comp = module.GetComponent("MinesweeperModule"); fldStartFound = GetFieldImpl(comp.GetType(), "StartFound"); }
public ColoredSquaresSusadminReflector(KMBombModule module, string componentName) : base(module.ModuleType) { comp = module.GetComponent(componentName); fldColors = GetFieldImpl(comp.GetType(), "_colors"); this.componentName = componentName; }
public NotMorseCodeSusadminReflector(KMBombModule module) : base(module.ModuleType) { comp = module.GetComponent("NotMorseCode"); fldChannelIndex = GetFieldImpl(comp.GetType(), "channelIndex"); }
public ColoredSwitchesSusadminReflector(KMBombModule module) : base(module.ModuleType) { comp = module.GetComponent("ColoredSwitchesModule"); fldNumInitialToggles = GetFieldImpl(comp.GetType(), "_numInitialToggles"); }
public SeaShellsSusadminReflector(KMBombModule module) : base(module.ModuleType) { comp = module.GetComponent("SeaShellsModule"); fldStage = GetFieldImpl(comp.GetType(), "stage"); }
public SimonStatesSusadminReflector(KMBombModule module) : base(module.ModuleType) { comp = module.GetComponent("AdvancedSimon"); fldProgress = GetFieldImpl(comp.GetType(), "Progress"); }
public static void FromModule(KMBombModule module, float time) { module.GetComponent("BombComponent").GetValue <object>("Bomb").CallMethod <object>("GetTimer").SetValue("TimeRemaining", time); }
public ThirdBaseSusadminReflector(KMBombModule module) : base(module.ModuleType) { comp = module.GetComponent("ThirdBaseModule"); fldStage = GetFieldImpl(comp.GetType(), "stage"); }
public WhosOnFirstSusadminReflector(KMBombModule module) : base(module.ModuleType) { comp = module.GetComponent("WhosOnFirstComponent"); fldCurrentStage = comp.GetType().GetProperty("CurrentStage", BindingFlags.Public | BindingFlags.Instance); }
public NonverbalSimonSusadminReflector(KMBombModule module) : base(module.ModuleType) { comp = module.GetComponent("NonverbalSimonHandler"); fldStagesCompleted = GetFieldImpl(comp.GetType(), "stagesCompleted"); }
public static float FromModule(KMBombModule module) { return(module.GetComponent("BombComponent").GetValue <object>("Bomb").CallMethod <object>("GetTimer").GetValue <float>("GetRate")); }
public TwoBitsSusadminReflector(KMBombModule module) : base(module.ModuleType) { comp = module.GetComponent("TwoBitsModule"); fldCurrentState = GetFieldImpl(comp.GetType(), "currentState"); }