// Update is called once per frame void Update() { switch (currentGamePhase) { case GamePhases.PlayPhase: case GamePhases.TutorialPlayPhase: if (Input.anyKeyDown) { BeatScroller theBS = GameObject.FindObjectOfType <BeatScroller>(); if (theBS != null) { if (theBS.hasStarted == false) { theBS.hasStarted = true; GameObject musicObject = GameObject.FindGameObjectWithTag("MusicAudioSource"); AudioSource theMusic = musicObject.GetComponent <AudioSource>(); if (theMusic != null) { theMusic.Play(); } } } } break; case GamePhases.StartPhase: break; case GamePhases.LevelSelect: break; case GamePhases.ResultsPhase: break; } }
private void SpawnNote(int type) { if (type >= minBlue && type <= maxBlue) { GameObject g1 = Instantiate(notePrefabs[0], this.transform); BeatScroller bs = g1.AddComponent <BeatScroller>(); bs.beatTempo = 125; } else if (type >= minRed && type <= maxRed) { GameObject g1 = Instantiate(notePrefabs[1], this.transform); g1.AddComponent <BeatScroller>().beatTempo = 125; } else if (type >= minYellow && type <= maxYellow) { GameObject g1 = Instantiate(notePrefabs[2], this.transform); g1.AddComponent <BeatScroller>().beatTempo = 125; } else if (type >= minGreen && type <= maxGreen) { GameObject g1 = Instantiate(notePrefabs[3], this.transform); g1.AddComponent <BeatScroller>().beatTempo = 125; } }
// Update is called once per frame void Update() { switch (currentGamePhase) { case GamePhases.PlayPhase: case GamePhases.TutorialPlayPhase: BeatScroller theBS = GameObject.FindObjectOfType <BeatScroller>(); if (Input.anyKeyDown) { if (theBS != null) { if (theBS.hasStarted == false) { theBS.hasStarted = true; GameObject musicObject = GameObject.FindGameObjectWithTag("MusicAudioSource"); if (musicObject) { AudioSource musicAudioSource = musicObject.GetComponent <AudioSource>(); if (musicAudioSource != null) { if (selectedSong) { musicAudioSource.clip = selectedSong.musicClip; } musicAudioSource.Play(); } } } else { } } } if (theBS.hasStarted) { float progress = 0f; GameObject musicObject = GameObject.FindGameObjectWithTag("MusicAudioSource"); AudioSource musicAudioSource = musicObject.GetComponent <AudioSource>(); if (musicAudioSource) { progress = musicAudioSource.time / musicAudioSource.clip.length; currentProgress = Mathf.Clamp(progress, 0f, 1f); } } break; case GamePhases.StartPhase: break; case GamePhases.LevelSelect: break; case GamePhases.ResultsPhase: break; } }
//On Awake, set beatTempo to notes por second and instance itself. void Awake() { instance = this; beatTempo = beatTempo / 60f; if (instance.name.Equals("NoteHolder2")) { readNotes(); } }
void Update() { score.text = "Points " + scoreValue; if (scoreValue >= 350000) { fasterPitch.pitch += 0.35f; fasterPitch.pitch = Mathf.Clamp(fasterPitch.pitch, 1f, 1.35f); BeatScroller beatScroller = fasterArrow.GetComponent <BeatScroller>(); beatScroller.beatsPerLoop -= 1f; beatScroller.beatsPerLoop = Mathf.Clamp(beatScroller.beatsPerLoop, 2.8f, 3.8f); } }
IEnumerator PlaySong(BeatScroller scroller) { playing = true; audioSource.Stop(); dialogueText.SetActive(false); scroller.hasStarted = true; yield return(new WaitForSeconds(0.97f)); shake.StartFadeIn(0); audioSource.clip = song; audioSource.Play(); audioSource.loop = false; yield return(new WaitForSeconds(song.length)); finishedSong = true; }
public void SetPause(bool nextPause) { if (nextPause == true) { Time.timeScale = 0f; if (currentGamePhase == GamePhases.PlayPhase) { BeatScroller theBS = GameObject.FindObjectOfType <BeatScroller>(); if (theBS != null) { if (theBS.hasStarted) { GameObject musicObject = GameObject.FindGameObjectWithTag("MusicAudioSource"); if (musicObject != null) { musicObject.GetComponent <AudioSource>().Pause(); } } } } } else { Time.timeScale = 1f; if (currentGamePhase == GamePhases.PlayPhase) { BeatScroller theBS = GameObject.FindObjectOfType <BeatScroller>(); if (theBS != null) { if (theBS.hasStarted) { GameObject musicObject = GameObject.FindGameObjectWithTag("MusicAudioSource"); if (musicObject != null) { musicObject.GetComponent <AudioSource>().UnPause(); } } } } } }
// Start is called before the first frame update void Start() { instance = this; beatTempo /= 60f; }
void Awake() { instance = this; }
void Start() { beatTempo = Metronome.BPM / 60f; bs = this; posInitiale = bs.transform; }
void Start() { beatScrollInstance = this; songTempo = songTempo / 60f; }
public static void lancerMetronome(Metronome m, BeatScroller tab) { m.StartCoroutine(m.Ticker()); tab.hasStarted = true; }