Beispiel #1
0
    void Update()
    {
        if (isVisible)
        {
            if (!outOfDistance)
            {
                if (rect.Contains(icon.transform.position))
                {
                    if (!fadeOut)
                    {
                        icon.enabled = true;
                    }
                    else
                    {
                        StartCoroutine(fader.StartFadeIO(icon.color.a, 2.5f, fadeOutSpeed: 4f, fadeOutAfter: UIFader.FadeOutAfter.Bool));
                        fadeOut = false;
                    }
                }
                else
                {
                    fader.fadeOut = true;
                    StartCoroutine(FadeOut());
                }
            }

            if (!fader.fadeCompleted)
            {
                Color color = icon.color;
                color.a    = fader.GetFadeAlpha();
                icon.color = color;
            }
        }
        else
        {
            icon.enabled = false;
        }

        Vector3 screenPos = Tools.MainCamera().WorldToScreenPoint(FollowObject.transform.position);

        icon.transform.position = Vector3.Lerp(icon.transform.position, screenPos, Time.deltaTime * (smooth * 10));
    }