void Update() { if (m_isAnalyzing) { AudioKeynote currentNote = m_audioKeynotes[m_currentIndex]; if (m_currentSamplePoint + m_startingSamplePoint >= currentNote.m_keynoteIndex) { if (currentNote != null) { EventManager.Instance.PostImmediately(currentNote.m_audioEvent); } m_currentIndex++; if (m_currentIndex == m_audioKeynotes.Count) { if (PlayerManager.Instance.m_player1.GetComponent <LifeScript>().IsAlive()) { GameManager.Instance.YouWin(); } m_currentIndex = 0; m_currentSamplePoint = 0; } } m_currentSamplePoint += m_samplesPerSecond * Time.deltaTime; } else { m_currentIndex = 0; m_currentSamplePoint = 0; } }
void readTextFileLines() { string[] linesInFile = TextFile.text.Split('\n'); foreach (string line in linesInFile) { if (line.Contains("n=")) { //Debug.Log(line); string[] splitRead = line.Split(' '); int index = int.Parse(splitRead[0]); bool enabled = (splitRead[1] == "On"); int nodeIndex = int.Parse(splitRead[3].Replace("n=", "")); AudioKeynote note = new AudioKeynote(index, GetAudioEvent(nodeIndex, enabled), enabled); m_audioKeynotes.Add(note); } } }