void Awake() { hitNo = 0; snareNo = 0; rollNo = 0; isAcceptNodeSet = false; nodeToBeHighlighted = false; acceptToBeHighlighted = false; currentSong = new DataTypes.Song(); currentLoop = new DataTypes.Loop(); currentLoop.LoopNumber = 1; currentSong.LoopList.Add(currentLoop); canvas = FindObjectOfType <Canvas>(); listofAvailableBeats = new List <float>(); populateLoAB(); listofUsedBeats = new List <float>(); listofLOAB = new Dictionary <int, List <float> >(); listofLOAB[1] = listofAvailableBeats; listofLOUB = new Dictionary <int, List <float> >(); listofLOUB[1] = listofUsedBeats; nodePositionsNodePos = new Dictionary <DataTypes.Node, Vector3>(); nodePositionsPosNode = new Dictionary <Vector3, DataTypes.Node>(); listOfNodeLocations = new List <Vector3>(); listOfInstantiatedNodes = new List <GameObject>(); listOfInstantiatedLines = new List <GameObject>(); }
//|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| // _CORE PROCESSES_ // START // Use this for initialization void Start() { Application.targetFrameRate = 60; //currentSong = Overseer.selectedSong; currentSong = TestSong.getTestSong(); Overseer.songScore = 0; Debug.Log(currentSong.SongName); Debug.Log(currentSong.LoopList[0].SongName); currentLoop = currentSong.LoopList[0]; loopRepetition = 1; timer = new TimingManager(currentLoop.BeatsPerMinute); graphics = GameObject.FindObjectOfType <GraphicsManager>(); levels = GameObject.FindObjectOfType <LevelManager>(); inputManager = GameObject.FindObjectOfType <InputManager>(); sounds = GameObject.FindObjectOfType <SoundManager>(); score = FindObjectOfType <ScoreController>(); beatNo = timer.currentBeat(); // Find the first edge. currentEdge = currentLoop.EdgeList[0]; currentNode = currentEdge.FromNode; endNode = currentLoop.NodeList[currentLoop.NodeList.Count - 1]; if (currentNode.StartNode) { startNode = currentNode; //Debug.Log("All loaded, we're good to go! - " + ((double)(Time.time - TimingManager.StartTime)).ToString()); //Debug.Log(currentNode.NodeName + " " + CurrentNode.NodeType.ToString()); } playerEdge = currentEdge; playerNode = currentNode; graphics.beginGraphicsProcess(); loaded = true; }
public void doImport() { DataTypes.Song importedSong = importSong(input); foreach (DataTypes.Loop loop in importedSong.LoopList) { loop.EdgeList = loop.findEdges(loop.NodeList); } importedSongs.Add(importedSong); }
// IMPORT SONG // This method takes in a string and parses it to form a new song. public DataTypes.Song importSong(string song) { // Break up the elements of the "song" string - we can't rely on newLines via // Unity's stupid multiline fields. string[] splitSong = song.Split(new char[]{';'}); DataTypes.Song newSong = new DataTypes.Song(); DataTypes.Loop newLoop = new DataTypes.Loop(); DataTypes.Node newNode = new DataTypes.Node(); foreach (string songInfo in splitSong){ if(songInfo.StartsWith("SONG NAME")){ newSong.SongName = songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<')+1)); } else if (songInfo.StartsWith("LOOP START")){ newLoop = new DataTypes.Loop(); } else if (songInfo.StartsWith("LOOP NUMBER")){ newLoop.LoopNumber = System.Int32.Parse(songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<')+1))); } else if (songInfo.StartsWith("LOOP REPETITIONS")){ newLoop.Repetitions = System.Int32.Parse(songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<')+1))); } else if (songInfo.StartsWith("LOOP BPM")){ newLoop.BeatsPerMinute = System.Int32.Parse(songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<')+1))); } else if (songInfo.StartsWith("NODE START")){ newNode = new DataTypes.Node(); } else if (songInfo.StartsWith("NODE NAME")){ newNode.NodeName = songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<')+1)); } else if (songInfo.StartsWith("NODE TYPE")){ newNode.NodeType = (DataTypes.NodeType)System.Enum.Parse(typeof(DataTypes.NodeType), songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<')+1))); } else if (songInfo.StartsWith("NODE LOOP NUMBER")){ newNode.LoopNumber = System.Int32.Parse(songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<')+1))); } else if (songInfo.StartsWith("NODE TIME POSITION")){ newNode.TimePosition.Add(float.Parse(songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<')+1)))); } else if (songInfo.StartsWith("NODE IS START")){ newNode.StartNode = bool.Parse(songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<')+1))); } else if (songInfo.StartsWith("NODE IS ACCEPT")){ newNode.AcceptNode = bool.Parse(songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<')+1))); } else if (songInfo.StartsWith("NODE END")){ newLoop.NodeList.Add(newNode); newNode = new DataTypes.Node(); } else if (songInfo.StartsWith("LOOP END")){ newSong.LoopList.Add(newLoop); newLoop = new DataTypes.Loop(); } } return newSong; }
//|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| // _CORE PROCESSES_ // START // Use this for initialization void Start() { Application.targetFrameRate = 60; //currentSong = Overseer.selectedSong; currentSong = TestSong.getTestSong(); Overseer.songScore = 0; Debug.Log (currentSong.SongName); Debug.Log(currentSong.LoopList[0].SongName); currentLoop = currentSong.LoopList[0]; loopRepetition = 1; timer = new TimingManager(currentLoop.BeatsPerMinute); graphics = GameObject.FindObjectOfType<GraphicsManager>(); levels = GameObject.FindObjectOfType<LevelManager>(); inputManager = GameObject.FindObjectOfType<InputManager>(); sounds = GameObject.FindObjectOfType<SoundManager>(); score = FindObjectOfType<ScoreController>(); beatNo = timer.currentBeat(); // Find the first edge. currentEdge = currentLoop.EdgeList[0]; currentNode = currentEdge.FromNode; endNode = currentLoop.NodeList[currentLoop.NodeList.Count - 1]; if (currentNode.StartNode){ startNode = currentNode; //Debug.Log("All loaded, we're good to go! - " + ((double)(Time.time - TimingManager.StartTime)).ToString()); //Debug.Log(currentNode.NodeName + " " + CurrentNode.NodeType.ToString()); } playerEdge = currentEdge; playerNode = currentNode; graphics.beginGraphicsProcess(); loaded = true; }
void Awake() { hitNo = 0; snareNo = 0; rollNo = 0; isAcceptNodeSet = false; nodeToBeHighlighted = false; acceptToBeHighlighted = false; currentSong = new DataTypes.Song(); currentLoop = new DataTypes.Loop(); currentLoop.LoopNumber = 1; currentSong.LoopList.Add(currentLoop); canvas = FindObjectOfType<Canvas>(); listofAvailableBeats = new List<float>(); populateLoAB(); listofUsedBeats = new List<float>(); listofLOAB = new Dictionary<int, List<float>>(); listofLOAB[1] = listofAvailableBeats ; listofLOUB = new Dictionary<int, List<float>>(); listofLOUB[1] = listofUsedBeats; nodePositionsNodePos = new Dictionary<DataTypes.Node, Vector3>(); nodePositionsPosNode = new Dictionary<Vector3, DataTypes.Node>(); listOfNodeLocations = new List<Vector3>(); listOfInstantiatedNodes = new List<GameObject>(); listOfInstantiatedLines = new List<GameObject>(); }
// IMPORT SONG // This method takes in a string and parses it to form a new song. public DataTypes.Song importSong(string song) { // Break up the elements of the "song" string - we can't rely on newLines via // Unity's stupid multiline fields. string[] splitSong = song.Split(new char[] { ';' }); DataTypes.Song newSong = new DataTypes.Song(); DataTypes.Loop newLoop = new DataTypes.Loop(); DataTypes.Node newNode = new DataTypes.Node(); foreach (string songInfo in splitSong) { if (songInfo.StartsWith("SONG NAME")) { newSong.SongName = songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<') + 1)); } else if (songInfo.StartsWith("LOOP START")) { newLoop = new DataTypes.Loop(); } else if (songInfo.StartsWith("LOOP NUMBER")) { newLoop.LoopNumber = System.Int32.Parse(songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<') + 1))); } else if (songInfo.StartsWith("LOOP REPETITIONS")) { newLoop.Repetitions = System.Int32.Parse(songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<') + 1))); } else if (songInfo.StartsWith("LOOP BPM")) { newLoop.BeatsPerMinute = System.Int32.Parse(songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<') + 1))); } else if (songInfo.StartsWith("NODE START")) { newNode = new DataTypes.Node(); } else if (songInfo.StartsWith("NODE NAME")) { newNode.NodeName = songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<') + 1)); } else if (songInfo.StartsWith("NODE TYPE")) { newNode.NodeType = (DataTypes.NodeType)System.Enum.Parse(typeof(DataTypes.NodeType), songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<') + 1))); } else if (songInfo.StartsWith("NODE LOOP NUMBER")) { newNode.LoopNumber = System.Int32.Parse(songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<') + 1))); } else if (songInfo.StartsWith("NODE TIME POSITION")) { newNode.TimePosition.Add(float.Parse(songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<') + 1)))); } else if (songInfo.StartsWith("NODE IS START")) { newNode.StartNode = bool.Parse(songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<') + 1))); } else if (songInfo.StartsWith("NODE IS ACCEPT")) { newNode.AcceptNode = bool.Parse(songInfo.Substring(songInfo.IndexOf('<') + 1, songInfo.IndexOf('>') - (songInfo.IndexOf('<') + 1))); } else if (songInfo.StartsWith("NODE END")) { newLoop.NodeList.Add(newNode); newNode = new DataTypes.Node(); } else if (songInfo.StartsWith("LOOP END")) { newSong.LoopList.Add(newLoop); newLoop = new DataTypes.Loop(); } } return(newSong); }