void SetUpSevenSegment(byte lit, SevenSegmentColor color) { int matNum; switch (color) { case SevenSegmentColor.Glitchy: matNum = RNG.Range(1, 6); break; default: matNum = (int)color; break; } for (int i = 0; i < 7; ++i) { if ((lit & (1 << i)) > 0) { SevenSegments[i].material = SevenSegMats[matNum]; SevenSegments[i].GetComponent <Animator>().Play("ColorPulsate", 0, 0); if (color == SevenSegmentColor.Glitchy) { matNum = (((matNum - 1) + RNG.Range(1, 5)) % 5) + 1; } } else { SevenSegments[i].material = SevenSegMats[0]; } } }
void StrikeWithSevenSegmentHint(byte lit, SevenSegmentColor color) { if (TwitchIsAutoSolving) { Debug.LogFormat("[A-maze-ing Buttons #{0}] Ignoring the previous strike; the autosolver couldn't avoid it due to prior actions.", thisLogID); return; } bombModule.HandleStrike(); for (int i = 0; i < 7; ++i) { if ((lit & (1 << i)) > 0) { SevenSegments[i].material = SevenSegMats[(int)color]; SevenSegments[i].GetComponent <Animator>().Play("ColorRapidFlashing", 0, 0); } else { SevenSegments[i].material = SevenSegMats[0]; } } }
IEnumerator ButtonHoldTracker() { buttonHeld = false; // Releasing before this point is considered a TAP. yield return(new WaitForSeconds(0.5f)); // Releasing after this point is considered a HOLD. int whichColor = RNG.Range(0, 100); if (whichColor < 18) { holdColor = SevenSegmentColor.Red; } else if (whichColor < 36) { holdColor = SevenSegmentColor.Blue; } else if (whichColor < 54) { holdColor = SevenSegmentColor.Green; } else if (whichColor < 72) { holdColor = SevenSegmentColor.Yellow; } else if (whichColor < 90) { holdColor = SevenSegmentColor.White; } else { holdColor = SevenSegmentColor.Glitchy; } // Previously it was possible to obtain seven segment display readings that didn't form a number. // However, this was removed to reduce rule complexity. /* if (holdDigit == -1) * { * do * { * int i = 0; * byte nextAdd; * * holdSegments = 0; * while (i < 3) * { * nextAdd = (byte)(1 << RNG.Range(0,7)); * if ((holdSegments & nextAdd) != 0) * continue; * holdSegments |= nextAdd; ++i; * } * } while (holdSegments == 0x07); // Don't allow randomly generating sevens * * Debug.LogFormat("[A-maze-ing Buttons #{0}] Seven segment display is now showing: a {1} non-number (lit segments: {2})", * thisLogID, holdColor.ToString(), Convert.ToString(holdSegments, 2).PadLeft(7, '0')); * } */ holdDigit = RNG.Range(0, 10); holdSegments = SevenSegmentDisplaySetups[holdDigit]; Debug.LogFormat("[A-maze-ing Buttons #{0}] Seven segment display is now showing: a {1} {2}", thisLogID, holdColor.ToString(), holdDigit); lastHoldNum = holdDigit; lastHoldColor = holdColor.ToString(); if (firstHoldNum == -1) { firstHoldNum = holdDigit; firstHoldColor = holdColor.ToString(); } SetUpSevenSegment(holdSegments, holdColor); buttonHeld = true; yield break; }