// Start is called before the first frame update void Start() { try { song = findSong(); // Finds SongObject in scene BPM = song.GetBPM(); // Gets selected Song's BPM songLength = song.GetAudioLength(); // Gets the song's length in seconds secondsPerBeat = 60f / BPM; // Calculates Seconds per Beat noteSpawnPositions = new Vector3[] { noteOneSpawn, noteTwoSpawn, noteThreeSpawn }; startDelay = song.GetStartDelay(); difficultyMultiplier = song.GetDifficultyMultiplier(); Debug.Log("START A"); } catch (System.Exception e) { // Catch for when song doesn't load, spawn objects with no sound (testing purposes only) BPM = 60f; songLength = 60f; secondsPerBeat = 60f / BPM; // Calculates Seconds per Beat noteSpawnPositions = new Vector3[] { noteOneSpawn, noteTwoSpawn, noteThreeSpawn }; difficultyMultiplier = 4; Debug.Log("START B"); } plotPoints = new List <Transform>(); float localWidth = transform.Find("Point/BasePoint").localScale.x; // -n/2...0...n/2 for (int i = 0; i < displayWindowSize; i++) { //Instantiate point Transform t = (Instantiate(Resources.Load("Prefabs/Point"), transform) as GameObject).transform; // Set position float pointX = (displayWindowSize / 2) * -1 * localWidth + i * localWidth; t.localPosition = new Vector3(pointX, t.localPosition.y, t.localPosition.z); plotPoints.Add(t); } }
// Start is called before the first frame update void Start() { try { song = findSong(); BPM = song.GetBPM(); // Gets selected Song's BPM Debug.Log(BPM); songLength = song.GetAudioLength(); // Gets the song's length in seconds Debug.Log(songLength); secsPerBeat = 60f / BPM; // Calculates Seconds per Beat noteSpawnPositions = new Vector3[] { noteOneSpawn, noteTwoSpawn, noteThreeSpawn }; startDelay = song.GetStartDelay(); difficultyMultiplier = song.GetDifficultyMultiplier(); song.PlayAudio(); StartCoroutine(SpawnNote()); // Starts spawning Method } catch (Exception e) { // Catch for when song doesn't load, spawn objects with no sound (testing purposes only) BPM = 60f; songLength = 60f; secsPerBeat = 60f / BPM; // Calculates Seconds per Beat noteSpawnPositions = new Vector3[] { noteOneSpawn, noteTwoSpawn, noteThreeSpawn }; difficultyMultiplier = 4; StartCoroutine(SpawnNote()); // Starts spawning Method } }