public void SetToTransparent()
 {
     targetColor.a = 0;
     image.color   = targetColor;
     StopFade();
     fadeDirection = FadeInFadeOut.FadeDirection.FadeIn;
 }
 public void SetToBlack()
 {
     targetColor.a = 1;
     image.color   = targetColor;
     StopFade();
     fadeDirection = FadeInFadeOut.FadeDirection.FadeOut;
 }
    public void Fade(float duration, UnityAction actionIn, FadeInFadeOut.FadeDirection fadeDirectionIn)
    {
        if (fadeDirectionIn == FadeInFadeOut.FadeDirection.FadeOut)
        {
            targetColor.a = 1;
        }
        if (fadeDirectionIn == FadeInFadeOut.FadeDirection.FadeIn)
        {
            targetColor.a = 0;
        }

        elapsedFadeTime = 0;
        action          = actionIn;
        fadeDirection   = fadeDirectionIn;
        fadeDuration    = duration;
        prevColor       = image.color;
        fadingDone      = false;
    }