private void PopFirstBeat() { // Creates a new beatdata list 1 shorter Beatdata[] newShortList = new Beatdata[m_bdBeatdata.Length - 1]; for (int i = 0; i < newShortList.Length; i++) { newShortList[i] = m_bdBeatdata[i + 1]; } m_bdBeatdata = newShortList; }
public void ReadFromFile(string pLocation) { // Finds the filepath of the unityproject string path = Application.dataPath; //Debug.Log(path); //Debug.Log(path + "/Beatmaps/" + pLocation); // Transfers the contents of a text file into a string array // Each line is the data for a single beat with position and delay info string[] lines = File.ReadAllLines(path + "/Beatmaps/" + pLocation, System.Text.Encoding.UTF8); // Updates the beatlist to the length of the data imported m_bdBeatdata = new Beatdata[lines.Length]; for (int i = 0; i < lines.Length; i++) { //Debug.Log(lines[i]); // Validates that the data is there if (lines == null) { continue; } Beatdata newBeat = new Beatdata(); string[] data = lines[i].Split(','); //Debug.Log(data[0] + " - " + data[1]); // Applies the seperated data to the beat and adds it to the array newBeat.m_usLane = (ushort)int.Parse(data[0]); newBeat.m_uiDelay = (uint)int.Parse(data[1]); m_bdBeatdata[i] = newBeat; } m_uiDelayUntilNextBeat = m_bdBeatdata[0].m_uiDelay; }