Esempio n. 1
0
    void Update()
    {
        Vector3 scale = transform.localScale;

        scale.y = GlobalSingleton.GetTimelineScale();
        transform.localScale = scale;
    }
    void Update()
    {
        if (GlobalSingleton.GetHealth() < 0)
        {
            return;
        }

        if (hitCooldown > 0)
        {
            hitCooldown -= Time.deltaTime;
        }
        beat += GlobalSingleton.GetBPM() * 0.0166666666666f * Time.deltaTime;

        if (beat > DESTROY_BEAT + sustainLength)
        {
            NoteGenerator.RemoveNote(this);
            Destroy(gameObject);
            return;
        }

        if (beat > lateDistance && !playerMissed && !playerHit)
        {
            GlobalSingleton.GetShake().StartShake(0.5f, 0.1f);
            MissNote(0);
        }

        if (beat > lateDistance && lastNote)
        {
            lastNote = false;
            if (numMissed <= 0)
            {
                GlobalSingleton.IncreaseScore();
            }
            numMissed = 0;
        }

        if (beat >= COMPUTER_BEAT && !computerHit)
        {
            computerHit = true;
            StartCoroutine(PlayNote());
        }

        if (beat >= HIDDING_BEAT && !hideHit && hideNote)
        {
            hideHit = true;
            for (int i = 0; i < noteColors.Length; ++i)
            {
                StartCoroutine(HitchLib.Tweening.FadeTo(noteColors[i], 60f / GlobalSingleton.GetBPM(),
                                                        HitchLib.Easing.EASE_LINEAR, 0));
            }
            StartCoroutine(HitchLib.Tweening.FadeTo(keyText, 60f / GlobalSingleton.GetBPM(),
                                                    HitchLib.Easing.EASE_LINEAR, 0));
        }

        float   yPos = BEAT_PLAYER_Y - (beat * BEAT_SIZE);
        Vector3 pos  = rTrans.localPosition;

        pos.y = yPos * GlobalSingleton.GetTimelineScale();
        rTrans.localPosition = pos;
    }