public void FadeOut(LR direction) { currentFade?.Kill(); switch (direction) { case LR.L: if (material.GetFloat(Alpha0UVX) < material.GetFloat(Alpha1UVX)) { material.SetFloat(Alpha0UVX, 1 + fadeInOutGradationWidth); material.SetFloat(Alpha1UVX, 1); } currentFade = DOTween.Sequence() .Append(material.To(Alpha0UVX, 0, fadeOutDuration)) .Join(material.To(Alpha1UVX, -fadeInOutGradationWidth, fadeOutDuration)); break; case LR.R: if (material.GetFloat(Alpha0UVX) > material.GetFloat(Alpha1UVX)) { material.SetFloat(Alpha0UVX, -fadeInOutGradationWidth); material.SetFloat(Alpha1UVX, 0); } currentFade = DOTween.Sequence() .Append(material.To(Alpha0UVX, 1, fadeOutDuration)) .Join(material.To(Alpha1UVX, 1 + fadeInOutGradationWidth, fadeOutDuration)); break; } currentFade.GetPausable().AddTo(this); currentFade.AsHeros(); }