Exemplo n.º 1
0
    void GoToNextBeat(BeatIconInstance currentBeat, NoteScoreIndicator score)
    {
        DisplayText(score);
        currentBeat.icon.color = score.iconTint;

        nextBeatInput++;
    }
Exemplo n.º 2
0
    void HandleInput()
    {
        // Conseguir el siguiente beat que se tiene que tocar
        BeatIconInstance targetBeat = GetBeat(nextBeatInput);

        // Si el número es 0 (No se encontró el beat) no seguir con esta función
        if (targetBeat.beatNumber <= 0)
        {
            return;
        }

        // La diferencia de tiempo en segundos del tiempo que le corresponde a la nota del tiempo actual
        timeDifference  = (manager.CurrentBeat - nextBeatInput) * manager.BeatDuration;
        timeDifference -= inputCalibration;

        // Cuando se presione espacio, dar la puntuación correspondiente
        if (Input.GetKeyDown(KeyCode.Space))
        {
            foreach (var score in noteScores)
            {
                if (Mathf.Abs(timeDifference) <= score.timeTolerance)
                {
                    GoToNextBeat(targetBeat, score);
                    return;
                }
            }
            DisplayText(missScore);
        }

        if (timeDifference > maxTimeTolerance)
        {
            GoToNextBeat(targetBeat, missScore);
        }
    }