private void Handle(int val) { if (PuzzleDisplay == null) { return; } soundActive = true; if (ticker >= 0 || pressTicker > 0) { ButtonRed.GetComponent <MeshRenderer>().material.color = DARKRED; ButtonYellow.GetComponent <MeshRenderer>().material.color = DARKYELLOW; ButtonGreen.GetComponent <MeshRenderer>().material.color = DARKGREEN; ButtonBlue.GetComponent <MeshRenderer>().material.color = DARKBLUE; } ticker = -100; DisplayPos = 0; if (val == Answer[SubProgress]) { if (SubProgress == Progress) { SubProgress = 0; Progress++; ticker = -50; if (Progress == PuzzleDisplay.Length) { Debug.Log("[Simon States #" + thisLoggingID + "] Module solved."); GetComponent <KMBombModule>().HandlePass(); if (bop) { Invoke("bopsolve", 0.6f); } PuzzleDisplay = null; } else { Debug.Log("[Simon States #" + thisLoggingID + "] Stage " + Progress + " complete."); } } else { SubProgress++; } } else { string ans = Answer[0] + ""; string ans2 = COL_LIST[Answer[0]]; if (Progress >= 1) { ans += Answer[1]; ans2 += COL_LIST[Answer[1]]; } if (Progress >= 2) { ans += Answer[2]; ans2 += COL_LIST[Answer[2]]; } if (Progress >= 3) { ans += Answer[3]; ans2 += COL_LIST[Answer[3]]; } Debug.Log("[Simon States #" + thisLoggingID + "] Expected answer: " + ans + ":" + ans2); ans = ""; ans2 = ""; for (int a = 0; a < SubProgress; a++) { ans += Answer[a]; ans2 += COL_LIST[Answer[a]]; } ans += val; ans2 += COL_LIST[val]; Debug.Log("[Simon States #" + thisLoggingID + "] Given answer: " + ans + ":" + ans2); GetComponent <KMBombModule>().HandleStrike(); SubProgress = 0; } pressTicker = 15; if (val == 0) { ButtonRed.GetComponent <MeshRenderer>().material.color = RED; PlaySound("R", true); } else if (val == 1) { ButtonYellow.GetComponent <MeshRenderer>().material.color = YELLOW; PlaySound("Y", true); } else if (val == 2) { ButtonGreen.GetComponent <MeshRenderer>().material.color = GREEN; PlaySound("G", true); } else { ButtonBlue.GetComponent <MeshRenderer>().material.color = BLUE; PlaySound("B", true); } }
public override void RealFixedTick() { if (pressTicker > 0) { pressTicker--; if (pressTicker == 0) { ButtonRed.GetComponent <MeshRenderer>().material.color = DARKRED; ButtonYellow.GetComponent <MeshRenderer>().material.color = DARKYELLOW; ButtonGreen.GetComponent <MeshRenderer>().material.color = DARKGREEN; ButtonBlue.GetComponent <MeshRenderer>().material.color = DARKBLUE; } } if (PuzzleDisplay == null) { return; } if (ticker == 0) { if (DisplayPos >= 0) { string tone = ""; if (PuzzleDisplay[DisplayPos][0]) { ButtonRed.GetComponent <MeshRenderer>().material.color = RED; tone += "R"; } if (PuzzleDisplay[DisplayPos][1]) { ButtonYellow.GetComponent <MeshRenderer>().material.color = YELLOW; tone += "Y"; } if (PuzzleDisplay[DisplayPos][2]) { ButtonGreen.GetComponent <MeshRenderer>().material.color = GREEN; tone += "G"; } if (PuzzleDisplay[DisplayPos][3]) { ButtonBlue.GetComponent <MeshRenderer>().material.color = BLUE; tone += "B"; } if (soundActive) { PlaySound(tone, false); } } } else if (ticker == 15) { if (DisplayPos >= 0) { if (PuzzleDisplay[DisplayPos][0]) { ButtonRed.GetComponent <MeshRenderer>().material.color = DARKRED; } if (PuzzleDisplay[DisplayPos][1]) { ButtonYellow.GetComponent <MeshRenderer>().material.color = DARKYELLOW; } if (PuzzleDisplay[DisplayPos][2]) { ButtonGreen.GetComponent <MeshRenderer>().material.color = DARKGREEN; } if (PuzzleDisplay[DisplayPos][3]) { ButtonBlue.GetComponent <MeshRenderer>().material.color = DARKBLUE; } } ticker = -20; if (DisplayPos == Progress) { DisplayPos = -1; ticker = -75; } else { DisplayPos++; } } ticker++; }