예제 #1
0
    void UpdateNotePositions()
    {
        if (notes.Count == 0)
        {
            return;
        }

        int currentSample = koreo.GetLatestSampleTime();

        foreach (RhythmNote n in notes)
        {
            //starts at noteTravelSampleTime and goes to 0
            int distance = n.evt.StartSample - currentSample;

            //starts at zero
            float betterDistance = RhythmGameManager.noteTravelSampleTime - distance;
            //Debug.Log("b" + betterDistance);

            n.percentage = betterDistance / RhythmGameManager.noteTravelSampleTime;
            //Debug.Log("p" + n.percentage);

            Vector3 targetPosition = new Vector3(0, 0, 90f) + n.percentage * noteDirection;
            //TODO maybe slerp
            n.gameObect.transform.position = targetPosition;

            //update circle
            n.circle.openness = 1 - n.percentage;
            ///todo
            if (n.circle.openness <= 0.9 && n.circle.openness >= 0.5f)
            {
                n.circle.circleImage.enabled = true;
            }


            if (n.circle.openness < 0)
            {
                GameObject.Destroy(n.circleObject);
            }

            //TODO DEBUG HITSOUND

            if (n.percentage >= 0.97f)
            {
                if (!n.dirty)
                {
                    n.dirty = true;
                    audioSource.Play();
                }
            }
        }
        if (notes[0].percentage > missPercentage)
        {
            RhythmNote todelete = notes[0];
            notes.RemoveAt(0);
            GameObject.Destroy(todelete.circleObject);
            GameObject.Destroy(todelete.gameObect);
        }
    }
예제 #2
0
 public void StartFreeHit(KoreographyEvent evt)
 {
     if (!isFreeHit)
     {
         freeHitEndSampleTime = evt.EndSample;
         koreoGraphy.GetLatestSampleTime();
         freehitTransitonSampleTime = freeHitEndSampleTime - (int)(freeHitTransitionTime.Value * koreoGraphy.SampleRate);
         isFreeHit = true;
         isFreeHitTransitioning = false;
         foreach (IndicatorManager manager in indicatorManagers)
         {
             manager.StartFreeHit();
         }
     }
 }
예제 #3
0
    void CheckForNotesToSpawn()
    {
        int currentSample = koreo.GetLatestSampleTime();

        for (int i = 0; i < 6; i++)
        {
            if (nextEvent[i] == null)
            {
                continue;
            }

            int distance = nextEvent[i].StartSample - currentSample;

            //Debug.Log("distance");
            //Debug.Log(distance);

            if (distance <= noteTravelSampleTime)
            {
                //spawn note
                laneControllers[i].AddNote(nextEvent[i]);
                //TODO

                if (lanes[i].Count > 0)
                {
                    nextEvent[i] = lanes[i].Dequeue();
                }
                else
                {
                    nextEvent[i] = null;
                }
            }
        }
    }
예제 #4
0
 // Update is called once per frame
 void Update()
 {
     foreach (Queue <NoteDataObject> lane in mNotesToSpawn.Values)
     {
         if (lane.Count > 0)
         {
             if (mKoreo.GetLatestSampleTime() + mNoteToHitTravelTime >= lane.Peek().GetStartTime())
             {
                 NoteDataObject spawnedNote = lane.Dequeue();
                 spawnNote(spawnedNote.GetColor(), 1, spawnedNote.GetStartTime());   //hard coded speed for now. Will later depend on difficulty
             }
         }
     }
 }