Example #1
0
        public void InitializeLongNote(int noteNum, LaneController laneCont, RhythmGameController gameCont)
        {
            laneController = laneCont;
            gameController = gameCont;
            int spriteNum = noteNum + 4;

            visuals.sprite = noteSprites[spriteNum - 1];
        }
Example #2
0
        void Start()
        {
            InitializeLeadIn();
            //切歌选歌
            simpleMusicPlayer = simpleMusciPlayerTrans.GetComponent <SimpleMusicPlayer>();
            simpleMusicPlayer.LoadSong(kgy, 0, false);
            foreach (LaneController nl in noteLanes)
            {
                nl.Initialize(this);
            }

            //获取到Koreograhpy对象
            playingKoreo = Koreographer.Instance.GetKoreographyAtIndex(0);
            foreach (string _eventID in eventID)
            {
                //获取事件轨迹
                KoreographyTrackBase rhythmTrack = playingKoreo.GetTrackByID(_eventID);
                //获取事件
                List <KoreographyEvent> rawEvents = rhythmTrack.GetAllEvents();

                for (int i = 0; i < rawEvents.Count; i++)
                {
                    KoreographyEvent evt = rawEvents[i];
                    int noteID           = evt.GetIntValue();

                    //遍历所有音轨
                    for (int j = 0; j < noteLanes.Count; j++)
                    {
                        LaneController lane = noteLanes[j];
                        if (noteID > 4)
                        {
                            noteID = noteID - 4;
                            if (noteID > 4)
                            {
                                noteID = noteID - 4;
                            }
                        }
                        if (lane.DoesMatch(noteID))
                        {
                            lane.AddEventToLane(evt);
                            break;
                        }
                    }
                }
            }

            //SampleRate采样率,在音频资源里有。
            //命中窗口宽度,采样率*0.001*命中时长
            hitWindowRangeInSamples = (int)(SampleRate * hitWindowRangeInMS * 0.001f);
        }
Example #3
0
 /// <summary>
 /// 初始化
 /// </summary>
 /// <param name="evt">KoreographyEvent对象</param>
 /// <param name="noteNum">音符数量</param>
 /// <param name="laneCont">音轨控制类</param>
 /// <param name="gameCont">游戏控制类</param>
 /// <param name="isLongStart">长音符头</param>
 /// <param name="isLongEnd">长音符尾</param>
 public void Initialize(KoreographyEvent evt, int noteNum, LaneController laneCont,
                        RhythmGameController gameCont, bool isLongStart, bool isLongEnd)
 {
     trackedEvent   = evt;
     laneController = laneCont;
     gameController = gameCont;
     isLongNote     = isLongStart;
     isLongNoteEnd  = isLongEnd;
     spriteNum      = noteNum;
     if (isLongNote)
     {
         spriteNum += 4;
     }
     else if (isLongNoteEnd)
     {
         spriteNum += 8;
     }
     visuals.sprite = noteSprites[spriteNum - 1];
 }
Example #4
0
 /// <summary>
 /// 将Note对象重置
 /// </summary>
 private void ResetNote()
 {
     trackedEvent   = null;
     laneController = null;
     gameController = null;
 }