// Update is called once per frame void Update() { //再生中なら if (m_oscSend.playing_music) { PlayTime = Mathf.Abs(-3.5f - m_scoreOrigin.transform.localPosition.y); for (int i = 0; i < KeyInfoList.Count; i++) //すべての指について { if (KeyInfoList[i].Count > 0) { if (index[i] + 1 < KeyInfoList[i].Count) { int check_index = AutoManager[i].LastOffNoteIndex[AutoManager[i].LastOffNoteIndex.Count - 1]; //check_index: 最後に終わるノートのインデックス if (PlayTime >= KeyInfoList[i][check_index].OffTime) //最後に終わるノートのNoteOffを過ぎていたら { if (index[i] + AutoManager[i].NofAutoNote < KeyInfoList[i].Count) { index[i] += AutoManager[i].NofAutoNote; KeyList[i] = new List <int>(); KeyList[i].Add(KeyInfoList[i][index[i]].key); CheckAutoPlay(i); } } } AutoPlay AP = AutoManager[i]; List <int> _offIndex = new List <int>(); //終わったnoteをnoteOff foreach (int j in AutoManager[i].OnIndex) //自動演奏中のすべてのnoteについて { //jがLastOffNoteIndexでなくて //演奏時間がnoteOffTime以上なら if (PlayTime >= KeyInfoList[i][j].OffTime && ((!AutoManager[i].LastOffNoteIndex.Contains(j)))) { m_oscSend.NoteOn(KeyInfoList[i][j].key, 0); KeyList[i].Remove(KeyInfoList[i][j].key); OnList[i].Remove(KeyInfoList[i][j].key); AllOnList.Remove(KeyInfoList[i][j].key); _offIndex.Add(j); } } foreach (int val in _offIndex) { AP.OnIndex.Remove(val); //上でforeachを使っているため } AutoManager[i] = AP; //押していてnoteOnが来たらnoteOn int _nextIndex = index[i] + AutoManager[i].subIndex + 1; if (_nextIndex < KeyInfoList[i].Count) { if (PlayTime >= KeyInfoList[i][_nextIndex].OnTime) { AP = AutoManager[i]; AP.subIndex++; AP.OnIndex.Add(_nextIndex); AutoManager[i] = AP; if (pressing[i] && AP.pressed && KeyInfoList[i][_nextIndex - 1].tag == 1) { m_oscSend.NoteOn(KeyInfoList[i][_nextIndex].key, 100); //KeyList[i].Add(KeyInfoList[i][_nextIndex].key); OnList[i].Add(KeyInfoList[i][_nextIndex].key); AllOnList.Add(KeyInfoList[i][_nextIndex].key); } KeyList[i].Add(KeyInfoList[i][_nextIndex].key); } } TextUpdate(KeyText[i], KeyList[i]); TextUpdate(OnKeyText[i], OnList[i]); } } } }