Exemplo n.º 1
0
    public void CheckBeatDistance(MusicBeat beat)
    {
        //store the distance between the beat and the center of the hitbox
        float beatDistance = Vector2.Distance(beat.gameObject.transform.position, transform.position);

        //create variable to store hit type
        HitType thisHit;

        //check the distance to determine score
        if (beatDistance <= perfectRadius)
        {
            //hit the beat as a perfect note
            thisHit = HitType.Perfect;

            //add to score
            playerScore += 1000;

            //add to combo and change background color
            comboScore++;
        }
        else if (beatDistance <= goodRadius)
        {
            //hit the beat as a good note
            thisHit = HitType.Good;

            //add to score
            playerScore += 500;

            //add to combo and change background color
            comboScore++;
        }
        else
        {
            //miss the beat
            thisHit = HitType.Miss;

            //drop the combo and reset the background
            comboScore = 0;
            Camera.main.GetComponent <BackgroundPulse>().ResetColor();
        }

        //check if current combo is greater than the highest combo and set it accordingly
        if (comboScore > highestCombo)
        {
            highestCombo = comboScore;
        }

        //hit the beat
        beat.HitBeat(thisHit);
    }
Exemplo n.º 2
0
    public void CheckRight(InputAction.CallbackContext ctx)
    {
        //check the currently playable beat to see if it's a right beat
        if (playableNotes.Count > 0)
        {
            MusicBeat currentBeat = playableNotes.Dequeue();

            //check if the beat type is right
            if (currentBeat.beatType == BeatType.Right)
            {
                //check beat distance if the type matches
                CheckBeatDistance(currentBeat);
            }
            else
            {
                //miss the beat and reset the background and combo
                currentBeat.HitBeat(HitType.Miss);
                comboScore = 0;
                Camera.main.GetComponent <BackgroundPulse>().ResetColor();
            }
        }
    }