Exemplo n.º 1
0
    // checks if it can be hit
    // destroys note if it can
    protected virtual void CheckLocation()
    {
        //if ((transform.position.x >= activator.transform.position.x - hitOffset && transform.position.x <= activator.transform.position.x + hitOffset) && (transform.position.y == activator.transform.position.y))
        //{
        //    //Debug.Log("Checking location.");
        //    scoreHandler.SendMessage("AddScore", transform.position.x);
        //    GameData.currentSongStats.notesHit++;
        //    Destroy(this.gameObject);
        //}

        bool  _isHit = false;
        float _accuracyMultiplier = 1.0f;

        ScoreHandler.HitAccuracy _hitAccuracy = ScoreHandler.HitAccuracy.Good;

        if (transform.position.x >= activator.transform.position.x - hitOffset + perfectHitOffset && transform.position.x <= activator.transform.position.x + hitOffset - perfectHitOffset)
        {
            _accuracyMultiplier = 1.2f;
            _isHit       = true;
            _hitAccuracy = ScoreHandler.HitAccuracy.Perfect;
        }
        else if (transform.position.x >= activator.transform.position.x - hitOffset + greatHitOffset && transform.position.x <= activator.transform.position.x + hitOffset - greatHitOffset)
        {
            _accuracyMultiplier = 1.1f;
            _isHit       = true;
            _hitAccuracy = ScoreHandler.HitAccuracy.Great;
        }
        else if (transform.position.x >= activator.transform.position.x - hitOffset && transform.position.x <= activator.transform.position.x + hitOffset)
        {
            _accuracyMultiplier = 1f;
            _isHit       = true;
            _hitAccuracy = ScoreHandler.HitAccuracy.Good;
        }

        if (_isHit)
        {
            // Debug.Log("Accuracy Multiplier: " + _accuracyMultiplier);
            scoreHandler.SendMessage("AddScore", _accuracyMultiplier);
            scoreHandler.SendMessage("ChangeAccuracyText", _hitAccuracy);
            GameData.currentSongStats.notesHit++;
            //Destroy(this.gameObject);
            gameObject.SetActive(false);
        }
    }
Exemplo n.º 2
0
    private void ChangeAccuracyText(ScoreHandler.HitAccuracy hitAccuracy)
    {
        switch (hitAccuracy)
        {
        case ScoreHandler.HitAccuracy.Perfect:
            accuracyText.text = "PERFECT";
            break;

        case ScoreHandler.HitAccuracy.Great:
            accuracyText.text = "GREAT";
            break;

        case ScoreHandler.HitAccuracy.Good:
            accuracyText.text = "GOOD";
            break;

        case ScoreHandler.HitAccuracy.Miss:
            accuracyText.text = "MISS";
            break;
        }

        accuracyText.SendMessage("Pulse");
    }