//-------------------------Click音符对象池方法-------------------------- private void CheckSpawnNext() //不断检测是否生成下一个新音符 { int currentTime = DelayedSampleTime; int curNum = 1; while (curNum <= initClickNotesDatas.Count && initClickNotesDatas.Peek().dTime <= currentTime) { clickNoteInitData tempData = initClickNotesDatas.Dequeue(); // Debug.Log("TimeToGo!"); Note newObj = GetFreshNote(); newObj.Initialized(this, tempData.ID, tempData.sPosition, tempData.tPosition, tempData.direction, tempData.nTime, tempData.dTime); curNum++; } }
private void InitClickNoteQueue() { KoreographyTrackBase rhythmTrack = playingKoreo.GetTrackByID(eventID[0]); //获取时间轨迹 List <KoreographyEvent> rawClickEvents = rhythmTrack.GetAllEvents(); //获取所有事件 int clickID = 0; foreach (var item in rawClickEvents) { string rawText = item.GetTextValue(); List <int> laneData = new TextTok().TokText(rawText); foreach (var rawData in laneData) { clickNoteInitData temp = new clickNoteInitData(); temp.ID = clickID; clickID++; temp.sPosition = laneOrigins[rawData].position; temp.tPosition = laneTargets[rawData].position; temp.direction = new Vector3(-1, 0, 0); temp.nTime = item.StartSample; temp.dTime = item.StartSample - GetSpawnSampleOffset(temp.sPosition, laneTargets[rawData].position); initClickNotesDatas.Enqueue(temp); } } }