void GameOver() { ClickLaser clickLaser = GetComponent <ClickLaser>(); gameOver = true; clickLaser.laserOn = false; }
IEnumerator SimonSays() { ClickLaser clickLaser = GetComponent <ClickLaser>(); clickLaser.laserOn = false; rg = new System.Random("hakunamatata".GetHashCode()); SetBleeps(); yield return(new WaitForSeconds(1f)); for (int i = 0; i < bleeps.Count; i++) { Bleep(bleeps[i]); yield return(new WaitForSeconds(0.6f)); } clickLaser.laserOn = true; yield return(null); }
void OnGameButtonClick(int index) { ClickLaser clickLaser = GetComponent <ClickLaser>(); if (!clickLaser.laserOn) { return; } Bleep(index); playerBleeps.Add(index); if (bleeps[playerBleeps.Count - 1] != index) { GameOver(); return; } if (bleeps.Count == playerBleeps.Count) { StartCoroutine(SimonSays()); } }