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