Exemplo n.º 1
0
        /*
         * private GameObject CreateNote(int num)
         * {
         *  GameObject obj = Instantiate(notePrefab);
         *  obj.SetActive(false);
         *  noteList.Add(obj);
         *  return obj;
         * }*/

        public GameObject CreateNote(MusicDTO.Note n)
        {
            var obj = CreateNote();

            obj.GetComponent <NoteObject>().Init(n);
            return(obj);
        }
Exemplo n.º 2
0
 public static Note ToNoteObject(MusicDTO.Note musicNote)
 {
     return(new Note()
     {
         position = new NotePosition(musicNote.LPB, musicNote.num, musicNote.block),
         type = musicNote.type == 1 ? NoteTypes.Single : NoteTypes.Long,
         attributes = (NoteAttributes)musicNote.attributes,
         direction = (NoteDirection)musicNote.direction
     });
 }
Exemplo n.º 3
0
        public void Init(MusicDTO.Note n)
        {
            note = n;

            /*
             * num = n.num;
             * block = n.block;*/

            gameObject.name = Block() + "-" + Num();
        }
Exemplo n.º 4
0
        static MusicDTO.Note ToDTO(NoteObject noteObject)
        {
            var note = new MusicDTO.Note();

            note.num   = noteObject.note.position.num;
            note.block = noteObject.note.position.block;
            note.LPB   = noteObject.note.position.LPB;
            note.type  = noteObject.note.type == NoteTypes.Long ? 2 : 1;
            note.notes = new List <MusicDTO.Note>();
            return(note);
        }
Exemplo n.º 5
0
 public static Note ToNoteObject(MusicDTO.Note musicNote)
 {
     return(new Note(
                new NotePosition(musicNote.LPB, musicNote.num, musicNote.block),
                musicNote.type == 1 ? NoteTypes.Single : NoteTypes.Long));
 }
Exemplo n.º 6
0
 public static float NoteToSamples(MusicDTO.Note note, float frequency, int BPM)
 {
     return(Mathf.FloorToInt(note.num * (frequency * 60f / BPM / note.LPB)));
 }