Beispiel #1
0
        private float GetDeltaTime(NoteObject gn)
        {
            //Debug.Log(gn.num + ", " + ConvertUtils.NoteToSamples(gn.note, 1, BPM)+","+playtime);
            float d = (MusicController.Instance.GetSamples() - (gn.time + offset));

            //Debug.Log(gn.name + d);
            //Debug.Log("delta: "+d);
            return(d);
        }
Beispiel #2
0
        public void AddChainedNote(NoteObject n)
        {
            if (chainedNotes == null)
            {
                chainedNotes = new List <NoteObject>();
            }
            else
            {
                chainedNotes.Clear();
            }

            chainedNotes.Add(n);
        }
Beispiel #3
0
        ///<summary>
        ///对音符进行判定
        ///<returns>0: perfect; 1: great; 2: good; 3: bad; -1: miss; -2: early, no judgement</returns>
        ///</summary>
        public int Judge(NoteObject gn)
        {
            var delta = GetDeltaSample(gn);

            if (delta < early)
            {
                return(-2);
            }

            delta = Mathf.Abs(delta);

            for (int i = 0; i < 4; i++)
            {
                if (delta <= sampleRange[i])
                {
                    return(i);
                }
            }
            return(-1);
        }
Beispiel #4
0
 public void NoteEnqueue(NoteObject gn)
 {
     if (gn == null)
     {
         Debug.Log("Note object is null!");
     }
     else if (gn.clicked)
     {
         Debug.Log("Note object is already clicked!");
     }
     else
     {
         var lane = gn.Block();
         if (lane < 0 || lane >= laneCount)
         {
             Debug.Log("Note's block is false!");
         }
         else
         {
             laneNotes[gn.Block()].Enqueue(gn);
         }
     }
 }
Beispiel #5
0
 public bool IsMissed(NoteObject gn)
 {
     return(Judge(gn) == -1);
 }
Beispiel #6
0
        public bool Out(NoteObject gn)
        {
            var delta = GetDeltaSample(gn);

            return(delta > sampleRange[3]);
        }
Beispiel #7
0
        public float GetDeltaSample(NoteObject gn)
        {
            float d = (mc.GetSamples() - (gn.time + offset));

            return(d);
        }