Ejemplo n.º 1
0
    public static IEnumerator FadeMaterialColor(this LineRenderer line, Color start, Color end, float time)
    {
        UnityAction <Color> setRendererColor = color =>
        {
            line.material.color = color;
        };

        yield return(ColorModule.Fade(start, end, time, setRendererColor));
    }
Ejemplo n.º 2
0
    public static IEnumerator Fade(this Image image, Color start, Color end, float time)
    {
        UnityAction <Color> colorUpdate = color =>
        {
            image.color = color;
        };

        yield return(ColorModule.Fade(start, end, time, colorUpdate));
    }
Ejemplo n.º 3
0
    public static IEnumerator Fade(this SpriteRenderer renderer, Color start, Color end, float time)
    {
        UnityAction <Color> setRendererColor = color =>
        {
            renderer.color = color;
        };

        yield return(ColorModule.Fade(start, end, time, setRendererColor));
    }
Ejemplo n.º 4
0
    public static IEnumerator FadeGradient(this LineRenderer line, Color start, Color end, float time, GradientFadeType fadeType = GradientFadeType.StartAndEnd)
    {
        UnityAction <Color> setRendererGradient = color =>
        {
            if (fadeType == GradientFadeType.StartOnly || fadeType == GradientFadeType.StartAndEnd)
            {
                line.startColor = color;
            }
            if (fadeType == GradientFadeType.EndOnly || fadeType == GradientFadeType.StartAndEnd)
            {
                line.endColor = color;
            }
        };

        yield return(ColorModule.Fade(start, end, time, setRendererGradient));
    }