Ejemplo n.º 1
0
 private void Update()
 {
     // Check every frame if a eight note has passed and try to spawn a challenge
     if (startTime > 0 && gameActive)
     {
         float timePassed = Time.time - startTime;
         int   eightNote  = Mathf.FloorToInt(timePassed / ((60.0f / bpm) / 8.0f));
         beatDebugger.gameObject.SetActive(eightNote % 8 == 0);
         if (eightNote % 8 == 0 && heartBeat != null)
         {
             heartBeat.AnimateBeat();
         }
         if (eightNote != previousEightNote)
         {
             previousEightNote = eightNote;
             TrySpawnChallengePrefab();
         }
     }
 }