/// <summary>
        /// Spawn a Target Object
        /// </summary>
        /// <param name="noteData">The note data to use</param>
        public void SpawnTarget(BlockSong.Note noteData)
        {
            noteData.xPos = noteData.xPos / 2;
            noteData.yPos = noteData.yPos / 2;
            GameObject cube = Instantiate(targetObject, new Vector3(noteData.xPos, noteData.yPos, core.spawnDistance), new Quaternion(0, 0, noteData.cutDirection, 0));

            cube.GetComponent <BlockSongTargetObject>().InitNote(noteData);
        }
Example #2
0
            public BlockSong.Note ToNote()
            {
                var note = new BlockSong.Note();

                note.time         = _time;
                note.xPos         = _lineIndex / 1000f;
                note.yPos         = _lineLayer / 1000f;
                note.target       = new[] { _type == 0 ? TrackingPoint.LeftHand : TrackingPoint.RightHand };
                note.cutDirection = _cutDirection * 45;
                return(note);
            }
        /// <summary>
        /// Play Notes coroutine, plays all notes timed properly
        /// </summary>
        /// <param name="bm">The beatmap to take the notes from</param>
        /// <param name="startOffset">time in seconds to offset the note playing</param>
        /// <returns></returns>
        protected IEnumerator PlayNotes(Beatmap bm, float startOffset)
        {
            //var beatmapLength = bm.notes[bm.notes.Length-1].time;
            float currentTime = startOffset;

            for (var i = 0; i < bm.notes.Length; i++)
            {
                BlockSong.Note note = bm.notes[i];
                Debug.Log("Wait time: " + (note.time - currentTime));
                yield return(new WaitForSeconds((note.time - currentTime)));

                currentTime = note.time;
                Debug.Log("Current Time: " + currentTime);
                SpawnTarget(note);
            }

            Debug.Log("Finished placing target objects");
            core.StopBeatmap(1);
        }