Пример #1
0
    //
    private void Update()
    {
        // placement
        cachedTransform.position = hero.transform.position.WithZ(cachedTransform.position.z) + Vector3.up * offset;

        currentDebugTime += Time.deltaTime;
        while (currentDebugTime > hero.recoveryInterval)
        {
            currentDebugTime -= hero.recoveryInterval;
        }

        // debug
        float progress = hero.GetRecoveryProgress();

        if (debug)
        {
            progress = hero.recoveryAnimation.Evaluate(Mathf.Clamp01(currentDebugTime / hero.recoveryInterval));
        }

        // visibility
        if (!debug)
        {
            foreach (SpriteRenderer renderer in cachedRenderers)
            {
                renderer.enabled = hero.IsStunned();
            }
        }

        // recovery circles
        recoveryBackground.color  = ((progress > hero.recoveryAreaStart) && (progress < hero.recoveryAreaEnd)) ? recoveryColor : defaultColor;
        recoverySlider.localScale = Vector3.one * (1.0f - progress);
    }
Пример #2
0
    private void Update()
    {
        Vector3 velocity = cachedBody.velocity;

        cachedAnimation.SetFloat("VelocityY", velocity.y);
        cachedAnimation.SetFloat("Grabbing", cachedHands.GetGrabbedObject() ? 1.0f : 0.0f);

        cachedAnimation.SetBool("InAir", cachedCollision.InAir());
        cachedAnimation.SetBool("Moving", cachedInput.IsMoving());
        cachedAnimation.SetBool("Stunned", cachedHero.IsStunned());
    }