示例#1
0
        /// <summary>
        /// Lerps the Color of the Renderer in the given Duration
        /// </summary>
        /// <param name="rend">The Renderer to set the Color to</param>
        /// <param name="target">The Color to lerp to</param>
        /// <param name="duration">Amount of seconds the lerp should take</param>
        /// <param name="progressMapping">Function for mapping the progress, takes one float argument between 0 and 1 and should return a float between 0 and 1</param>
        /// <param name="finished">Callback for when the Fading is finished</param>
        /// <returns></returns>
        public static Coroutine LerpColor(this Renderer rend, Color target, float duration, Func <float, float> progressMapping, Action finished = null)
        {
            Color[] targets = new Color[rend.materials.Length];
            for (int i = 0; i < targets.Length; ++i)
            {
                targets[i] = target;
            }

            CoroutineHost.StopTrackedCoroutine(rend, COROUTINE_TAG);
            return(CoroutineHost.StartTrackedCoroutine(FadingMethods.LerpColor(rend, targets, duration, false, finished, progressMapping), rend, COROUTINE_TAG));
        }
示例#2
0
 /// <summary>
 /// Lerps the Color of the Sprite in the given Duration
 /// </summary>
 /// <param name="sprite">The Sprite to set the Color to</param>
 /// <param name="target">The Color to lerp to</param>
 /// <param name="duration">Amount of seconds the lerp should take</param>
 /// <param name="progressMapping">Function for mapping the progress, takes one float argument between 0 and 1 and should return a float between 0 and 1</param>
 /// <param name="finished">Callback for when the Fading is finished</param>
 /// <returns></returns>
 public static Coroutine LerpColor(this SpriteRenderer sprite, Color target, float duration, Func <float, float> progressMapping, Action finished = null)
 {
     CoroutineHost.StopTrackedCoroutine(sprite, COROUTINE_TAG);
     return(CoroutineHost.StartTrackedCoroutine(FadingMethods.LerpColor(sprite, target, duration, false, finished, progressMapping), sprite, COROUTINE_TAG));
 }
示例#3
0
 /// <summary>
 /// Lerps the Color of the Material in the given Duration
 /// </summary>
 /// <param name="material">The Material to set the Color to</param>
 /// <param name="target">The Color to lerp to</param>
 /// <param name="duration">Amount of seconds the lerp should take</param>
 /// <param name="progressMapping">Function for mapping the progress, takes one float argument between 0 and 1 and should return a float between 0 and 1</param>
 /// <param name="finished">Callback for when the Fading is finished</param>
 /// <returns></returns>
 public static Coroutine LerpColor(this Material material, Color target, float duration, Func <float, float> progressMapping, Action finished = null)
 {
     CoroutineHost.StopTrackedCoroutine(material, COROUTINE_TAG);
     return(CoroutineHost.StartTrackedCoroutine(FadingMethods.LerpColor(material, target, duration, finished, progressMapping), material, COROUTINE_TAG));
 }
示例#4
0
 /// <summary>
 /// Lerps the Color of the Graphic in the given Duration
 /// </summary>
 /// <param name="graphic">The Graphic to set the Color to</param>
 /// <param name="target">The Color to lerp to</param>
 /// <param name="duration">Amount of seconds the lerp should take</param>
 /// <param name="finished">Callback for when the Fading is finished</param>
 /// <returns></returns>
 public static Coroutine LerpColor(this Graphic graphic, Color target, float duration, Action finished = null)
 {
     CoroutineHost.StopTrackedCoroutine(graphic, COROUTINE_TAG);
     return(CoroutineHost.StartTrackedCoroutine(FadingMethods.LerpColor(graphic, target, duration, false, finished, null), graphic, COROUTINE_TAG));
 }