Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.31 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using UnityEngine;
  6. using KModkit;
  7. using TheBlock;
  8.  
  9.  
  10. public class theBlockScript : MonoBehaviour
  11. {
  12. public KMBombInfo Bomb;
  13. public KMAudio Audio;
  14. public KMBombModule module;
  15. public KMSelectable[] buttons;
  16. public Renderer[] discoButtons;
  17. public Material[] discoButtonMats;
  18. public Renderer[] cubeFaces;
  19. public Material[] cubeFacesMats;
  20. public Material ambientLight;
  21. public Light[] AllLights;
  22. public int Rule;
  23. public Answers correctAnswer;
  24. public int counter;
  25.  
  26. FaceColour[] cubeFaceColours; // array to store the colours of the faces
  27. int correctButton;
  28.  
  29. //Logging
  30. static int moduleIdCounter = 1;
  31. int moduleId;
  32. private bool moduleSolved;
  33.  
  34. void Awake()
  35. {
  36. moduleId = moduleIdCounter++;
  37. float scalar = transform.lossyScale.x;
  38.  
  39. foreach (KMSelectable button in buttons)
  40. {
  41. KMSelectable pressedButton = button;
  42. button.OnInteract += delegate () { ButtonPress(pressedButton); return false; };
  43. }
  44.  
  45. foreach (Light light in AllLights)
  46. {
  47. light.range *= scalar;
  48. }
  49. }
  50.  
  51. void Start()
  52. {
  53. SetDiscoLights();
  54. SetCubeFaces();
  55. DetermineAnswer();
  56. }
  57.  
  58. void SetCubeFaces()
  59. {
  60. {
  61. // Each face gets a random color
  62. cubeFaceColours = Enumerable.Range(0, 6).Select(i => (FaceColour)UnityEngine.Random.Range(0, 4)).ToArray();
  63.  
  64. // Assign the materials
  65. for (var i = 0; i < cubeFaces.Length; i++)
  66. cubeFaces[i].material = cubeFacesMats[(int)cubeFaceColours[i]];
  67. }
  68. Debug.LogFormat("[The Block #{0}] Face 1 Colour: " + cubeFaceColours[0], moduleId);
  69. Debug.LogFormat("[The Block #{0}] Face 2 Colour: " + cubeFaceColours[1], moduleId);
  70. Debug.LogFormat("[The Block #{0}] Face 3 Colour: " + cubeFaceColours[2], moduleId);
  71. Debug.LogFormat("[The Block #{0}] Face 4 Colour: " + cubeFaceColours[3], moduleId);
  72. Debug.LogFormat("[The Block #{0}] Face 5 Colour: " + cubeFaceColours[4], moduleId);
  73. Debug.LogFormat("[The Block #{0}] Face 6 Colour: " + cubeFaceColours[5], moduleId);
  74. }
  75.  
  76. public void ButtonPress(KMSelectable button)
  77. {
  78. button.AddInteractionPunch(0.2f);
  79. Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonPress, transform);
  80.  
  81. if (moduleSolved == true)
  82. {
  83. return;
  84. }
  85.  
  86. else
  87. {
  88. switch (correctAnswer)
  89. {
  90. case Answers.Unicorn: //Rule 1
  91. if (button == buttons[6] && counter == 0)
  92. {
  93. counter = 1;
  94. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId);
  95. }
  96. else if (button == buttons[6] && counter == 1)
  97. {
  98. counter = 2;
  99. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId);
  100. }
  101. else if (button == buttons[6] && counter == 2)
  102. {
  103. counter = 3;
  104. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId);
  105. }
  106. else if (button == buttons[6] && counter == 3)
  107. {
  108. counter = 4;
  109. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId);
  110. }
  111. else if (button == buttons[6] && counter == 4)
  112. {
  113. module.HandlePass();
  114. Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
  115. moduleSolved = true;
  116. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + " : Module Disarmed.");
  117. }
  118. else
  119. {
  120. module.HandleStrike();
  121. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": This was Incorrect - Strike Incurred.");
  122. }
  123. break;
  124.  
  125. case Answers.FirstGreen: //Rule 2
  126. for (int i = 0; i < 6; i++)
  127. {
  128. if (cubeFaceColours[i] == FaceColour.Green)
  129. {
  130. correctButton = i;
  131. break;
  132. }
  133. }
  134. if (button == buttons[correctButton])
  135. {
  136. module.HandlePass();
  137. moduleSolved = true;
  138. Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
  139. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": Module Disarmed.");
  140. }
  141. else
  142. {
  143. module.HandleStrike();
  144. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": This was Incorrect - Strike Incurred.");
  145. }
  146.  
  147. break;
  148.  
  149. case Answers.AllReverse: //Rule 3
  150. if (button == buttons[counter])
  151. {
  152. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId);
  153. if (counter == 0)
  154. {
  155. module.HandlePass();
  156. moduleSolved = true;
  157. Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
  158. Debug.LogFormat("[The Block #{0}] The last button - " + button.gameObject.name, moduleId + " was correct. Module Disarmed.");
  159. }
  160. else
  161. {
  162. counter--;
  163. }
  164. }
  165. else
  166. {
  167. module.HandleStrike();
  168. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": This was Incorrect - Strike Incurred.");
  169. }
  170. break;
  171.  
  172. case Answers.Side5: //Rule 4
  173. if (button == buttons[4])
  174. {
  175. module.HandlePass();
  176. moduleSolved = true;
  177. Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
  178. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": Module Disarmed.");
  179. }
  180. else
  181. {
  182. module.HandleStrike();
  183. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": This was Incorrect - Strike Incurred.");
  184. }
  185. break;
  186.  
  187. case Answers.Side2Side4: //Rule 5
  188. if (button == buttons[1] && counter == 0)
  189. {
  190. counter = 1;
  191. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId);
  192. }
  193. else if (button == buttons[3] && counter == 1)
  194. {
  195. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + " : Module Disarmed.");
  196. moduleSolved = true;
  197. module.HandlePass();
  198. Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
  199. }
  200. else
  201. {
  202. module.HandleStrike();
  203. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": This was Incorrect - Strike Incurred.");
  204. }
  205. break;
  206.  
  207. case Answers.AllNumerical: //Rule 6
  208. if (button == buttons[counter])
  209. {
  210. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId);
  211. if (counter == 5)
  212. {
  213. module.HandlePass();
  214. Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
  215. moduleSolved = true;
  216. Debug.LogFormat("[The Block #{0}] The last button - " + button.gameObject.name, moduleId + " was correct. Module Disarmed.");
  217. }
  218. else
  219. {
  220. counter++;
  221. }
  222. }
  223. else
  224. {
  225. module.HandleStrike();
  226. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": This was Incorrect - Strike Incurred.");
  227. }
  228. break;
  229.  
  230. case Answers.BlockRule7: //Rule 7
  231. if (button == buttons[6])
  232. {
  233. module.HandlePass();
  234. Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
  235. moduleSolved = true;
  236. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": Module Disarmed.");
  237. }
  238. else
  239. {
  240. module.HandleStrike();
  241. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": This was Incorrect - Strike Incurred.");
  242. }
  243. break;
  244.  
  245. case Answers.LastBlue: //Rule 8
  246. for (int i = 5; i > -1; i--)
  247. {
  248. if (cubeFaceColours[i] == FaceColour.Blue)
  249. {
  250. correctButton = i;
  251. break;
  252. }
  253. }
  254. if (button == buttons[correctButton])
  255. {
  256. module.HandlePass();
  257. Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
  258. moduleSolved = true;
  259. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": Module Disarmed.");
  260. }
  261. else
  262. {
  263. module.HandleStrike();
  264. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": This was Incorrect - Strike Incurred.");
  265. }
  266.  
  267. break;
  268.  
  269. case Answers.EvenNumerical: //Rule 9
  270. if (button == buttons[1] && counter == 0)
  271. {
  272. counter = 1;
  273. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId);
  274. }
  275. else if (button == buttons[3] && counter == 1)
  276. {
  277. counter = 2;
  278. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId);
  279. }
  280. else if (button == buttons[5] && counter == 2)
  281. {
  282. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + " : Module Disarmed.");
  283. moduleSolved = true;
  284. module.HandlePass();
  285. Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
  286. }
  287. else
  288. {
  289. module.HandleStrike();
  290. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": This was Incorrect - Strike Incurred.");
  291. }
  292. break;
  293.  
  294. case Answers.OddReverse: //Rule 10
  295. if (button == buttons[4] && counter == 0)
  296. {
  297. counter = 1;
  298. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId);
  299. }
  300. else if (button == buttons[2] && counter == 1)
  301. {
  302. counter = 2;
  303. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId);
  304. }
  305. else if (button == buttons[0] && counter == 2)
  306. {
  307. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + " : Module Disarmed.");
  308. moduleSolved = true;
  309. module.HandlePass();
  310. Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
  311. }
  312. else
  313. {
  314. module.HandleStrike();
  315. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": This was Incorrect - Strike Incurred.");
  316. }
  317. break;
  318.  
  319. case Answers.FirstBlue: //Rule 11
  320. for (int i = 0; i < 6; i++)
  321. {
  322. if (cubeFaceColours[i] == FaceColour.Blue)
  323. {
  324. correctButton = i;
  325. break;
  326. }
  327. }
  328. if (button == buttons[correctButton])
  329. {
  330. module.HandlePass();
  331. Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
  332. moduleSolved = true;
  333. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": Module Disarmed.");
  334. }
  335. else
  336. {
  337. module.HandleStrike();
  338. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": This was Incorrect - Strike Incurred.");
  339. }
  340.  
  341. break;
  342.  
  343. case Answers.BlockRule12: //Rule 12
  344. if (button == buttons[6])
  345. {
  346. module.HandlePass();
  347. Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
  348. moduleSolved = true;
  349. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": Module Disarmed.");
  350. }
  351. else
  352. {
  353. module.HandleStrike();
  354. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": This was Incorrect - Strike Incurred.");
  355. }
  356. break;
  357.  
  358. case Answers.Side1Side4: //Rule 13
  359. if (button == buttons[0] && counter == 0)
  360. {
  361. counter = 1;
  362. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId);
  363. }
  364. else if (button == buttons[3] && counter == 1)
  365. {
  366. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + " : Module Disarmed.");
  367. moduleSolved = true;
  368. module.HandlePass();
  369. Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
  370. }
  371. else
  372. {
  373. module.HandleStrike();
  374. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": This was Incorrect - Strike Incurred.");
  375. }
  376. break;
  377.  
  378. case Answers.Side4Rule14: //Rule 14
  379. if (button == buttons[3])
  380. {
  381. module.HandlePass();
  382. Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);
  383. moduleSolved = true;
  384. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": Module Disarmed.");
  385. }
  386. else
  387. {
  388. module.HandleStrike();
  389. Debug.LogFormat("[The Block #{0}] The Button you Pressed was: " + button.gameObject.name, moduleId + ": This was Incorrect - Strike Incurred.");
  390. }
  391. break;
  392. }
  393. }
  394. }
  395.  
  396. public void DetermineAnswer()
  397. {
  398. var numRed = cubeFaceColours.Count(color => color == FaceColour.Red);
  399. var numBlue = cubeFaceColours.Count(color => color == FaceColour.Blue);
  400. var numGreen = cubeFaceColours.Count(color => color == FaceColour.Green);
  401. var numYellow = cubeFaceColours.Count(color => color == FaceColour.Yellow);
  402.  
  403. //UNICORN - lit BOB, 3 batteries in 2 holders and an empty port plate - Press the Block 5 times
  404. if (Bomb.GetBatteryCount() == 3 && Bomb.GetBatteryHolderCount() == 2 && Bomb.GetPortPlates().Any(x => x.Length == 0) && Bomb.IsIndicatorOn(Indicator.BOB))
  405. {
  406. Debug.LogFormat("[The Block #{0}] Rule 1 Selected", moduleId);
  407. Rule = 1;
  408. correctAnswer = Answers.Unicorn;
  409. }
  410.  
  411. //If there is a Parallel and a Serial Port present, and Side 4 is Green - Press the first green side in the NET.
  412. else if (Bomb.GetPortCount(Port.Parallel) > 0 && Bomb.GetPortCount(Port.Serial) > 0 && (cubeFaceColours[3] == FaceColour.Green))
  413. {
  414. Debug.LogFormat("[The Block #{0}] Rule 2 Selected", moduleId);
  415. Rule = 2;
  416. correctAnswer = Answers.FirstGreen;
  417. }
  418.  
  419. //If the serial number contains a Vowel, and there is an unlit SIG indicator - Press all sides in reverse numerical order.
  420. else if (Bomb.GetSerialNumberLetters().Any(x => x == 'A' || x == 'E' || x == 'I' || x == 'O' || x == 'U') && Bomb.IsIndicatorOff(Indicator.SIG))
  421. {
  422. Debug.LogFormat("[The Block #{0}] Rule 3 Selected", moduleId);
  423. Rule = 3;
  424. correctAnswer = Answers.AllReverse;
  425. counter = 5;
  426. }
  427.  
  428. //If there are 3+ Batteries, and Side 1 is Red - Press Side 5.
  429. else if (Bomb.GetBatteryCount() > 2 && (cubeFaceColours[0] == FaceColour.Red))
  430. {
  431. Debug.LogFormat("[The Block #{0}] Rule 4 Selected", moduleId);
  432. Rule = 4;
  433. correctAnswer = Answers.Side5;
  434. }
  435.  
  436. //If there are more Blue sides than Red sides, and more Yellow sides than Green sides - Press Side 2, then Side 4.
  437. else if (numBlue > numRed && numYellow > numGreen)
  438. {
  439. Debug.LogFormat("[The Block #{0}] Rule 5 Selected", moduleId);
  440. Rule = 5;
  441. correctAnswer = Answers.Side2Side4;
  442. }
  443.  
  444. //If there are no Yellow sides - press all sides in numerical order
  445. else if (cubeFaceColours[0] != FaceColour.Yellow && cubeFaceColours[1] != FaceColour.Yellow && cubeFaceColours[2] != FaceColour.Yellow && cubeFaceColours[3] != FaceColour.Yellow && cubeFaceColours[4] != FaceColour.Yellow && cubeFaceColours[5] != FaceColour.Yellow)
  446. {
  447. Debug.LogFormat("[The Block #{0}] Rule 6 Selected", moduleId);
  448. Rule = 6;
  449. correctAnswer = Answers.AllNumerical;
  450. }
  451.  
  452. //If Side 2 is Yellow, and Side 3 is Blue - press on the Block.
  453. else if (cubeFaceColours[1] == FaceColour.Yellow && cubeFaceColours[2] == FaceColour.Blue)
  454. {
  455. Debug.LogFormat("[The Block #{0}] Rule 7 Selected", moduleId);
  456. Rule = 7;
  457. correctAnswer = Answers.BlockRule7;
  458. }
  459.  
  460. //If there are no lit indicators, and Side 2 and Side 4 are Blue - Press on the last blue side in the NET.
  461. else if (cubeFaceColours[1] == FaceColour.Blue && cubeFaceColours[3] == FaceColour.Blue && Bomb.GetOnIndicators().Count() == 0)
  462. {
  463. Debug.LogFormat("[The Block #{0}] Rule 8 Selected", moduleId);
  464. Rule = 8;
  465. correctAnswer = Answers.LastBlue;
  466. }
  467.  
  468. //If there are 2 port plates, and one is empty - Press all even sides, in numerical order
  469. else if (Bomb.GetPortPlateCount() == 2 && Bomb.GetPortPlates().Any(x => x.Length == 0))
  470. {
  471. Debug.LogFormat("[The Block #{0}] Rule 9 Selected", moduleId);
  472. Rule = 9;
  473. correctAnswer = Answers.EvenNumerical;
  474. }
  475.  
  476. //If Side 5 is Blue, and Side 1 is Green - Press all odd sides, in reverse numerical order
  477. else if (cubeFaceColours[4] == FaceColour.Blue && cubeFaceColours[0] == FaceColour.Green)
  478. {
  479. Debug.LogFormat("[The Block #{0}] Rule 10 Selected", moduleId);
  480. Rule = 10;
  481. correctAnswer = Answers.OddReverse;
  482. }
  483.  
  484. //If there are no batteries, and Side 3 is Blue - Press on the first blue side in the NET.
  485. else if (cubeFaceColours[2] == FaceColour.Blue && Bomb.GetBatteryCount() == 0)
  486. {
  487. Debug.LogFormat("[The Block #{0}] Rule 11 Selected", moduleId);
  488. Rule = 11;
  489. correctAnswer = Answers.FirstBlue;
  490. }
  491.  
  492. // If there is at least 1 DVI-D Port, and exactly 1 Battery - Press on the Block
  493. else if (Bomb.GetPortCount(Port.DVI) > 0 && Bomb.GetBatteryCount() == 1)
  494. {
  495. Debug.LogFormat("[The Block #{0}] Rule 12 Selected", moduleId);
  496. Rule = 12;
  497. correctAnswer = Answers.BlockRule12;
  498. }
  499.  
  500. //If there are more Red sides than Blue sides - Press Side 1, then Side 4.
  501. else if (numRed > numBlue)
  502. {
  503. Debug.LogFormat("[The Block #{0}] Rule 13 Selected", moduleId);
  504. Rule = 13;
  505. correctAnswer = Answers.Side1Side4;
  506. }
  507.  
  508. //Otherwise Press Side 4
  509. else
  510. {
  511. Debug.LogFormat("[The Block #{0}] Rule 14 Selected", moduleId);
  512. Rule = 14;
  513. correctAnswer = Answers.Side4Rule14;
  514. }
  515. }
  516.  
  517. void SetDiscoLights()
  518. {
  519. for (int i = 0; i < 6; i++)
  520. {
  521. int index = UnityEngine.Random.Range(0, 11);
  522. discoButtons[i].material = discoButtonMats[index];
  523. }
  524. StartCoroutine(disco1());
  525. StartCoroutine(disco2());
  526. StartCoroutine(disco3());
  527. StartCoroutine(disco4());
  528. StartCoroutine(disco5());
  529. StartCoroutine(disco6());
  530. }
  531. IEnumerator disco1()
  532. {
  533. while (!moduleSolved)
  534. {
  535. float delay = UnityEngine.Random.Range(0.2f, 1.8f);
  536. yield return new WaitForSeconds(delay);
  537. int index = UnityEngine.Random.Range(0, 11);
  538. discoButtons[0].material = discoButtonMats[index];
  539. }
  540. }
  541. IEnumerator disco2()
  542. {
  543. while (!moduleSolved)
  544. {
  545. float delay = UnityEngine.Random.Range(0.2f, 1.8f);
  546. yield return new WaitForSeconds(delay);
  547. int index = UnityEngine.Random.Range(0, 11);
  548. discoButtons[1].material = discoButtonMats[index];
  549. }
  550. }
  551. IEnumerator disco3()
  552. {
  553. while (!moduleSolved)
  554. {
  555. float delay = UnityEngine.Random.Range(0.2f, 1.8f);
  556. yield return new WaitForSeconds(delay);
  557. int index = UnityEngine.Random.Range(0, 11);
  558. discoButtons[2].material = discoButtonMats[index];
  559. }
  560. }
  561. IEnumerator disco4()
  562. {
  563. while (!moduleSolved)
  564. {
  565. float delay = UnityEngine.Random.Range(0.2f, 1.8f);
  566. yield return new WaitForSeconds(delay);
  567. int index = UnityEngine.Random.Range(0, 11);
  568. discoButtons[3].material = discoButtonMats[index];
  569. }
  570. }
  571. IEnumerator disco5()
  572. {
  573. while (!moduleSolved)
  574. {
  575. float delay = UnityEngine.Random.Range(0.2f, 1.8f);
  576. yield return new WaitForSeconds(delay);
  577. int index = UnityEngine.Random.Range(0, 11);
  578. discoButtons[4].material = discoButtonMats[index];
  579. }
  580. }
  581. IEnumerator disco6()
  582. {
  583. while (!moduleSolved)
  584. {
  585. float delay = UnityEngine.Random.Range(0.2f, 1.8f);
  586. yield return new WaitForSeconds(delay);
  587. int index = UnityEngine.Random.Range(0, 11);
  588. discoButtons[5].material = discoButtonMats[index];
  589. }
  590. }
  591. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement