Example #1
0
    private void Update()
    {
        if (beat is Beat)
        {
            CheckKey(KeyToPress);
            beat.Process(target, transform, currentSection);
            lifeTime += Time.deltaTime;

            float distance = DistanceFromTarget();

            if (distance <= 0 && this.isActiveAndEnabled)
            {
                Debug.Log(distance);
                GameManager.Instance.ProcessScore(0);
                BeatPool.Instance.ReturnToPool(this);
            }
            else if (lifeTime > maxLifetime)
            {
                BeatPool.Instance.ReturnToPool(this);
            }
        }
    }