private IEnumerator TribeDance() { yield return(0); rumbleAudioSource.Play(); foreach (GameObject explorer in explorers) { explorer.GetComponent <ExplorerBehavior>().PlayAnimation("Idle"); } foreach (GameObject tribeMember in tribalMembers) { tribeMember.GetComponent <ExplorerBehavior>().PlayAnimation(pillarChosen.Tribal.Dance.AnimationName); } #if UNITY_EDITOR float total = Music.GetTrackLength(MusicFiles.TRIBAL); for (float elapsed = 0.0f; elapsed < total; elapsed += Time.deltaTime) { progress = 0; progressElapsed = elapsed; progressTotal = total; yield return(0); } #else yield return(new WaitForSeconds(Music.GetTrackLength(MusicFiles.TRIBAL))); #endif ChangeState(GameStates.PLAYERDANCE); }
// TODO(anyone): implement private IEnumerator KillExplorer() { float timeLeft = Music.GetTrackLength(MusicFiles.LOSE); // Play laser sound laserAudioSource.Play(); // Glow for (beamChargeTimer = 0.0f; beamChargeTimer < beamChargeLength; beamChargeTimer += Time.deltaTime) { timeLeft -= Time.deltaTime; // TODO(bret): Beam charge yield return(0); } // Shoot var explorer = explorers[explorers.Count - 1]; explorers.Remove(explorer); explorer.GetComponent <ExplorerBehavior>().Die(); new MessageScreenshake() { Amount = 8.0f }.Send(); laserLineRenderer.SetPosition(1, explorer.transform.position); laserLineRenderer.enabled = true; for (float t = 0.0f; t < beamShootLength; t += Time.deltaTime) { timeLeft -= Time.deltaTime; yield return(0); } laserLineRenderer.enabled = false; yield return(0); // Wait for (; timeLeft > 0; timeLeft -= Time.deltaTime) { yield return(0); } yield return(0); }
// TODO(anyone): implement private IEnumerator AddToScore() { foreach (GameObject tribeMember in tribalMembers) { tribeMember.GetComponent <ExplorerBehavior>().PlayAnimation(pillarChosen.Tribal.Dance.AnimationName); } // Remove the explorer from the List and give them GOLD! var explorer = explorers[explorers.Count - 1]; explorers.Remove(explorer); Instantiate(GoldPile, explorer.transform.position, Quaternion.identity); coinsAudioSource.Play(); yield return(new WaitForSeconds(Music.GetTrackLength(MusicFiles.WIN))); yield return(0); }
private IEnumerator PlayerDance() { // Reset the timer inputTimer = Music.GetTrackLength(MusicFiles.EXPLORER); foreach (GameObject tribeMember in tribalMembers) { tribeMember.GetComponent <ExplorerBehavior>().PlayAnimation("Idle"); } while (true) { // Process input AddInputToQueue(); // Count down time inputTimer -= Time.deltaTime; #if UNITY_EDITOR progress = 1; progressTotal = Music.GetTrackLength(MusicFiles.EXPLORER); progressElapsed = progressTotal - inputTimer; #endif // "Check input" to highlight the things for (int i = 0; i < pillars.Count; ++i) { pillars[i].CheckInput(inputQueue); } // Check to see if time is up, the correct input has been given, or if the input is the full length if ((inputTimer <= 0.0f) || (pillarChosen.CheckInput(inputQueue)) || (inputQueue.Count >= inputLength)) { break; } else { yield return(0); } } while (true) { // Once time has run out, change the state! if (inputTimer <= 0.0f) { ChangeState(GameStates.ENDROUND); break; } yield return(0); // Count down time inputTimer -= Time.deltaTime; #if UNITY_EDITOR progress = 1; progressTotal = Music.GetTrackLength(MusicFiles.EXPLORER); progressElapsed = progressTotal - inputTimer; #endif } }