IEnumerator TwitchHandleForcedSolve() { if (IncorrectAnswer) { StopAllCoroutines(); Everything1.SetActive(false); Everything2.SetActive(true); BallHold.SetActive(false); Audio.PlaySoundAtTransform(SFX[1].name, transform); Module.HandlePass(); TextAndShadow[0].text = "Hole In One"; TextAndShadow[1].text = "Hole In One"; yield break; } if (!Checking) { if (!Clicked) { while (StickNum != (GatheredNumber % 5)) { if (StickNum < (GatheredNumber % 5)) { ArrowsAndCircle[2].OnInteract(); yield return(new WaitForSecondsRealtime(0.1f)); } else if (StickNum > (GatheredNumber % 5)) { ArrowsAndCircle[0].OnInteract(); yield return(new WaitForSecondsRealtime(0.1f)); } } ArrowsAndCircle[1].OnInteract(); } if (!AbleToHillBall) { while (!Pressable) { yield return(true); } BallColors[BallValue].GetComponent <KMSelectable>().OnInteract(); yield return(new WaitForSecondsRealtime(0.1f)); } BallHold.GetComponent <KMSelectable>().OnInteract(); while (HoldValue != PowerNeeded + 1) { yield return(null); } BallHold.GetComponent <KMSelectable>().OnInteractEnded(); } while (Checking) { yield return(true); } }
void BallPress(int Press) { BallColors[Press].GetComponent <KMSelectable>().AddInteractionPunch(0.2f); if (Pressable) { Debug.LogFormat("[Hole in One #{0}] You used Golf Ball #{1}", moduleId, (Press + 1).ToString()); Audio.PlaySoundAtTransform(SFX[4].name, transform); if (Press != BallValue) { IncorrectAnswer = true; } BallHold.GetComponent <MeshRenderer>().material.color = BallColors[Press].GetComponent <MeshRenderer>().material.color; Everything1.SetActive(false); Everything2.SetActive(true); if (Bomb.GetSerialNumberNumbers().Last() % 2 == 0) { Debug.LogFormat("[Hole in One #{0}] The last digit of the serial is even. You must perform the Caesar shift forwards.", moduleId); Debug.LogFormat("[Hole in One #{0}] The focused letter is {1}", moduleId, numberTable[BallValue, StoredValue % 5]); PowerNeeded = (Array.IndexOf(Alphabreak, numberTable[BallValue, StoredValue % 5]) + StoredValue) % 26; Debug.LogFormat("[Hole in One #{0}] After performing the Caesar shift, the current letter must be the letter \"{1}\"", moduleId, Alphabreak[PowerNeeded]); PowerNeeded = 25 - PowerNeeded; Debug.LogFormat("[Hole in One #{0}] After performing the Atbash cipher, the correct letter must be \"{1}\"", moduleId, Alphabreak[PowerNeeded]); Debug.LogFormat("[Hole in One #{0}] You must hit the ball when the power level is {1}", moduleId, (PowerNeeded + 1).ToString()); } else { Debug.LogFormat("[Hole in One #{0}] The last digit of the serial is odd. You must perform the Caesar shift backwards.", moduleId); Debug.LogFormat("[Hole in One #{0}] The focused letter is {1}", moduleId, numberTable[BallValue, StoredValue % 5]); PowerNeeded = Array.IndexOf(Alphabreak, numberTable[BallValue, StoredValue % 5]) - StoredValue; while (PowerNeeded < 0) { PowerNeeded += 26; } Debug.LogFormat("[Hole in One #{0}] After performing the Caesar shift, the current letter must be the letter \"{1}\"", moduleId, Alphabreak[PowerNeeded]); PowerNeeded = 25 - PowerNeeded; Debug.LogFormat("[Hole in One #{0}] After performing the Atbash cipher, the correct letter must be \"{1}\"", moduleId, Alphabreak[PowerNeeded]); Debug.LogFormat("[Hole in One #{0}] You must hit the ball when the power level is {1}", moduleId, (PowerNeeded + 1).ToString()); } Pressable = false; AbleToHillBall = true; } }
void Start() { Log = "Golf ball colors: "; StickNum = UnityEngine.Random.Range(0, 5); Sticks.Shuffle(); for (int x = 0; x < Sticks.Length; x++) { if (x != StickNum) { Sticks[x].SetActive(false); } else { Sticks[x].SetActive(true); } switch (UnityEngine.Random.Range(0, 8)) { case 0: BallColors[x].GetComponent <MeshRenderer>().material.color = new Color(1f, 0f, 0f); Log += x != Sticks.Length - 1 ? "Red" + ", " : "Red"; break; case 1: BallColors[x].GetComponent <MeshRenderer>().material.color = new Color(0f, 1f, 0f); Log += x != Sticks.Length - 1 ? "Green" + ", " : "Green"; break; case 2: BallColors[x].GetComponent <MeshRenderer>().material.color = new Color(0f, 0f, 1f); Log += x != Sticks.Length - 1 ? "Blue" + ", " : "Blue"; break; case 3: BallColors[x].GetComponent <MeshRenderer>().material.color = new Color(1f, 1f, 0f); Log += x != Sticks.Length - 1 ? "Yellow" + ", " : "Yellow"; break; case 4: BallColors[x].GetComponent <MeshRenderer>().material.color = new Color(1f, 0f, 1f); Log += x != Sticks.Length - 1 ? "Magenta" + ", " : "Magenta"; break; case 5: BallColors[x].GetComponent <MeshRenderer>().material.color = new Color(0f, 1f, 1f); Log += x != Sticks.Length - 1 ? "Cyan" + ", " : "Cyan"; break; case 6: BallColors[x].GetComponent <MeshRenderer>().material.color = new Color(1f, 1f, 1f); Log += x != Sticks.Length - 1 ? "White" + ", " : "White"; break; case 7: BallColors[x].GetComponent <MeshRenderer>().material.color = new Color(0f, 0f, 0f); Log += x != Sticks.Length - 1 ? "Black" + ", " : "Black"; break; default: break; } BallColors[x].SetActive(false); } Everything2.SetActive(false); Everything1.SetActive(false); Module.OnActivate += Proceed; }