Example #1
0
    void Update()
    {
        if (cycle >= 0)
        {
            if (audioManager.timeTillSongStart - audioManager.songTime < audioManager.secondsToBeat * cycle && !beeped)
            {
                if (cycle > 0)
                {
                    transform.localScale = Vector3.one;
                    y = 1;
                    readyText.text = cycle.ToString();
                    soundEffects.Beep();
                }
                else
                {
                    readyText.text = "";
                }
                beeped = true;
                cycle--;
                cycle = Mathf.Clamp(cycle, -1, 3);
            }
            else if (beeped)
            {
                currentSecondsToBeat += Time.deltaTime;
                if (currentSecondsToBeat > audioManager.secondsToBeat)
                {
                    currentSecondsToBeat = 0;
                    beeped = false;
                }
            }
        }

        if (y > 0)
        {
            y -= Time.deltaTime * shrinkSpeed;
        }
        else
        {
            y = 0;
        }

        if (y < 0.5f)
        {
            transform.localScale = new Vector3(1, y * 2, 1);
        }
    }