diff --git a/Assets/AnimeTask/Scripts/Translator/ActionTranslator.cs b/Assets/AnimeTask/Scripts/Translator/ActionTranslator.cs index 3bd0116..5a43754 100644 --- a/Assets/AnimeTask/Scripts/Translator/ActionTranslator.cs +++ b/Assets/AnimeTask/Scripts/Translator/ActionTranslator.cs @@ -7,7 +7,11 @@ namespace AnimeTask { public static partial class TranslateTo { - [MustUseReturnValue] public static UniTask ToAction(this IAnimator animator, Action action, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new ActionTranslator(action), scheduler, cancellationToken, skipToken); + [MustUseReturnValue] + public static UniTask ToAction(this IAnimator animator, Action action, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + return Anime.Play(animator, new ActionTranslator(action), scheduler, cancellationToken, skipToken); + } } public class ActionTranslator : ITranslator diff --git a/Assets/AnimeTask/Scripts/Translator/BindTranslator.cs b/Assets/AnimeTask/Scripts/Translator/BindTranslator.cs index 55dac86..ba30bd2 100644 --- a/Assets/AnimeTask/Scripts/Translator/BindTranslator.cs +++ b/Assets/AnimeTask/Scripts/Translator/BindTranslator.cs @@ -7,8 +7,17 @@ namespace AnimeTask { public static partial class TranslateTo { - [MustUseReturnValue] public static UniTask ToBind(this IAnimator animator, Func getter, Action setter, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new BindTranslator(getter, setter), scheduler, cancellationToken, skipToken); - [MustUseReturnValue] public static UniTask ToBind(this IAnimatorWithStartValue animator, Func getter, Action setter, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new BindTranslator(getter, setter), scheduler, cancellationToken, skipToken); + [MustUseReturnValue] + public static UniTask ToBind(this IAnimator animator, Func getter, Action setter, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + return Anime.Play(animator, new BindTranslator(getter, setter), scheduler, cancellationToken, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToBind(this IAnimatorWithStartValue animator, Func getter, Action setter, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + return Anime.PlayTo(animator, new BindTranslator(getter, setter), scheduler, cancellationToken, skipToken); + } } public class BindTranslator : IValueTranslator diff --git a/Assets/AnimeTask/Scripts/Translator/MaterialTranslator.cs b/Assets/AnimeTask/Scripts/Translator/MaterialTranslator.cs index 41b9bcf..be0734f 100644 --- a/Assets/AnimeTask/Scripts/Translator/MaterialTranslator.cs +++ b/Assets/AnimeTask/Scripts/Translator/MaterialTranslator.cs @@ -7,20 +7,89 @@ namespace AnimeTask { public static partial class TranslateTo { - [MustUseReturnValue] public static UniTask ToMaterialPropertyColor(this IAnimator animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new MaterialPropertyColorTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToMaterialPropertyColor(this IAnimator animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new MaterialPropertyColorTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToMaterialPropertyColor(this IAnimatorWithStartValue animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new MaterialPropertyColorTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToMaterialPropertyColor(this IAnimatorWithStartValue animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new MaterialPropertyColorTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - - [MustUseReturnValue] public static UniTask ToMaterialPropertyFloat(this IAnimator animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new MaterialPropertyFloatTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToMaterialPropertyFloat(this IAnimator animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new MaterialPropertyFloatTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToMaterialPropertyFloat(this IAnimatorWithStartValue animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new MaterialPropertyFloatTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToMaterialPropertyFloat(this IAnimatorWithStartValue animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new MaterialPropertyFloatTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - - [MustUseReturnValue] public static UniTask ToMaterialPropertyInt(this IAnimator animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new MaterialPropertyIntTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToMaterialPropertyInt(this IAnimator animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new MaterialPropertyIntTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToMaterialPropertyInt(this IAnimatorWithStartValue animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new MaterialPropertyIntTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToMaterialPropertyInt(this IAnimatorWithStartValue animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new MaterialPropertyIntTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + [MustUseReturnValue] + public static UniTask ToMaterialPropertyColor(this IAnimator animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(renderer); + return Anime.Play(animator, new MaterialPropertyColorTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToMaterialPropertyColor(this IAnimator animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(renderer); + return Anime.Play(animator, new MaterialPropertyColorTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToMaterialPropertyColor(this IAnimatorWithStartValue animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(renderer); + return Anime.PlayTo(animator, new MaterialPropertyColorTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToMaterialPropertyColor(this IAnimatorWithStartValue animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(renderer); + return Anime.PlayTo(animator, new MaterialPropertyColorTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToMaterialPropertyFloat(this IAnimator animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(renderer); + return Anime.Play(animator, new MaterialPropertyFloatTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToMaterialPropertyFloat(this IAnimator animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(renderer); + return Anime.Play(animator, new MaterialPropertyFloatTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToMaterialPropertyFloat(this IAnimatorWithStartValue animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(renderer); + return Anime.PlayTo(animator, new MaterialPropertyFloatTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToMaterialPropertyFloat(this IAnimatorWithStartValue animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(renderer); + return Anime.PlayTo(animator, new MaterialPropertyFloatTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToMaterialPropertyInt(this IAnimator animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(renderer); + return Anime.Play(animator, new MaterialPropertyIntTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToMaterialPropertyInt(this IAnimator animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(renderer); + return Anime.Play(animator, new MaterialPropertyIntTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToMaterialPropertyInt(this IAnimatorWithStartValue animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(renderer); + return Anime.PlayTo(animator, new MaterialPropertyIntTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToMaterialPropertyInt(this IAnimatorWithStartValue animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(renderer); + return Anime.PlayTo(animator, new MaterialPropertyIntTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } } public class MaterialPropertyColorTranslator : IValueTranslator diff --git a/Assets/AnimeTask/Scripts/Translator/NoneTranslator.cs b/Assets/AnimeTask/Scripts/Translator/NoneTranslator.cs index c8f487c..7aad9fb 100644 --- a/Assets/AnimeTask/Scripts/Translator/NoneTranslator.cs +++ b/Assets/AnimeTask/Scripts/Translator/NoneTranslator.cs @@ -6,8 +6,17 @@ namespace AnimeTask { public static partial class TranslateTo { - [MustUseReturnValue] public static UniTask ToNone(this IAnimator animator, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new NoneTranslator(), scheduler, cancellationToken, skipToken); - [MustUseReturnValue] public static UniTask ToNone(this IAnimatorWithStartValue animator, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new NoneTranslator(), scheduler, cancellationToken, skipToken); + [MustUseReturnValue] + public static UniTask ToNone(this IAnimator animator, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + return Anime.Play(animator, new NoneTranslator(), scheduler, cancellationToken, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToNone(this IAnimatorWithStartValue animator, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + return Anime.PlayTo(animator, new NoneTranslator(), scheduler, cancellationToken, skipToken); + } } public class NoneTranslator : IValueTranslator diff --git a/Assets/AnimeTask/Scripts/Translator/ProgressTranslator.cs b/Assets/AnimeTask/Scripts/Translator/ProgressTranslator.cs index 8b0eeac..c50b8e0 100644 --- a/Assets/AnimeTask/Scripts/Translator/ProgressTranslator.cs +++ b/Assets/AnimeTask/Scripts/Translator/ProgressTranslator.cs @@ -7,7 +7,11 @@ namespace AnimeTask { public static partial class TranslateTo { - [MustUseReturnValue] public static UniTask ToProgress(this IAnimator animator, IProgress progress, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new ProgressTranslator(progress), scheduler, cancellationToken, skipToken); + [MustUseReturnValue] + public static UniTask ToProgress(this IAnimator animator, IProgress progress, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + return Anime.Play(animator, new ProgressTranslator(progress), scheduler, cancellationToken, skipToken); + } } public class ProgressTranslator : ITranslator diff --git a/Assets/AnimeTask/Scripts/Translator/ReactivePropertyTranslator.cs b/Assets/AnimeTask/Scripts/Translator/ReactivePropertyTranslator.cs index 5a00460..8c1da14 100644 --- a/Assets/AnimeTask/Scripts/Translator/ReactivePropertyTranslator.cs +++ b/Assets/AnimeTask/Scripts/Translator/ReactivePropertyTranslator.cs @@ -8,8 +8,17 @@ namespace AnimeTask { public static partial class TranslateTo { - [MustUseReturnValue] public static UniTask ToReactiveProperty(this IAnimator animator, ReactiveProperty reactiveProperty, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new ReactivePropertyTranslator(reactiveProperty), scheduler, cancellationToken, skipToken); - [MustUseReturnValue] public static UniTask ToReactiveProperty(this IAnimatorWithStartValue animator, ReactiveProperty reactiveProperty, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new ReactivePropertyTranslator(reactiveProperty), scheduler, cancellationToken, skipToken); + [MustUseReturnValue] + public static UniTask ToReactiveProperty(this IAnimator animator, ReactiveProperty reactiveProperty, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + return Anime.Play(animator, new ReactivePropertyTranslator(reactiveProperty), scheduler, cancellationToken, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToReactiveProperty(this IAnimatorWithStartValue animator, ReactiveProperty reactiveProperty, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + return Anime.PlayTo(animator, new ReactivePropertyTranslator(reactiveProperty), scheduler, cancellationToken, skipToken); + } } public class ReactivePropertyTranslator : IValueTranslator diff --git a/Assets/AnimeTask/Scripts/Translator/RectTransformTranslator.cs b/Assets/AnimeTask/Scripts/Translator/RectTransformTranslator.cs index ab07479..665a8c7 100644 --- a/Assets/AnimeTask/Scripts/Translator/RectTransformTranslator.cs +++ b/Assets/AnimeTask/Scripts/Translator/RectTransformTranslator.cs @@ -9,26 +9,131 @@ namespace AnimeTask { public static partial class TranslateTo { - [MustUseReturnValue] public static UniTask ToAnchoredPosition(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new AnchoredPositionTranslator(gameObject.GetComponent()), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToAnchoredPosition(this IAnimator animator, RectTransform rectTransform, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new AnchoredPositionTranslator(rectTransform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(rectTransform.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToAnchoredPosition(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new AnchoredPositionTranslator(graphic.rectTransform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToAnchoredPosition(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new AnchoredPositionTranslator(gameObject.GetComponent()), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToAnchoredPosition(this IAnimatorWithStartValue animator, RectTransform rectTransform, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new AnchoredPositionTranslator(rectTransform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(rectTransform.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToAnchoredPosition(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new AnchoredPositionTranslator(graphic.rectTransform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - - [MustUseReturnValue] public static UniTask ToAnchoredPositionX(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new AnchoredPositionXTranslator(gameObject.GetComponent(), 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToAnchoredPositionX(this IAnimator animator, RectTransform rectTransform, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new AnchoredPositionXTranslator(rectTransform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(rectTransform.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToAnchoredPositionX(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new AnchoredPositionXTranslator(graphic.rectTransform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToAnchoredPositionX(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new AnchoredPositionXTranslator(gameObject.GetComponent(), 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToAnchoredPositionX(this IAnimatorWithStartValue animator, RectTransform rectTransform, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new AnchoredPositionXTranslator(rectTransform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(rectTransform.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToAnchoredPositionX(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new AnchoredPositionXTranslator(graphic.rectTransform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - - [MustUseReturnValue] public static UniTask ToAnchoredPositionY(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new AnchoredPositionXTranslator(gameObject.GetComponent(), 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToAnchoredPositionY(this IAnimator animator, RectTransform rectTransform, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new AnchoredPositionXTranslator(rectTransform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(rectTransform.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToAnchoredPositionY(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new AnchoredPositionXTranslator(graphic.rectTransform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToAnchoredPositionY(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new AnchoredPositionXTranslator(gameObject.GetComponent(), 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToAnchoredPositionY(this IAnimatorWithStartValue animator, RectTransform rectTransform, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new AnchoredPositionXTranslator(rectTransform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(rectTransform.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToAnchoredPositionY(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new AnchoredPositionXTranslator(graphic.rectTransform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + [MustUseReturnValue] + public static UniTask ToAnchoredPosition(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new AnchoredPositionTranslator(gameObject.GetComponent()), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToAnchoredPosition(this IAnimator animator, RectTransform rectTransform, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(rectTransform); + return Anime.Play(animator, new AnchoredPositionTranslator(rectTransform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(rectTransform.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToAnchoredPosition(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(graphic); + return Anime.Play(animator, new AnchoredPositionTranslator(graphic.rectTransform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToAnchoredPosition(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new AnchoredPositionTranslator(gameObject.GetComponent()), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToAnchoredPosition(this IAnimatorWithStartValue animator, RectTransform rectTransform, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(rectTransform); + return Anime.PlayTo(animator, new AnchoredPositionTranslator(rectTransform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(rectTransform.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToAnchoredPosition(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(graphic); + return Anime.PlayTo(animator, new AnchoredPositionTranslator(graphic.rectTransform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToAnchoredPositionX(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new AnchoredPositionXTranslator(gameObject.GetComponent(), 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToAnchoredPositionX(this IAnimator animator, RectTransform rectTransform, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(rectTransform); + return Anime.Play(animator, new AnchoredPositionXTranslator(rectTransform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(rectTransform.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToAnchoredPositionX(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(graphic); + return Anime.Play(animator, new AnchoredPositionXTranslator(graphic.rectTransform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToAnchoredPositionX(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new AnchoredPositionXTranslator(gameObject.GetComponent(), 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToAnchoredPositionX(this IAnimatorWithStartValue animator, RectTransform rectTransform, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(rectTransform); + return Anime.PlayTo(animator, new AnchoredPositionXTranslator(rectTransform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(rectTransform.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToAnchoredPositionX(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(graphic); + return Anime.PlayTo(animator, new AnchoredPositionXTranslator(graphic.rectTransform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToAnchoredPositionY(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new AnchoredPositionXTranslator(gameObject.GetComponent(), 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToAnchoredPositionY(this IAnimator animator, RectTransform rectTransform, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(rectTransform); + return Anime.Play(animator, new AnchoredPositionXTranslator(rectTransform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(rectTransform.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToAnchoredPositionY(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(graphic); + return Anime.Play(animator, new AnchoredPositionXTranslator(graphic.rectTransform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToAnchoredPositionY(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new AnchoredPositionXTranslator(gameObject.GetComponent(), 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToAnchoredPositionY(this IAnimatorWithStartValue animator, RectTransform rectTransform, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(rectTransform); + return Anime.PlayTo(animator, new AnchoredPositionXTranslator(rectTransform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(rectTransform.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToAnchoredPositionY(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(graphic); + return Anime.PlayTo(animator, new AnchoredPositionXTranslator(graphic.rectTransform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } } public class AnchoredPositionTranslator : IValueTranslator diff --git a/Assets/AnimeTask/Scripts/Translator/TransformTranslator.cs b/Assets/AnimeTask/Scripts/Translator/TransformTranslator.cs index 399c162..c995619 100644 --- a/Assets/AnimeTask/Scripts/Translator/TransformTranslator.cs +++ b/Assets/AnimeTask/Scripts/Translator/TransformTranslator.cs @@ -7,90 +7,509 @@ namespace AnimeTask { public static partial class TranslateTo { - [MustUseReturnValue] public static UniTask ToLocalPosition(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalPositionTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalPosition(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalPositionTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalPosition(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalPositionTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalPosition(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalPositionTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalPosition(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalPositionTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalPosition(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalPositionTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalPosition(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalPositionTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalPosition(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalPositionTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - - [MustUseReturnValue] public static UniTask ToLocalPositionX(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalPositionXTranslator(gameObject.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalPositionX(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalPositionXTranslator(component.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalPositionX(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalPositionXTranslator(gameObject.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalPositionX(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalPositionXTranslator(component.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - - [MustUseReturnValue] public static UniTask ToLocalPositionY(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalPositionXTranslator(gameObject.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalPositionY(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalPositionXTranslator(component.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalPositionY(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalPositionXTranslator(gameObject.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalPositionY(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalPositionXTranslator(component.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - - [MustUseReturnValue] public static UniTask ToLocalPositionZ(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalPositionXTranslator(gameObject.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalPositionZ(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalPositionXTranslator(component.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalPositionZ(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalPositionXTranslator(gameObject.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalPositionZ(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalPositionXTranslator(component.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - - [MustUseReturnValue] public static UniTask ToGlobalPosition(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new GlobalPositionTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalPosition(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new GlobalPositionTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalPosition(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new GlobalPositionTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalPosition(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new GlobalPositionTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalPosition(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new GlobalPositionTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalPosition(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new GlobalPositionTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalPosition(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new GlobalPositionTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalPosition(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new GlobalPositionTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - - [MustUseReturnValue] public static UniTask ToGlobalPositionX(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new GlobalPositionXTranslator(gameObject.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalPositionX(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new GlobalPositionXTranslator(component.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalPositionX(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new GlobalPositionXTranslator(gameObject.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalPositionX(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new GlobalPositionXTranslator(component.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - - [MustUseReturnValue] public static UniTask ToGlobalPositionY(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new GlobalPositionXTranslator(gameObject.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalPositionY(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new GlobalPositionXTranslator(component.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalPositionY(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new GlobalPositionXTranslator(gameObject.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalPositionY(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new GlobalPositionXTranslator(component.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - - [MustUseReturnValue] public static UniTask ToGlobalPositionZ(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new GlobalPositionXTranslator(gameObject.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalPositionZ(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new GlobalPositionXTranslator(component.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalPositionZ(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new GlobalPositionXTranslator(gameObject.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalPositionZ(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new GlobalPositionXTranslator(component.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - - [MustUseReturnValue] public static UniTask ToLocalScale(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalScaleTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScale(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalScaleTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScale(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalScaleTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScale(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalScaleTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScale(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalScaleTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScale(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalScaleTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScale(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalScaleTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScale(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalScaleTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScale(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalScaleTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScale(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalScaleTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScale(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalScaleTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScale(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalScaleTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - - [MustUseReturnValue] public static UniTask ToLocalScaleX(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalScaleXTranslator(gameObject.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScaleX(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalScaleXTranslator(component.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScaleX(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalScaleXTranslator(gameObject.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScaleX(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalScaleXTranslator(component.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - - [MustUseReturnValue] public static UniTask ToLocalScaleY(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalScaleXTranslator(gameObject.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScaleY(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalScaleXTranslator(component.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScaleY(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalScaleXTranslator(gameObject.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScaleY(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalScaleXTranslator(component.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - - [MustUseReturnValue] public static UniTask ToLocalScaleZ(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalScaleXTranslator(gameObject.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScaleZ(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalScaleXTranslator(component.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScaleZ(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalScaleXTranslator(gameObject.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalScaleZ(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalScaleXTranslator(component.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - - [MustUseReturnValue] public static UniTask ToLocalRotation(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalRotationTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalRotation(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new LocalRotationTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalRotation(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalRotationTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToLocalRotation(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new LocalRotationTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalRotation(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new GlobalRotationTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalRotation(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new GlobalRotationTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalRotation(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new GlobalRotationTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToGlobalRotation(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new GlobalRotationTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + [MustUseReturnValue] + public static UniTask ToLocalPosition(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new LocalPositionTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPosition(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new LocalPositionTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPosition(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new LocalPositionTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPosition(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new LocalPositionTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPosition(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new LocalPositionTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPosition(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new LocalPositionTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPosition(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new LocalPositionTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPosition(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new LocalPositionTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPositionX(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new LocalPositionXTranslator(gameObject.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPositionX(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new LocalPositionXTranslator(component.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPositionX(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new LocalPositionXTranslator(gameObject.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPositionX(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new LocalPositionXTranslator(component.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPositionY(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new LocalPositionXTranslator(gameObject.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPositionY(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new LocalPositionXTranslator(component.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPositionY(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new LocalPositionXTranslator(gameObject.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPositionY(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new LocalPositionXTranslator(component.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPositionZ(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new LocalPositionXTranslator(gameObject.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPositionZ(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new LocalPositionXTranslator(component.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPositionZ(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new LocalPositionXTranslator(gameObject.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalPositionZ(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new LocalPositionXTranslator(component.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPosition(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new GlobalPositionTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPosition(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new GlobalPositionTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPosition(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new GlobalPositionTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPosition(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new GlobalPositionTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPosition(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new GlobalPositionTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPosition(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new GlobalPositionTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPosition(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new GlobalPositionTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPosition(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new GlobalPositionTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPositionX(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new GlobalPositionXTranslator(gameObject.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPositionX(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new GlobalPositionXTranslator(component.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPositionX(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new GlobalPositionXTranslator(gameObject.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPositionX(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new GlobalPositionXTranslator(component.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPositionY(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new GlobalPositionXTranslator(gameObject.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPositionY(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new GlobalPositionXTranslator(component.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPositionY(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new GlobalPositionXTranslator(gameObject.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPositionY(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new GlobalPositionXTranslator(component.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPositionZ(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new GlobalPositionXTranslator(gameObject.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPositionZ(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new GlobalPositionXTranslator(component.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPositionZ(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new GlobalPositionXTranslator(gameObject.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalPositionZ(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new GlobalPositionXTranslator(component.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScale(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new LocalScaleTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScale(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new LocalScaleTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScale(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new LocalScaleTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScale(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new LocalScaleTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScale(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new LocalScaleTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScale(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new LocalScaleTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScale(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new LocalScaleTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScale(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new LocalScaleTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScale(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new LocalScaleTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScale(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new LocalScaleTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScale(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new LocalScaleTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScale(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new LocalScaleTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScaleX(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new LocalScaleXTranslator(gameObject.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScaleX(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new LocalScaleXTranslator(component.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScaleX(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new LocalScaleXTranslator(gameObject.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScaleX(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new LocalScaleXTranslator(component.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScaleY(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new LocalScaleXTranslator(gameObject.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScaleY(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new LocalScaleXTranslator(component.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScaleY(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new LocalScaleXTranslator(gameObject.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScaleY(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new LocalScaleXTranslator(component.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScaleZ(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new LocalScaleXTranslator(gameObject.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScaleZ(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new LocalScaleXTranslator(component.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScaleZ(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new LocalScaleXTranslator(gameObject.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalScaleZ(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new LocalScaleXTranslator(component.transform, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalRotation(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new LocalRotationTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalRotation(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new LocalRotationTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalRotation(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new LocalRotationTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToLocalRotation(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new LocalRotationTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalRotation(this IAnimator animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.Play(animator, new GlobalRotationTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalRotation(this IAnimator animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.Play(animator, new GlobalRotationTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalRotation(this IAnimatorWithStartValue animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(gameObject); + return Anime.PlayTo(animator, new GlobalRotationTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToGlobalRotation(this IAnimatorWithStartValue animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(component); + return Anime.PlayTo(animator, new GlobalRotationTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } } public class LocalPositionTranslator : IValueTranslator, IValueTranslator diff --git a/Assets/AnimeTask/Scripts/Translator/Translator.cs b/Assets/AnimeTask/Scripts/Translator/Translator.cs new file mode 100644 index 0000000..6d7d861 --- /dev/null +++ b/Assets/AnimeTask/Scripts/Translator/Translator.cs @@ -0,0 +1,19 @@ +using System.Threading.Tasks; +using UnityEngine; + +namespace AnimeTask +{ + public static partial class TranslateTo + { + public static void CheckAlive(GameObject gameObject) + { + if (gameObject == null) throw new TaskCanceledException(); + } + + public static void CheckAlive(Component component) + { + if (component == null) throw new TaskCanceledException(); + if (component.gameObject == null) throw new TaskCanceledException(); + } + } +} \ No newline at end of file diff --git a/Assets/AnimeTask/Scripts/Translator/Translator.cs.meta b/Assets/AnimeTask/Scripts/Translator/Translator.cs.meta new file mode 100644 index 0000000..5f36ebf --- /dev/null +++ b/Assets/AnimeTask/Scripts/Translator/Translator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b6ac6a6069ca4c2ab5d60029ad88df03 +timeCreated: 1624852061 \ No newline at end of file diff --git a/Assets/AnimeTask/Scripts/Translator/UGuiTranslator.cs b/Assets/AnimeTask/Scripts/Translator/UGuiTranslator.cs index 1526fa7..cfe01f8 100644 --- a/Assets/AnimeTask/Scripts/Translator/UGuiTranslator.cs +++ b/Assets/AnimeTask/Scripts/Translator/UGuiTranslator.cs @@ -9,25 +9,96 @@ namespace AnimeTask { public static partial class TranslateTo { - [MustUseReturnValue] public static UniTask ToText(this IAnimator animator, Text text, string format, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new TextTranslator(text, format), scheduler, CancellationTokenSource.CreateLinkedTokenSource(text.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + [MustUseReturnValue] + public static UniTask ToText(this IAnimator animator, Text text, string format, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(text); + return Anime.Play(animator, new TextTranslator(text, format), scheduler, CancellationTokenSource.CreateLinkedTokenSource(text.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToColor(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(graphic); + return Anime.Play(animator, new ColorTranslator(graphic), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToColor(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(graphic); + return Anime.PlayTo(animator, new ColorTranslator(graphic), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToColorR(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(graphic); + return Anime.Play(animator, new ColorXTranslator(graphic, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToColorR(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(graphic); + return Anime.PlayTo(animator, new ColorXTranslator(graphic, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToColorG(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(graphic); + return Anime.Play(animator, new ColorXTranslator(graphic, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } + + [MustUseReturnValue] + public static UniTask ToColorG(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(graphic); + return Anime.PlayTo(animator, new ColorXTranslator(graphic, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } - [MustUseReturnValue] public static UniTask ToColor(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new ColorTranslator(graphic), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToColor(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new ColorTranslator(graphic), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + [MustUseReturnValue] + public static UniTask ToColorB(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(graphic); + return Anime.Play(animator, new ColorXTranslator(graphic, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } - [MustUseReturnValue] public static UniTask ToColorR(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new ColorXTranslator(graphic, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToColorR(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new ColorXTranslator(graphic, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + [MustUseReturnValue] + public static UniTask ToColorB(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(graphic); + return Anime.PlayTo(animator, new ColorXTranslator(graphic, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } - [MustUseReturnValue] public static UniTask ToColorG(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new ColorXTranslator(graphic, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToColorG(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new ColorXTranslator(graphic, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + [MustUseReturnValue] + public static UniTask ToColorA(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(graphic); + return Anime.Play(animator, new ColorXTranslator(graphic, 3), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } - [MustUseReturnValue] public static UniTask ToColorB(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new ColorXTranslator(graphic, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToColorB(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new ColorXTranslator(graphic, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + [MustUseReturnValue] + public static UniTask ToColorA(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(graphic); + return Anime.PlayTo(animator, new ColorXTranslator(graphic, 3), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } - [MustUseReturnValue] public static UniTask ToColorA(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new ColorXTranslator(graphic, 3), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToColorA(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new ColorXTranslator(graphic, 3), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + [MustUseReturnValue] + public static UniTask ToFillAmount(this IAnimator animator, Image image, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(image); + return Anime.Play(animator, new FillAmountTranslator(image), scheduler, CancellationTokenSource.CreateLinkedTokenSource(image.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } - [MustUseReturnValue] public static UniTask ToFillAmount(this IAnimator animator, Image image, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.Play(animator, new FillAmountTranslator(image), scheduler, CancellationTokenSource.CreateLinkedTokenSource(image.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); - [MustUseReturnValue] public static UniTask ToFillAmount(this IAnimatorWithStartValue animator, Image image, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) => Anime.PlayTo(animator, new FillAmountTranslator(image), scheduler, CancellationTokenSource.CreateLinkedTokenSource(image.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + [MustUseReturnValue] + public static UniTask ToFillAmount(this IAnimatorWithStartValue animator, Image image, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) + { + CheckAlive(image); + return Anime.PlayTo(animator, new FillAmountTranslator(image), scheduler, CancellationTokenSource.CreateLinkedTokenSource(image.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); + } } public class TextTranslator : ITranslator