├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── other.md ├── .gitignore ├── AnimeTask.sln.DotSettings ├── Assets ├── AnimeTask.meta ├── AnimeTask │ ├── AnimeTask.asmdef │ ├── AnimeTask.asmdef.meta │ ├── LICENSE.md │ ├── LICENSE.md.meta │ ├── README.md │ ├── README.md.meta │ ├── Scripts.meta │ ├── Scripts │ │ ├── Animator.meta │ │ ├── Animator │ │ │ ├── ConcatAnimator.cs │ │ │ ├── ConcatAnimator.cs.meta │ │ │ ├── ConvertAnimator.cs │ │ │ ├── ConvertAnimator.cs.meta │ │ │ ├── DebugLogAnimator.cs │ │ │ ├── DebugLogAnimator.cs.meta │ │ │ ├── DelayAnimator.cs │ │ │ └── DelayAnimator.cs.meta │ │ ├── Anime.cs │ │ ├── Anime.cs.meta │ │ ├── Easing.meta │ │ ├── Easing │ │ │ ├── Easing.cs │ │ │ ├── Easing.cs.meta │ │ │ ├── EasingAnimator.cs │ │ │ ├── EasingAnimator.cs.meta │ │ │ ├── IEasing.cs │ │ │ └── IEasing.cs.meta │ │ ├── Extension.cs │ │ ├── Extension.cs.meta │ │ ├── Extensions.meta │ │ ├── Extensions │ │ │ ├── AnimeTask.Extensions.asmdef │ │ │ ├── AnimeTask.Extensions.asmdef.meta │ │ │ ├── UniRxExtensions.cs │ │ │ └── UniRxExtensions.cs.meta │ │ ├── IAnimator.cs │ │ ├── IAnimator.cs.meta │ │ ├── IScheduler.cs │ │ ├── IScheduler.cs.meta │ │ ├── ITranslator.cs │ │ ├── ITranslator.cs.meta │ │ ├── Moving.meta │ │ ├── Moving │ │ │ ├── AnimationCurveAnimator.cs │ │ │ ├── AnimationCurveAnimator.cs.meta │ │ │ ├── GravityAnimator.cs │ │ │ ├── GravityAnimator.cs.meta │ │ │ ├── LinearAnimator.cs │ │ │ └── LinearAnimator.cs.meta │ │ ├── Scheduler.meta │ │ ├── Scheduler │ │ │ ├── TimeScheduler.cs │ │ │ ├── TimeScheduler.cs.meta │ │ │ ├── UnscaledTimeScheduler.cs │ │ │ └── UnscaledTimeScheduler.cs.meta │ │ ├── Translator.meta │ │ └── Translator │ │ │ ├── ActionTranslator.cs │ │ │ ├── ActionTranslator.cs.meta │ │ │ ├── BindTranslator.cs │ │ │ ├── BindTranslator.cs.meta │ │ │ ├── MaterialTranslator.cs │ │ │ ├── MaterialTranslator.cs.meta │ │ │ ├── NoneTranslator.cs │ │ │ ├── NoneTranslator.cs.meta │ │ │ ├── ProgressTranslator.cs │ │ │ ├── ProgressTranslator.cs.meta │ │ │ ├── ReactivePropertyTranslator.cs │ │ │ ├── ReactivePropertyTranslator.cs.meta │ │ │ ├── RectTransformTranslator.cs │ │ │ ├── RectTransformTranslator.cs.meta │ │ │ ├── TransformTranslator.cs │ │ │ ├── TransformTranslator.cs.meta │ │ │ ├── Translator.cs │ │ │ ├── Translator.cs.meta │ │ │ ├── UGuiTranslator.cs │ │ │ └── UGuiTranslator.cs.meta │ ├── package.json │ └── package.json.meta ├── Editor.meta ├── Editor │ ├── PackageExporter.cs │ └── PackageExporter.cs.meta ├── Sample.meta └── Sample │ ├── Sample.cs │ ├── Sample.cs.meta │ ├── Sample.unity │ ├── Sample.unity.meta │ ├── SampleMenu.cs │ ├── SampleMenu.cs.meta │ ├── SampleUtil.cs │ └── SampleUtil.cs.meta ├── LICENSE ├── Packages ├── manifest.json └── packages-lock.json ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── PackageManagerSettings.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityConnectSettings.asset ├── VFXManager.asset ├── VersionControlSettings.asset └── XRSettings.asset ├── README.md └── README_ja.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [kyubuns] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: ['https://www.buymeacoffee.com/kyubuns'] 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: kyubuns 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Environment** 24 | Version: x.x.x or hash 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/other.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Other 3 | about: If you want to write something other than Bug Report, please go to Discussion 4 | page. 5 | title: '' 6 | labels: '' 7 | assignees: '' 8 | 9 | --- 10 | 11 | If you want to write something other than Bug Report, please go to Discussion page. 12 | https://github.com/kyubuns/AnimeTask/discussions 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | [Bb]uilds/ 6 | [Ll]ogs/ 7 | [Uu]ser[Ss]ettings/ 8 | Assets/AssetStoreTools* 9 | 10 | # Visual Studio cache directory 11 | .vs/ 12 | 13 | # Autogenerated VS/MD/Consulo solution and project files 14 | ExportedObj/ 15 | .consulo/ 16 | *.csproj 17 | *.unityproj 18 | *.sln 19 | *.suo 20 | *.tmp 21 | *.user 22 | *.userprefs 23 | *.pidb 24 | *.booproj 25 | *.svd 26 | *.pdb 27 | *.opendb 28 | 29 | # Unity3D generated meta files 30 | *.pidb.meta 31 | *.pdb.meta 32 | 33 | # Unity3D Generated File On Crash Reports 34 | sysinfo.txt 35 | 36 | # Builds 37 | *.apk 38 | *.unitypackage 39 | 40 | Recordings 41 | .idea 42 | -------------------------------------------------------------------------------- /AnimeTask.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | True 3 | True -------------------------------------------------------------------------------- /Assets/AnimeTask.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18deef837e78c416ba579b2dc62c0585 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/AnimeTask/AnimeTask.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "AnimeTask", 3 | "references": [ 4 | "GUID:f51ebe6a0ceec4240a699833d6309b23", 5 | "GUID:560b04d1a97f54a4e82edc0cbbb69285" 6 | ], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": true, 13 | "defineConstraints": [], 14 | "versionDefines": [ 15 | { 16 | "name": "com.neuecc.unirx", 17 | "expression": "", 18 | "define": "ANIMETASK_UNIRX_SUPPORT" 19 | }, 20 | { 21 | "name": "com.unity.ugui", 22 | "expression": "", 23 | "define": "ANIMETASK_UGUI_SUPPORT" 24 | } 25 | ], 26 | "noEngineReferences": false 27 | } -------------------------------------------------------------------------------- /Assets/AnimeTask/AnimeTask.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a4cffb770ce347a39cea41a326324ec 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/AnimeTask/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 kyubuns 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Assets/AnimeTask/LICENSE.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b8c3f7af9f72541fe8136bf93587594a 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/AnimeTask/README.md: -------------------------------------------------------------------------------- 1 | # AnimeTask 2 | 3 | ## How to use 4 | 5 | Please see github page. 6 | https://github.com/kyubuns/AnimeTask/blob/main/README.md 7 | -------------------------------------------------------------------------------- /Assets/AnimeTask/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9c12ba228894d4d3882ba92976854af8 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e45691338fdcd422da169b7d5221e714 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Animator.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff32789e8eeb44e9a807d96aa9524352 3 | timeCreated: 1593318798 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Animator/ConcatAnimator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace AnimeTask 5 | { 6 | public static partial class Animator 7 | { 8 | public static ConcatAnimator Concat(this IAnimator animator1, params IConcatableAnimator[] animator2) 9 | { 10 | return new ConcatAnimator(animator1, animator2); 11 | } 12 | 13 | public static ConcatAnimatorWithStartValue Concat(this IAnimatorWithStartValue animator1, params IConcatableAnimator[] animator2) 14 | { 15 | return new ConcatAnimatorWithStartValue(animator1, animator2); 16 | } 17 | } 18 | 19 | public class ConcatAnimator : IAnimator 20 | { 21 | private readonly List> animators; 22 | private T currentValue; 23 | private IAnimator currentAnimator; 24 | private float usedTime; 25 | 26 | public ConcatAnimator(IAnimator animator1, IEnumerable> animator2) 27 | { 28 | animators = new List>(animator2); 29 | 30 | currentAnimator = animator1; 31 | } 32 | 33 | public (T, float) Update(float time) 34 | { 35 | while (true) 36 | { 37 | var f = time - usedTime; 38 | if (currentAnimator == null) return (currentValue, usedTime); 39 | var (v, used) = currentAnimator.Update(f); 40 | 41 | if (used < f) 42 | { 43 | currentValue = v; 44 | usedTime += used; 45 | GetNext(); 46 | continue; 47 | } 48 | 49 | return (v, time); 50 | } 51 | } 52 | 53 | private void GetNext() 54 | { 55 | if (animators.Count == 0) 56 | { 57 | currentAnimator = null; 58 | return; 59 | } 60 | var n = animators[0]; 61 | animators.RemoveAt(0); 62 | 63 | if (n is IAnimator animator) currentAnimator = animator; 64 | else if (n is IAnimatorWithStartValue animatorWithStartValue) currentAnimator = animatorWithStartValue.Start(currentValue); 65 | else throw new NotSupportedException($"{n} is not supported"); 66 | } 67 | } 68 | 69 | public class ConcatAnimatorWithStartValue : IAnimatorWithStartValue 70 | { 71 | private readonly IAnimatorWithStartValue animator1; 72 | private readonly IConcatableAnimator[] animator2; 73 | private IAnimator playingAnimator; 74 | 75 | public ConcatAnimatorWithStartValue(IAnimatorWithStartValue animator1, IConcatableAnimator[] animator2) 76 | { 77 | this.animator1 = animator1; 78 | this.animator2 = animator2; 79 | } 80 | 81 | public IAnimator Start(T startValue) 82 | { 83 | return new ConcatAnimator(animator1.Start(startValue), animator2); 84 | } 85 | } 86 | } -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Animator/ConcatAnimator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3741fb3235194be3b4804682f8a441ab 3 | timeCreated: 1609898368 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Animator/ConvertAnimator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AnimeTask 4 | { 5 | public static partial class Animator 6 | { 7 | public static ConvertAnimator Convert(this IAnimator animator, Func func) 8 | { 9 | return new ConvertAnimator(animator, func); 10 | } 11 | 12 | public static ConvertAnimatorWithStartValue Convert(this IAnimatorWithStartValue animator, Func func) 13 | { 14 | return new ConvertAnimatorWithStartValue(animator, func); 15 | } 16 | } 17 | 18 | public class ConvertAnimator : IAnimator 19 | { 20 | private readonly IAnimator animator; 21 | private readonly Func func; 22 | 23 | public ConvertAnimator(IAnimator animator, Func func) 24 | { 25 | this.animator = animator; 26 | this.func = func; 27 | } 28 | 29 | public (T2, float) Update(float time) 30 | { 31 | var (item1, item2) = animator.Update(time); 32 | return (func(item1), item2); 33 | } 34 | } 35 | 36 | public class ConvertAnimatorWithStartValue : IAnimatorWithStartValue 37 | { 38 | private readonly IAnimatorWithStartValue animator; 39 | private readonly Func func; 40 | 41 | public ConvertAnimatorWithStartValue(IAnimatorWithStartValue animator, Func func) 42 | { 43 | this.animator = animator; 44 | this.func = func; 45 | } 46 | 47 | public IAnimator Start(T startValue) 48 | { 49 | return new ConvertAnimator(animator.Start(startValue), func); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Animator/ConvertAnimator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b519fa83ec64ca39726907c92182587 3 | timeCreated: 1593327249 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Animator/DebugLogAnimator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace AnimeTask 5 | { 6 | public static partial class Animator 7 | { 8 | public static DebugLogAnimator DebugLog(this IAnimator animator) 9 | { 10 | return new DebugLogAnimator(animator); 11 | } 12 | 13 | public static DebugLogAnimatorWithStartValue DebugLog(this IAnimatorWithStartValue animator) 14 | { 15 | return new DebugLogAnimatorWithStartValue(animator); 16 | } 17 | } 18 | 19 | public class DebugLogAnimator : IAnimator 20 | { 21 | private readonly IAnimator animator; 22 | 23 | public DebugLogAnimator(IAnimator animator) 24 | { 25 | this.animator = animator; 26 | } 27 | 28 | public (T, float) Update(float time) 29 | { 30 | var v = animator.Update(time); 31 | Debug.Log($"{time:0.00}: {v.Item1}"); 32 | return v; 33 | } 34 | } 35 | 36 | public class DebugLogAnimatorWithStartValue : IAnimatorWithStartValue 37 | { 38 | private readonly IAnimatorWithStartValue animator; 39 | 40 | public DebugLogAnimatorWithStartValue(IAnimatorWithStartValue animator) 41 | { 42 | this.animator = animator; 43 | } 44 | 45 | public IAnimator Start(T startValue) 46 | { 47 | return new DebugLogAnimator(animator.Start(startValue)); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Animator/DebugLogAnimator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a723e44d42234834ae96b93feec58a18 3 | timeCreated: 1609901387 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Animator/DelayAnimator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace AnimeTask 5 | { 6 | public static partial class Animator 7 | { 8 | public static DelayAnimator Delay(T startValue, float duration) => new DelayAnimator(startValue, duration); 9 | public static DelayAnimatorWithStartValue Delay(float duration) => new DelayAnimatorWithStartValue(duration); 10 | 11 | public static ConcatAnimator Delay(this IAnimator animator, float duration) => Concat(animator, Delay(duration)); 12 | public static ConcatAnimatorWithStartValue Delay(this IAnimatorWithStartValue animator, float duration) => Concat(animator, Delay(duration)); 13 | 14 | public static RelativeDelayAnimatorWithStartValue RelativeDelay(this IAnimator baseAnimator, float duration) => new RelativeDelayAnimatorWithStartValue(baseAnimator, duration); 15 | public static RelativeDelayAnimator RelativeDelay(this IAnimator baseAnimator, T1 startValue, float duration) => new RelativeDelayAnimator(startValue, baseAnimator, duration); 16 | public static RelativeDelayAnimatorWithStartValue RelativeDelay(this IAnimatorWithStartValue baseAnimator, float duration) => new RelativeDelayAnimatorWithStartValue(baseAnimator, duration); 17 | } 18 | 19 | public class DelayAnimator : IAnimator 20 | { 21 | private readonly T start; 22 | private readonly float duration; 23 | 24 | public DelayAnimator(T start, float duration) 25 | { 26 | this.start = start; 27 | this.duration = duration; 28 | } 29 | 30 | public (T, float) Update(float time) 31 | { 32 | return (start, Mathf.Min(time, duration)); 33 | } 34 | } 35 | 36 | public class DelayAnimatorWithStartValue : IAnimatorWithStartValue 37 | { 38 | private readonly float duration; 39 | 40 | public DelayAnimatorWithStartValue(float duration) 41 | { 42 | this.duration = duration; 43 | } 44 | 45 | public IAnimator Start(T startValue) 46 | { 47 | return new DelayAnimator(startValue, duration); 48 | } 49 | } 50 | 51 | public class RelativeDelayAnimator : IAnimator 52 | { 53 | private readonly T1 start; 54 | private readonly IAnimator baseAnimator; 55 | private readonly float duration; 56 | 57 | public RelativeDelayAnimator(T1 start, IAnimator baseAnimator, float duration) 58 | { 59 | this.start = start; 60 | this.baseAnimator = baseAnimator; 61 | this.duration = duration; 62 | } 63 | 64 | public (T1, float) Update(float time) 65 | { 66 | var f = time - duration; 67 | var (_, used) = baseAnimator.Update(f); 68 | if (used < f) 69 | { 70 | return (start, time - (f - used)); 71 | } 72 | 73 | return (start, time); 74 | } 75 | } 76 | 77 | public class RelativeDelayAnimatorWithStartValue : IAnimatorWithStartValue 78 | { 79 | private readonly IAnimator baseAnimator; 80 | private readonly float duration; 81 | 82 | public RelativeDelayAnimatorWithStartValue(IAnimator baseAnimator, float duration) 83 | { 84 | this.baseAnimator = baseAnimator; 85 | this.duration = duration; 86 | } 87 | 88 | public RelativeDelayAnimatorWithStartValue(IAnimatorWithStartValue baseAnimator, float duration) 89 | { 90 | this.baseAnimator = baseAnimator.Start(default); 91 | this.duration = duration; 92 | } 93 | 94 | public IAnimator Start(T1 startValue) 95 | { 96 | return new RelativeDelayAnimator(startValue, baseAnimator, duration); 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Animator/DelayAnimator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4acb9a0cbf2d45758af69dd21e00fb53 3 | timeCreated: 1593318808 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Anime.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using Cysharp.Threading.Tasks; 4 | using JetBrains.Annotations; 5 | using UnityEngine; 6 | 7 | namespace AnimeTask 8 | { 9 | public static class Anime 10 | { 11 | public static IScheduler DefaultScheduler { get; set; } = new TimeScheduler(); 12 | 13 | [MustUseReturnValue] 14 | public static UniTask Play(IAnimator animator, ITranslator translator, IScheduler scheduler = default, CancellationToken cancellationToken = default, SkipToken skipToken = default) 15 | { 16 | return PlayInternal(animator, translator, scheduler, cancellationToken, skipToken); 17 | } 18 | 19 | [MustUseReturnValue] 20 | public static UniTask PlayTo(IAnimatorWithStartValue animatorWithStartValue, IValueTranslator translator, IScheduler scheduler = default, CancellationToken cancellationToken = default, SkipToken skipToken = default) 21 | { 22 | var animator = animatorWithStartValue.Start(translator.Current); 23 | return PlayInternal(animator, translator, scheduler, cancellationToken, skipToken); 24 | } 25 | 26 | private static async UniTask PlayInternal(IAnimator animator, ITranslator translator, IScheduler scheduler, CancellationToken cancellationToken, SkipToken skipToken) 27 | { 28 | if (scheduler == default) scheduler = DefaultScheduler; 29 | 30 | var time = 0f; 31 | var playState = Application.isPlaying; 32 | while (!cancellationToken.IsCancellationRequested && !skipToken.IsSkipRequested && translator.Alive && playState == Application.isPlaying) 33 | { 34 | var (t, used) = animator.Update(time); 35 | translator.Update(t); 36 | if (used < time) break; 37 | await UniTask.NextFrame(scheduler.UpdateTiming, cancellationToken); 38 | time += scheduler.DeltaTime; 39 | } 40 | 41 | if (!translator.Alive) throw new OperationCanceledException("!translator.Alive"); 42 | cancellationToken.ThrowIfCancellationRequested(); 43 | 44 | if (skipToken.IsSkipRequested) 45 | { 46 | var (t, _) = animator.Update(float.MaxValue); 47 | translator.Update(t); 48 | } 49 | } 50 | 51 | [MustUseReturnValue] 52 | public static UniTask Delay(float duration, IScheduler scheduler = default, CancellationToken cancellationToken = default, SkipToken skipToken = default) 53 | { 54 | return DelayInternal(duration, scheduler, cancellationToken, skipToken); 55 | } 56 | 57 | private static async UniTask DelayInternal(float duration, IScheduler scheduler, CancellationToken cancellationToken, SkipToken skipToken) 58 | { 59 | if (scheduler == default) scheduler = DefaultScheduler; 60 | 61 | var time = 0f; 62 | var playState = Application.isPlaying; 63 | while (!cancellationToken.IsCancellationRequested && !skipToken.IsSkipRequested && playState == Application.isPlaying) 64 | { 65 | if (duration < time) break; 66 | await UniTask.NextFrame(scheduler.UpdateTiming, cancellationToken); 67 | time += scheduler.DeltaTime; 68 | } 69 | cancellationToken.ThrowIfCancellationRequested(); 70 | } 71 | } 72 | 73 | public struct SkipToken 74 | { 75 | private readonly SkipTokenSource source; 76 | private readonly bool skipped; 77 | 78 | public SkipToken(bool skipped) 79 | { 80 | source = null; 81 | this.skipped = skipped; 82 | } 83 | 84 | public SkipToken(SkipTokenSource source) 85 | { 86 | this.source = source; 87 | skipped = false; 88 | } 89 | 90 | public bool IsSkipRequested => source?.IsSkipRequested ?? skipped; 91 | 92 | public static SkipToken None => new SkipToken(false); 93 | } 94 | 95 | public class SkipTokenSource : IDisposable 96 | { 97 | public SkipTokenSource() 98 | { 99 | IsSkipRequested = false; 100 | Token = new SkipToken(this); 101 | } 102 | 103 | public void Skip() 104 | { 105 | IsSkipRequested = true; 106 | } 107 | 108 | public bool IsSkipRequested { get; set; } 109 | 110 | public SkipToken Token { get; } 111 | 112 | public void Dispose() 113 | { 114 | Skip(); 115 | } 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Anime.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7653bda3087f43e38ce285b6f45a2e1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Easing.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b0969bb4a46e460a8aae3f3c7d2be768 3 | timeCreated: 1538308425 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Easing/Easing.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace AnimeTask 4 | { 5 | public class Linear : IEasing 6 | { 7 | public float Function(float v) 8 | { 9 | return Calc(v); 10 | } 11 | 12 | public static float Calc(float v) 13 | { 14 | return v; 15 | } 16 | } 17 | 18 | public class InBack : IEasing 19 | { 20 | public float Function(float v) 21 | { 22 | return Calc(v); 23 | } 24 | 25 | public static float Calc(float v) 26 | { 27 | return 2.70158f * v * v * v - 1.70158f * v * v; 28 | } 29 | } 30 | 31 | public class OutBack : IEasing 32 | { 33 | public float Function(float v) 34 | { 35 | return Calc(v); 36 | } 37 | 38 | public static float Calc(float v) 39 | { 40 | return 1f + 2.70158f * Mathf.Pow(v - 1f, 3f) + 1.70158f * Mathf.Pow(v - 1f, 2f); 41 | } 42 | } 43 | 44 | public class InOutBack : IEasing 45 | { 46 | public float Function(float v) 47 | { 48 | return Calc(v); 49 | } 50 | 51 | public static float Calc(float v) 52 | { 53 | const float c1 = 1.70158f; 54 | const float c2 = c1 * 1.525f; 55 | 56 | if (v < 0.5f) 57 | { 58 | return (Mathf.Pow(2f * v, 2f) * ((c2 + 1f) * 2f * v - c2)) / 2f; 59 | } 60 | else 61 | { 62 | return (Mathf.Pow(2f * v - 2f, 2f) * ((c2 + 1f) * (v * 2f - 2f) + c2) + 2f) / 2f; 63 | } 64 | } 65 | } 66 | 67 | public class InBounce : IEasing 68 | { 69 | public float Function(float v) 70 | { 71 | return Calc(v); 72 | } 73 | 74 | public static float Calc(float v) 75 | { 76 | return Bounce(v); 77 | } 78 | 79 | public static float Bounce(float v) 80 | { 81 | return 1 - OutBounce.Bounce(1 - v); 82 | } 83 | } 84 | 85 | public class OutBounce : IEasing 86 | { 87 | public float Function(float v) 88 | { 89 | return Calc(v); 90 | } 91 | 92 | public static float Calc(float v) 93 | { 94 | return Bounce(v); 95 | } 96 | 97 | public static float Bounce(float v) 98 | { 99 | if (v < 1 / 2.75f) 100 | { 101 | return 7.5625f * v * v; 102 | } 103 | else if (v < 2 / 2.75f) 104 | { 105 | var f = v - 0.54545f; 106 | return 7.5625f * f * f + 0.75f; 107 | } 108 | else if (v < 2.5 / 2.75f) 109 | { 110 | var f = v - 0.81818f; 111 | return 7.5625f * f * f + 0.9375f; 112 | } 113 | else 114 | { 115 | var f = v - 0.95454f; 116 | return 7.5625f * f * f + 0.984375f; 117 | } 118 | } 119 | } 120 | 121 | public class InOutBounce : IEasing 122 | { 123 | public float Function(float v) 124 | { 125 | return Calc(v); 126 | } 127 | 128 | public static float Calc(float v) 129 | { 130 | if (v < 0.5f) 131 | { 132 | return 0.5f * InBounce.Bounce(v * 2f); 133 | } 134 | else 135 | { 136 | return 0.5f * OutBounce.Bounce(v * 2f - 1f) + 0.5f; 137 | } 138 | } 139 | } 140 | 141 | public class InCirc : IEasing 142 | { 143 | public float Function(float v) 144 | { 145 | return Calc(v); 146 | } 147 | 148 | public static float Calc(float v) 149 | { 150 | return 1f - Mathf.Sqrt(1f - (v * v)); 151 | } 152 | } 153 | 154 | public class OutCirc : IEasing 155 | { 156 | public float Function(float v) 157 | { 158 | return Calc(v); 159 | } 160 | 161 | public static float Calc(float v) 162 | { 163 | return Mathf.Sqrt((2f - v) * v); 164 | } 165 | } 166 | 167 | public class InOutCirc : IEasing 168 | { 169 | public float Function(float v) 170 | { 171 | return Calc(v); 172 | } 173 | 174 | public static float Calc(float v) 175 | { 176 | if (v < 0.5f) 177 | { 178 | return 0.5f * (1 - Mathf.Sqrt(1f - 4f * (v * v))); 179 | } 180 | else 181 | { 182 | return 0.5f * (Mathf.Sqrt(-((2f * v) - 3f) * ((2f * v) - 1f)) + 1f); 183 | } 184 | } 185 | } 186 | 187 | public class InCubic : IEasing 188 | { 189 | public float Function(float v) 190 | { 191 | return Calc(v); 192 | } 193 | 194 | public static float Calc(float v) 195 | { 196 | return v * v * v; 197 | } 198 | } 199 | 200 | public class OutCubic : IEasing 201 | { 202 | public float Function(float v) 203 | { 204 | return Calc(v); 205 | } 206 | 207 | public static float Calc(float v) 208 | { 209 | var f = (v - 1f); 210 | return f * f * f + 1f; 211 | } 212 | } 213 | 214 | public class InOutCubic : IEasing 215 | { 216 | public float Function(float v) 217 | { 218 | return Calc(v); 219 | } 220 | 221 | public static float Calc(float v) 222 | { 223 | if (v < 0.5f) 224 | { 225 | return 4f * v * v * v; 226 | } 227 | else 228 | { 229 | var f = ((2f * v) - 2f); 230 | return 0.5f * f * f * f + 1f; 231 | } 232 | } 233 | } 234 | 235 | public class InElastic : IEasing 236 | { 237 | public float Function(float v) 238 | { 239 | return Calc(v); 240 | } 241 | 242 | public static float Calc(float v) 243 | { 244 | if (Mathf.Approximately(0.0f, v) || Mathf.Approximately(1.0f, v)) return v; 245 | return Mathf.Sin((v * 10f - 10.75f) * (2f * Mathf.PI / 3f)) * -Mathf.Pow(2f, 10f * (v - 1f)); 246 | } 247 | } 248 | 249 | public class OutElastic : IEasing 250 | { 251 | public float Function(float v) 252 | { 253 | return Calc(v); 254 | } 255 | 256 | public static float Calc(float v) 257 | { 258 | if (Mathf.Approximately(0.0f, v) || Mathf.Approximately(1.0f, v)) return v; 259 | return Mathf.Sin((v * 10f - 0.75f) * (2f * Mathf.PI / 3f)) * Mathf.Pow(2f, -10f * v) + 1f; 260 | } 261 | } 262 | 263 | public class InOutElastic : IEasing 264 | { 265 | public float Function(float v) 266 | { 267 | return Calc(v); 268 | } 269 | 270 | public static float Calc(float v) 271 | { 272 | if (Mathf.Approximately(0.0f, v) || Mathf.Approximately(1.0f, v)) return v; 273 | 274 | if (v < 0.5f) 275 | { 276 | return -Mathf.Pow(2f, 20f * v - 10f) * Mathf.Sin((20f * v - 11.125f) * (2f * Mathf.PI) / 4.5f) / 2f; 277 | } 278 | else 279 | { 280 | return Mathf.Pow(2f, -20f * v + 10f) * Mathf.Sin((20f * v - 11.125f) * (2f * Mathf.PI) / 4.5f) / 2f + 1f; 281 | } 282 | } 283 | } 284 | 285 | public class InExpo : IEasing 286 | { 287 | public float Function(float v) 288 | { 289 | return Calc(v); 290 | } 291 | 292 | public static float Calc(float v) 293 | { 294 | return Mathf.Approximately(0.0f, v) ? v : Mathf.Pow(2f, 10f * (v - 1f)); 295 | } 296 | } 297 | 298 | public class OutExpo : IEasing 299 | { 300 | public float Function(float v) 301 | { 302 | return Calc(v); 303 | } 304 | 305 | public static float Calc(float v) 306 | { 307 | return Mathf.Approximately(1.0f, v) ? v : 1f - Mathf.Pow(2f, -10f * v); 308 | } 309 | } 310 | 311 | public class InOutExpo : IEasing 312 | { 313 | public float Function(float v) 314 | { 315 | return Calc(v); 316 | } 317 | 318 | public static float Calc(float v) 319 | { 320 | if (Mathf.Approximately(0.0f, v) || Mathf.Approximately(1.0f, v)) return v; 321 | 322 | if (v < 0.5f) 323 | { 324 | return 0.5f * Mathf.Pow(2f, (20f * v) - 10f); 325 | } 326 | else 327 | { 328 | return -0.5f * Mathf.Pow(2f, (-20f * v) + 10f) + 1f; 329 | } 330 | } 331 | } 332 | 333 | public class InQuad : IEasing 334 | { 335 | public float Function(float v) 336 | { 337 | return Calc(v); 338 | } 339 | 340 | public static float Calc(float v) 341 | { 342 | return v * v; 343 | } 344 | } 345 | 346 | public class OutQuad : IEasing 347 | { 348 | public float Function(float v) 349 | { 350 | return Calc(v); 351 | } 352 | 353 | public static float Calc(float v) 354 | { 355 | return -(v * (v - 2f)); 356 | } 357 | } 358 | 359 | public class InOutQuad : IEasing 360 | { 361 | public float Function(float v) 362 | { 363 | return Calc(v); 364 | } 365 | 366 | public static float Calc(float v) 367 | { 368 | if (v < 0.5f) 369 | { 370 | return 2f * v * v; 371 | } 372 | else 373 | { 374 | return -2f * v * v + 4f * v - 1f; 375 | } 376 | } 377 | } 378 | 379 | public class InQuart : IEasing 380 | { 381 | public float Function(float v) 382 | { 383 | return Calc(v); 384 | } 385 | 386 | public static float Calc(float v) 387 | { 388 | return v * v * v * v; 389 | } 390 | } 391 | 392 | public class OutQuart : IEasing 393 | { 394 | public float Function(float v) 395 | { 396 | return Calc(v); 397 | } 398 | 399 | public static float Calc(float v) 400 | { 401 | var f = (v - 1f); 402 | return f * f * f * (1f - v) + 1f; 403 | } 404 | } 405 | 406 | public class InOutQuart : IEasing 407 | { 408 | public float Function(float v) 409 | { 410 | return Calc(v); 411 | } 412 | 413 | public static float Calc(float v) 414 | { 415 | if (v < 0.5f) 416 | { 417 | return 8f * v * v * v * v; 418 | } 419 | else 420 | { 421 | var f = (v - 1f); 422 | return 1f - 8f * f * f * f * f; 423 | } 424 | } 425 | } 426 | 427 | public class InQuint : IEasing 428 | { 429 | public float Function(float v) 430 | { 431 | return Calc(v); 432 | } 433 | 434 | public static float Calc(float v) 435 | { 436 | return v * v * v * v * v; 437 | } 438 | } 439 | 440 | public class OutQuint : IEasing 441 | { 442 | public float Function(float v) 443 | { 444 | return Calc(v); 445 | } 446 | 447 | public static float Calc(float v) 448 | { 449 | var f = (v - 1f); 450 | return f * f * f * f * f + 1f; 451 | } 452 | } 453 | 454 | public class InOutQuint : IEasing 455 | { 456 | public float Function(float v) 457 | { 458 | return Calc(v); 459 | } 460 | 461 | public static float Calc(float v) 462 | { 463 | if (v < 0.5f) 464 | { 465 | return 16f * v * v * v * v * v; 466 | } 467 | else 468 | { 469 | var f = ((2f * v) - 2f); 470 | return 0.5f * f * f * f * f * f + 1f; 471 | } 472 | } 473 | } 474 | 475 | public class InSine : IEasing 476 | { 477 | public float Function(float v) 478 | { 479 | return Calc(v); 480 | } 481 | 482 | public static float Calc(float v) 483 | { 484 | return Mathf.Sin((v - 1f) * (Mathf.PI / 2f)) + 1f; 485 | } 486 | } 487 | 488 | public class OutSine : IEasing 489 | { 490 | public float Function(float v) 491 | { 492 | return Calc(v); 493 | } 494 | 495 | public static float Calc(float v) 496 | { 497 | return Mathf.Sin(v * (Mathf.PI / 2f)); 498 | } 499 | } 500 | 501 | public class InOutSine : IEasing 502 | { 503 | public float Function(float v) 504 | { 505 | return Calc(v); 506 | } 507 | 508 | public static float Calc(float v) 509 | { 510 | return 0.5f * (1f - Mathf.Cos(v * Mathf.PI)); 511 | } 512 | } 513 | } 514 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Easing/Easing.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b7c6977777948ee957f6e1e5995de21 3 | timeCreated: 1538308455 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Easing/EasingAnimator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace AnimeTask 5 | { 6 | public static class Easing 7 | { 8 | public static Vector1EasingAnimator Create(float duration) where T : IEasing, new() 9 | { 10 | return new Vector1EasingAnimator(new T(), 0f, 1f, duration); 11 | } 12 | 13 | public static Vector1EasingAnimator Create(float start, float end, float duration) where T : IEasing, new() 14 | { 15 | return new Vector1EasingAnimator(new T(), start, end, duration); 16 | } 17 | 18 | public static Vector1EasingAnimator Create(float start, float end, Func duration) where T : IEasing, new() 19 | { 20 | return new Vector1EasingAnimator(new T(), start, end, duration); 21 | } 22 | 23 | public static Vector1EasingAnimatorTo Create(float to, float duration) where T : IEasing, new() 24 | { 25 | return new Vector1EasingAnimatorTo(new T(), to, duration); 26 | } 27 | 28 | public static Vector1EasingAnimatorToCalcDuration Create(float to, Func duration) where T : IEasing, new() 29 | { 30 | return new Vector1EasingAnimatorToCalcDuration(new T(), to, duration); 31 | } 32 | 33 | public static Vector2EasingAnimator Create(Vector2 start, Vector2 end, float duration) where T : IEasing, new() 34 | { 35 | return new Vector2EasingAnimator(new T(), start, end, duration); 36 | } 37 | 38 | public static Vector2EasingAnimator Create(Vector2 start, Vector2 end, Func duration) where T : IEasing, new() 39 | { 40 | return new Vector2EasingAnimator(new T(), start, end, duration); 41 | } 42 | 43 | public static Vector2EasingAnimatorTo Create(Vector2 to, float duration) where T : IEasing, new() 44 | { 45 | return new Vector2EasingAnimatorTo(new T(), to, duration); 46 | } 47 | 48 | public static Vector2EasingAnimatorToCalcDuration Create(Vector2 to, Func duration) where T : IEasing, new() 49 | { 50 | return new Vector2EasingAnimatorToCalcDuration(new T(), to, duration); 51 | } 52 | 53 | public static Vector3EasingAnimator Create(Vector3 start, Vector3 end, float duration) where T : IEasing, new() 54 | { 55 | return new Vector3EasingAnimator(new T(), start, end, duration); 56 | } 57 | 58 | public static Vector3EasingAnimator Create(Vector3 start, Vector3 end, Func duration) where T : IEasing, new() 59 | { 60 | return new Vector3EasingAnimator(new T(), start, end, duration); 61 | } 62 | 63 | public static Vector3EasingAnimatorTo Create(Vector3 to, float duration) where T : IEasing, new() 64 | { 65 | return new Vector3EasingAnimatorTo(new T(), to, duration); 66 | } 67 | 68 | public static Vector3EasingAnimatorToCalcDuration Create(Vector3 to, Func duration) where T : IEasing, new() 69 | { 70 | return new Vector3EasingAnimatorToCalcDuration(new T(), to, duration); 71 | } 72 | 73 | public static Vector4EasingAnimator Create(Vector4 start, Vector4 end, float duration) where T : IEasing, new() 74 | { 75 | return new Vector4EasingAnimator(new T(), start, end, duration); 76 | } 77 | 78 | public static Vector4EasingAnimator Create(Vector4 start, Vector4 end, Func duration) where T : IEasing, new() 79 | { 80 | return new Vector4EasingAnimator(new T(), start, end, duration); 81 | } 82 | 83 | public static Vector4EasingAnimatorTo Create(Vector4 to, float duration) where T : IEasing, new() 84 | { 85 | return new Vector4EasingAnimatorTo(new T(), to, duration); 86 | } 87 | 88 | public static Vector4EasingAnimatorToCalcDuration Create(Vector4 to, Func duration) where T : IEasing, new() 89 | { 90 | return new Vector4EasingAnimatorToCalcDuration(new T(), to, duration); 91 | } 92 | 93 | public static QuaternionEasingAnimator Create(Quaternion start, Quaternion end, float duration) where T : IEasing, new() 94 | { 95 | return new QuaternionEasingAnimator(new T(), start, end, duration); 96 | } 97 | 98 | public static QuaternionEasingAnimator Create(Quaternion start, Quaternion end, Func duration) where T : IEasing, new() 99 | { 100 | return new QuaternionEasingAnimator(new T(), start, end, duration); 101 | } 102 | 103 | public static QuaternionEasingAnimatorTo Create(Quaternion to, float duration) where T : IEasing, new() 104 | { 105 | return new QuaternionEasingAnimatorTo(new T(), to, duration); 106 | } 107 | 108 | public static QuaternionEasingAnimatorToCalcDuration Create(Quaternion to, Func duration) where T : IEasing, new() 109 | { 110 | return new QuaternionEasingAnimatorToCalcDuration(new T(), to, duration); 111 | } 112 | 113 | public static ColorEasingAnimator Create(Color start, Color end, float duration) where T : IEasing, new() 114 | { 115 | return new ColorEasingAnimator(new T(), start, end, duration); 116 | } 117 | 118 | public static ColorEasingAnimator Create(Color start, Color end, Func duration) where T : IEasing, new() 119 | { 120 | return new ColorEasingAnimator(new T(), start, end, duration); 121 | } 122 | 123 | public static ColorEasingAnimatorTo Create(Color to, float duration) where T : IEasing, new() 124 | { 125 | return new ColorEasingAnimatorTo(new T(), to, duration); 126 | } 127 | 128 | public static ColorEasingAnimatorToCalcDuration Create(Color to, Func duration) where T : IEasing, new() 129 | { 130 | return new ColorEasingAnimatorToCalcDuration(new T(), to, duration); 131 | } 132 | } 133 | 134 | public class Vector1EasingAnimator : IAnimator 135 | { 136 | private readonly IEasing easing; 137 | private readonly float start; 138 | private readonly float end; 139 | private readonly float duration; 140 | 141 | public Vector1EasingAnimator(IEasing easing, float start, float end, float duration) 142 | { 143 | this.easing = easing; 144 | this.start = start; 145 | this.end = end; 146 | this.duration = duration; 147 | } 148 | 149 | public Vector1EasingAnimator(IEasing easing, float start, float end, Func duration) 150 | { 151 | this.easing = easing; 152 | this.start = start; 153 | this.end = end; 154 | this.duration = duration.Invoke(Mathf.Abs(start - end)); 155 | } 156 | 157 | public (float, float) Update(float time) 158 | { 159 | var value = Mathf.LerpUnclamped(start, end, easing.Function(Mathf.Min(time / duration, 1.0f))); 160 | return (value, Mathf.Min(time, duration)); 161 | } 162 | } 163 | 164 | public class Vector1EasingAnimatorTo : IAnimatorWithStartValue 165 | { 166 | private readonly IEasing easing; 167 | private readonly float to; 168 | private readonly float duration; 169 | 170 | public Vector1EasingAnimatorTo(IEasing easing, float to, float duration) 171 | { 172 | this.easing = easing; 173 | this.to = to; 174 | this.duration = duration; 175 | } 176 | 177 | public IAnimator Start(float startValue) 178 | { 179 | return new Vector1EasingAnimator(easing, startValue, to, duration); 180 | } 181 | } 182 | 183 | public class Vector1EasingAnimatorToCalcDuration : IAnimatorWithStartValue 184 | { 185 | private readonly IEasing easing; 186 | private readonly float to; 187 | private readonly Func duration; 188 | 189 | public Vector1EasingAnimatorToCalcDuration(IEasing easing, float to, Func duration) 190 | { 191 | this.easing = easing; 192 | this.to = to; 193 | this.duration = duration; 194 | } 195 | 196 | public IAnimator Start(float startValue) 197 | { 198 | return new Vector1EasingAnimator(easing, startValue, to, duration); 199 | } 200 | } 201 | 202 | public class Vector2EasingAnimator : IAnimator 203 | { 204 | private readonly IEasing easing; 205 | private readonly Vector2 start; 206 | private readonly Vector2 end; 207 | private readonly float duration; 208 | 209 | public Vector2EasingAnimator(IEasing easing, Vector2 start, Vector2 end, float duration) 210 | { 211 | this.easing = easing; 212 | this.start = start; 213 | this.end = end; 214 | this.duration = duration; 215 | } 216 | 217 | public Vector2EasingAnimator(IEasing easing, Vector2 start, Vector2 end, Func duration) 218 | { 219 | this.easing = easing; 220 | this.start = start; 221 | this.end = end; 222 | this.duration = duration.Invoke(Vector2.Distance(start, end)); 223 | } 224 | 225 | public (Vector2, float) Update(float time) 226 | { 227 | var value = Vector2.LerpUnclamped(start, end, easing.Function(Mathf.Min(time / duration, 1.0f))); 228 | return (value, Mathf.Min(time, duration)); 229 | } 230 | } 231 | 232 | public class Vector2EasingAnimatorTo : IAnimatorWithStartValue 233 | { 234 | private readonly IEasing easing; 235 | private readonly Vector2 to; 236 | private readonly float duration; 237 | 238 | public Vector2EasingAnimatorTo(IEasing easing, Vector2 to, float duration) 239 | { 240 | this.easing = easing; 241 | this.to = to; 242 | this.duration = duration; 243 | } 244 | 245 | public IAnimator Start(Vector2 startValue) 246 | { 247 | return new Vector2EasingAnimator(easing, startValue, to, duration); 248 | } 249 | } 250 | 251 | public class Vector2EasingAnimatorToCalcDuration : IAnimatorWithStartValue 252 | { 253 | private readonly IEasing easing; 254 | private readonly Vector2 to; 255 | private readonly Func duration; 256 | 257 | public Vector2EasingAnimatorToCalcDuration(IEasing easing, Vector2 to, Func duration) 258 | { 259 | this.easing = easing; 260 | this.to = to; 261 | this.duration = duration; 262 | } 263 | 264 | public IAnimator Start(Vector2 startValue) 265 | { 266 | return new Vector2EasingAnimator(easing, startValue, to, duration); 267 | } 268 | } 269 | 270 | public class Vector3EasingAnimator : IAnimator 271 | { 272 | private readonly IEasing easing; 273 | private readonly Vector3 start; 274 | private readonly Vector3 end; 275 | private readonly float duration; 276 | 277 | public Vector3EasingAnimator(IEasing easing, Vector3 start, Vector3 end, float duration) 278 | { 279 | this.easing = easing; 280 | this.start = start; 281 | this.end = end; 282 | this.duration = duration; 283 | } 284 | 285 | public Vector3EasingAnimator(IEasing easing, Vector3 start, Vector3 end, Func duration) 286 | { 287 | this.easing = easing; 288 | this.start = start; 289 | this.end = end; 290 | this.duration = duration.Invoke(Vector3.Distance(start, end)); 291 | } 292 | 293 | public (Vector3, float) Update(float time) 294 | { 295 | var value = Vector3.LerpUnclamped(start, end, easing.Function(Mathf.Min(time / duration, 1.0f))); 296 | return (value, Mathf.Min(time, duration)); 297 | } 298 | } 299 | 300 | public class Vector3EasingAnimatorTo : IAnimatorWithStartValue 301 | { 302 | private readonly IEasing easing; 303 | private readonly Vector3 to; 304 | private readonly float duration; 305 | 306 | public Vector3EasingAnimatorTo(IEasing easing, Vector3 to, float duration) 307 | { 308 | this.easing = easing; 309 | this.to = to; 310 | this.duration = duration; 311 | } 312 | 313 | public IAnimator Start(Vector3 startValue) 314 | { 315 | return new Vector3EasingAnimator(easing, startValue, to, duration); 316 | } 317 | } 318 | 319 | public class Vector3EasingAnimatorToCalcDuration : IAnimatorWithStartValue 320 | { 321 | private readonly IEasing easing; 322 | private readonly Vector3 to; 323 | private readonly Func duration; 324 | 325 | public Vector3EasingAnimatorToCalcDuration(IEasing easing, Vector3 to, Func duration) 326 | { 327 | this.easing = easing; 328 | this.to = to; 329 | this.duration = duration; 330 | } 331 | 332 | public IAnimator Start(Vector3 startValue) 333 | { 334 | return new Vector3EasingAnimator(easing, startValue, to, duration); 335 | } 336 | } 337 | 338 | public class Vector4EasingAnimator : IAnimator 339 | { 340 | private readonly IEasing easing; 341 | private readonly Vector4 start; 342 | private readonly Vector4 end; 343 | private readonly float duration; 344 | 345 | public Vector4EasingAnimator(IEasing easing, Vector4 start, Vector4 end, float duration) 346 | { 347 | this.easing = easing; 348 | this.start = start; 349 | this.end = end; 350 | this.duration = duration; 351 | } 352 | 353 | public Vector4EasingAnimator(IEasing easing, Vector4 start, Vector4 end, Func duration) 354 | { 355 | this.easing = easing; 356 | this.start = start; 357 | this.end = end; 358 | this.duration = duration.Invoke(Vector4.Distance(start, end)); 359 | } 360 | 361 | public (Vector4, float) Update(float time) 362 | { 363 | var value = Vector4.LerpUnclamped(start, end, easing.Function(Mathf.Min(time / duration, 1.0f))); 364 | return (value, Mathf.Min(time, duration)); 365 | } 366 | } 367 | 368 | public class Vector4EasingAnimatorTo : IAnimatorWithStartValue 369 | { 370 | private readonly IEasing easing; 371 | private readonly Vector4 to; 372 | private readonly float duration; 373 | 374 | public Vector4EasingAnimatorTo(IEasing easing, Vector4 to, float duration) 375 | { 376 | this.easing = easing; 377 | this.to = to; 378 | this.duration = duration; 379 | } 380 | 381 | public IAnimator Start(Vector4 startValue) 382 | { 383 | return new Vector4EasingAnimator(easing, startValue, to, duration); 384 | } 385 | } 386 | 387 | public class Vector4EasingAnimatorToCalcDuration : IAnimatorWithStartValue 388 | { 389 | private readonly IEasing easing; 390 | private readonly Vector4 to; 391 | private readonly Func duration; 392 | 393 | public Vector4EasingAnimatorToCalcDuration(IEasing easing, Vector4 to, Func duration) 394 | { 395 | this.easing = easing; 396 | this.to = to; 397 | this.duration = duration; 398 | } 399 | 400 | public IAnimator Start(Vector4 startValue) 401 | { 402 | return new Vector4EasingAnimator(easing, startValue, to, duration); 403 | } 404 | } 405 | 406 | public class QuaternionEasingAnimator : IAnimator 407 | { 408 | private readonly IEasing easing; 409 | private readonly Quaternion start; 410 | private readonly Quaternion end; 411 | private readonly float duration; 412 | 413 | public QuaternionEasingAnimator(IEasing easing, Quaternion start, Quaternion end, float duration) 414 | { 415 | this.easing = easing; 416 | this.start = start; 417 | this.end = end; 418 | this.duration = duration; 419 | } 420 | 421 | public QuaternionEasingAnimator(IEasing easing, Quaternion start, Quaternion end, Func duration) 422 | { 423 | this.easing = easing; 424 | this.start = start; 425 | this.end = end; 426 | this.duration = duration.Invoke(Quaternion.Angle(start, end)); 427 | } 428 | 429 | public (Quaternion, float) Update(float time) 430 | { 431 | var value = Quaternion.LerpUnclamped(start, end, easing.Function(Mathf.Min(time / duration, 1.0f))); 432 | return (value, Mathf.Min(time, duration)); 433 | } 434 | } 435 | 436 | public class QuaternionEasingAnimatorTo : IAnimatorWithStartValue 437 | { 438 | private readonly IEasing easing; 439 | private readonly Quaternion to; 440 | private readonly float duration; 441 | 442 | public QuaternionEasingAnimatorTo(IEasing easing, Quaternion to, float duration) 443 | { 444 | this.easing = easing; 445 | this.to = to; 446 | this.duration = duration; 447 | } 448 | 449 | public IAnimator Start(Quaternion startValue) 450 | { 451 | return new QuaternionEasingAnimator(easing, startValue, to, duration); 452 | } 453 | } 454 | 455 | public class QuaternionEasingAnimatorToCalcDuration : IAnimatorWithStartValue 456 | { 457 | private readonly IEasing easing; 458 | private readonly Quaternion to; 459 | private readonly Func duration; 460 | 461 | public QuaternionEasingAnimatorToCalcDuration(IEasing easing, Quaternion to, Func duration) 462 | { 463 | this.easing = easing; 464 | this.to = to; 465 | this.duration = duration; 466 | } 467 | 468 | public IAnimator Start(Quaternion startValue) 469 | { 470 | return new QuaternionEasingAnimator(easing, startValue, to, duration); 471 | } 472 | } 473 | 474 | public class ColorEasingAnimator : IAnimator 475 | { 476 | private readonly IEasing easing; 477 | private readonly Color start; 478 | private readonly Color end; 479 | private readonly float duration; 480 | 481 | public ColorEasingAnimator(IEasing easing, Color start, Color end, float duration) 482 | { 483 | this.easing = easing; 484 | this.start = start; 485 | this.end = end; 486 | this.duration = duration; 487 | } 488 | 489 | public ColorEasingAnimator(IEasing easing, Color start, Color end, Func duration) 490 | { 491 | this.easing = easing; 492 | this.start = start; 493 | this.end = end; 494 | this.duration = duration.Invoke(Vector4.Distance(start, end)); 495 | } 496 | 497 | public (Color, float) Update(float time) 498 | { 499 | var value = Color.LerpUnclamped(start, end, easing.Function(Mathf.Min(time / duration, 1.0f))); 500 | return (value, Mathf.Min(time, duration)); 501 | } 502 | } 503 | 504 | public class ColorEasingAnimatorTo : IAnimatorWithStartValue 505 | { 506 | private readonly IEasing easing; 507 | private readonly Color to; 508 | private readonly float duration; 509 | 510 | public ColorEasingAnimatorTo(IEasing easing, Color to, float duration) 511 | { 512 | this.easing = easing; 513 | this.to = to; 514 | this.duration = duration; 515 | } 516 | 517 | public IAnimator Start(Color startValue) 518 | { 519 | return new ColorEasingAnimator(easing, startValue, to, duration); 520 | } 521 | } 522 | 523 | public class ColorEasingAnimatorToCalcDuration : IAnimatorWithStartValue 524 | { 525 | private readonly IEasing easing; 526 | private readonly Color to; 527 | private readonly Func duration; 528 | 529 | public ColorEasingAnimatorToCalcDuration(IEasing easing, Color to, Func duration) 530 | { 531 | this.easing = easing; 532 | this.to = to; 533 | this.duration = duration; 534 | } 535 | 536 | public IAnimator Start(Color startValue) 537 | { 538 | return new ColorEasingAnimator(easing, startValue, to, duration); 539 | } 540 | } 541 | } 542 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Easing/EasingAnimator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 080cdd09ef0243beadecd415b417aacc 3 | timeCreated: 1538308436 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Easing/IEasing.cs: -------------------------------------------------------------------------------- 1 | namespace AnimeTask 2 | { 3 | public interface IEasing 4 | { 5 | float Function(float v); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Easing/IEasing.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 068edb0442bb43559f008701b4bc75ea 3 | timeCreated: 1538308788 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Extension.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using UnityEngine; 3 | 4 | namespace AnimeTask 5 | { 6 | public static class Extension 7 | { 8 | public static AnimationCanceller GetAnimationCanceller(this GameObject self) 9 | { 10 | var holder = self.GetComponent(); 11 | if (holder == null) holder = self.AddComponent(); 12 | return holder; 13 | } 14 | 15 | public static AnimationCanceller GetAnimationCanceller(this Component self) 16 | { 17 | return self.gameObject.GetAnimationCanceller(); 18 | } 19 | } 20 | 21 | public class AnimationCanceller : MonoBehaviour 22 | { 23 | private CancellationTokenSource cancellationTokenSource; 24 | 25 | public void OnDestroy() 26 | { 27 | Cancel(); 28 | } 29 | 30 | public AnimationCanceller Cancel() 31 | { 32 | cancellationTokenSource?.Cancel(); 33 | cancellationTokenSource = null; 34 | return this; 35 | } 36 | 37 | public CancellationTokenSource TokenSource 38 | { 39 | get 40 | { 41 | if (cancellationTokenSource == null) 42 | { 43 | cancellationTokenSource = new CancellationTokenSource(); 44 | } 45 | return cancellationTokenSource; 46 | } 47 | } 48 | 49 | public CancellationToken Token => TokenSource.Token; 50 | } 51 | } -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Extension.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 337d6840dfd6437c9ffd74d941a8de48 3 | timeCreated: 1615685409 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Extensions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e8057ab2011fc44a793f868d6cebc017 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Extensions/AnimeTask.Extensions.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "AnimeTask.Extensions", 3 | "references": [ 4 | "GUID:f51ebe6a0ceec4240a699833d6309b23", 5 | "GUID:1a4cffb770ce347a39cea41a326324ec", 6 | "GUID:560b04d1a97f54a4e82edc0cbbb69285" 7 | ], 8 | "includePlatforms": [], 9 | "excludePlatforms": [], 10 | "allowUnsafeCode": false, 11 | "overrideReferences": false, 12 | "precompiledReferences": [], 13 | "autoReferenced": true, 14 | "defineConstraints": [], 15 | "versionDefines": [ 16 | { 17 | "name": "com.neuecc.unirx", 18 | "expression": "", 19 | "define": "ANIMETASK_UNIRX_SUPPORT" 20 | } 21 | ], 22 | "noEngineReferences": false 23 | } -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Extensions/AnimeTask.Extensions.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22c229c920c2e4e128336d5767e12217 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Extensions/UniRxExtensions.cs: -------------------------------------------------------------------------------- 1 | #if ANIMETASK_UNIRX_SUPPORT 2 | using System; 3 | using System.Threading; 4 | using Cysharp.Threading.Tasks; 5 | using UniRx; 6 | 7 | namespace AnimeTask.Extensions 8 | { 9 | public static class UniRxExtensions 10 | { 11 | public static IDisposable SubscribeTask(this IObservable source, Func taskFunc) 12 | { 13 | var cancellationTokenSource = new CancellationTokenSource(); 14 | return source 15 | .DoOnCancel(() => 16 | { 17 | cancellationTokenSource.Cancel(); 18 | }) 19 | .Subscribe(x => 20 | { 21 | cancellationTokenSource.Cancel(); 22 | cancellationTokenSource = new CancellationTokenSource(); 23 | taskFunc(x, cancellationTokenSource.Token).Forget(); 24 | }); 25 | } 26 | } 27 | } 28 | #endif -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Extensions/UniRxExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58214ab873c14421fbf97c15c2e94e15 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/IAnimator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AnimeTask 4 | { 5 | public interface IConcatableAnimator 6 | { 7 | } 8 | 9 | public interface IAnimator : IConcatableAnimator 10 | { 11 | (T, float) Update(float time); 12 | } 13 | 14 | public interface IAnimatorWithStartValue : IConcatableAnimator 15 | { 16 | IAnimator Start(T startValue); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/IAnimator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f44ffe8ff9cc4a6da1da15d53340cad2 3 | timeCreated: 1538306293 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/IScheduler.cs: -------------------------------------------------------------------------------- 1 | using Cysharp.Threading.Tasks; 2 | 3 | namespace AnimeTask 4 | { 5 | public interface IScheduler 6 | { 7 | float DeltaTime { get; } 8 | PlayerLoopTiming UpdateTiming { get; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/IScheduler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c092a298415423caeb02dd348e1d07b 3 | timeCreated: 1538838737 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/ITranslator.cs: -------------------------------------------------------------------------------- 1 | namespace AnimeTask 2 | { 3 | public interface ITranslator 4 | { 5 | bool Alive { get; } 6 | void Update(T value); 7 | } 8 | 9 | public interface IValueTranslator : ITranslator 10 | { 11 | T Current { get; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/ITranslator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5161bbc83f164876a43bd7a98e965de6 3 | timeCreated: 1538306307 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Moving.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79dc0ef45b9a4ed1ab5180a6a25078e7 3 | timeCreated: 1593310408 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Moving/AnimationCurveAnimator.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace AnimeTask 4 | { 5 | public static partial class Moving 6 | { 7 | public static AnimationCurveAnimator AnimationCurve(AnimationCurve animationCurve, float playSpeed = 1.0f) 8 | { 9 | return new AnimationCurveAnimator(animationCurve, playSpeed); 10 | } 11 | } 12 | 13 | public class AnimationCurveAnimator : IAnimator 14 | { 15 | private readonly AnimationCurve animationCurve; 16 | private readonly float playSpeed; 17 | private readonly float duration; 18 | 19 | public AnimationCurveAnimator(AnimationCurve animationCurve, float playSpeed) 20 | { 21 | this.animationCurve = animationCurve; 22 | this.playSpeed = playSpeed; 23 | duration = animationCurve.keys[animationCurve.keys.Length - 1].time / playSpeed; 24 | } 25 | 26 | public (float, float) Update(float time) 27 | { 28 | var value = animationCurve.Evaluate(time * playSpeed); 29 | return (value, Mathf.Min(time, duration)); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Moving/AnimationCurveAnimator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0c2781c2396a43b3aba21850a31e630e 3 | timeCreated: 1618362364 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Moving/GravityAnimator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace AnimeTask 5 | { 6 | public static partial class Moving 7 | { 8 | public static Vector1GravityMovingAnimator Gravity(float start, float velocity, float acceleration, float duration) 9 | { 10 | return new Vector1GravityMovingAnimator(start, velocity, acceleration, duration); 11 | } 12 | 13 | public static Vector1GravityMovingAnimatorWithStartValue Gravity(float velocity, float acceleration, float duration) 14 | { 15 | return new Vector1GravityMovingAnimatorWithStartValue(velocity, acceleration, duration); 16 | } 17 | 18 | public static Vector2GravityMovingAnimator Gravity(Vector2 start, Vector2 velocity, Vector2 acceleration, float duration) 19 | { 20 | return new Vector2GravityMovingAnimator(start, velocity, acceleration, duration); 21 | } 22 | 23 | public static Vector2GravityMovingAnimatorWithStartValue Gravity(Vector2 velocity, Vector2 acceleration, float duration) 24 | { 25 | return new Vector2GravityMovingAnimatorWithStartValue(velocity, acceleration, duration); 26 | } 27 | 28 | public static Vector3GravityMovingAnimator Gravity(Vector3 start, Vector3 velocity, Vector3 acceleration, float duration) 29 | { 30 | return new Vector3GravityMovingAnimator(start, velocity, acceleration, duration); 31 | } 32 | 33 | public static Vector3GravityMovingAnimatorWithStartValue Gravity(Vector3 velocity, Vector3 acceleration, float duration) 34 | { 35 | return new Vector3GravityMovingAnimatorWithStartValue(velocity, acceleration, duration); 36 | } 37 | } 38 | 39 | public class Vector1GravityMovingAnimator : IAnimator 40 | { 41 | private readonly float start; 42 | private readonly float velocity; 43 | private readonly float acceleration; 44 | private readonly float duration; 45 | 46 | public Vector1GravityMovingAnimator(float start, float velocity, float acceleration, float duration) 47 | { 48 | this.start = start; 49 | this.velocity = velocity; 50 | this.acceleration = acceleration; 51 | this.duration = duration; 52 | } 53 | 54 | public (float, float) Update(float time) 55 | { 56 | var t = Mathf.Min(time, duration); 57 | var value = start + velocity * t + acceleration * (0.5f * t * t); 58 | return (value, Mathf.Min(time, duration)); 59 | } 60 | } 61 | 62 | public class Vector1GravityMovingAnimatorWithStartValue : IAnimatorWithStartValue 63 | { 64 | private readonly float velocity; 65 | private readonly float acceleration; 66 | private readonly float duration; 67 | 68 | public Vector1GravityMovingAnimatorWithStartValue(float velocity, float acceleration, float duration) 69 | { 70 | this.velocity = velocity; 71 | this.acceleration = acceleration; 72 | this.duration = duration; 73 | } 74 | 75 | public IAnimator Start(float startValue) 76 | { 77 | return new Vector1GravityMovingAnimator(startValue, velocity, acceleration, duration); 78 | } 79 | } 80 | 81 | public class Vector2GravityMovingAnimator : IAnimator 82 | { 83 | private readonly Vector2 start; 84 | private readonly Vector2 velocity; 85 | private readonly Vector2 acceleration; 86 | private readonly float duration; 87 | 88 | public Vector2GravityMovingAnimator(Vector2 start, Vector2 velocity, Vector2 acceleration, float duration) 89 | { 90 | this.start = start; 91 | this.velocity = velocity; 92 | this.acceleration = acceleration; 93 | this.duration = duration; 94 | } 95 | 96 | public (Vector2, float) Update(float time) 97 | { 98 | var t = Mathf.Min(time, duration); 99 | var value = start + velocity * t + acceleration * (0.5f * t * t); 100 | return (value, Mathf.Min(time, duration)); 101 | } 102 | } 103 | 104 | public class Vector2GravityMovingAnimatorWithStartValue : IAnimatorWithStartValue 105 | { 106 | private readonly Vector2 velocity; 107 | private readonly Vector2 acceleration; 108 | private readonly float duration; 109 | 110 | public Vector2GravityMovingAnimatorWithStartValue(Vector2 velocity, Vector2 acceleration, float duration) 111 | { 112 | this.velocity = velocity; 113 | this.acceleration = acceleration; 114 | this.duration = duration; 115 | } 116 | 117 | public IAnimator Start(Vector2 startValue) 118 | { 119 | return new Vector2GravityMovingAnimator(startValue, velocity, acceleration, duration); 120 | } 121 | } 122 | 123 | public class Vector3GravityMovingAnimator : IAnimator 124 | { 125 | private readonly Vector3 start; 126 | private readonly Vector3 velocity; 127 | private readonly Vector3 acceleration; 128 | private readonly float duration; 129 | 130 | public Vector3GravityMovingAnimator(Vector3 start, Vector3 velocity, Vector3 acceleration, float duration) 131 | { 132 | this.start = start; 133 | this.velocity = velocity; 134 | this.acceleration = acceleration; 135 | this.duration = duration; 136 | } 137 | 138 | public (Vector3, float) Update(float time) 139 | { 140 | var t = Mathf.Min(time, duration); 141 | var value = start + velocity * t + acceleration * (0.5f * t * t); 142 | return (value, Mathf.Min(time, duration)); 143 | } 144 | } 145 | 146 | public class Vector3GravityMovingAnimatorWithStartValue : IAnimatorWithStartValue 147 | { 148 | private readonly Vector3 velocity; 149 | private readonly Vector3 acceleration; 150 | private readonly float duration; 151 | 152 | public Vector3GravityMovingAnimatorWithStartValue(Vector3 velocity, Vector3 acceleration, float duration) 153 | { 154 | this.velocity = velocity; 155 | this.acceleration = acceleration; 156 | this.duration = duration; 157 | } 158 | 159 | public IAnimator Start(Vector3 startValue) 160 | { 161 | return new Vector3GravityMovingAnimator(startValue, velocity, acceleration, duration); 162 | } 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Moving/GravityAnimator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f2c9b792fb474848b7a0f0fe74b092e2 3 | timeCreated: 1593311087 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Moving/LinearAnimator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace AnimeTask 5 | { 6 | public static partial class Moving 7 | { 8 | public static Vector1LinearMovingAnimator Linear(float start, float velocity, float duration) 9 | { 10 | return new Vector1LinearMovingAnimator(start, velocity, duration); 11 | } 12 | 13 | public static Vector1LinearMovingAnimatorWithStartValue Linear(float velocity, float duration) 14 | { 15 | return new Vector1LinearMovingAnimatorWithStartValue(velocity, duration); 16 | } 17 | 18 | public static Vector2LinearMovingAnimator Linear(Vector2 start, Vector2 velocity, float duration) 19 | { 20 | return new Vector2LinearMovingAnimator(start, velocity, duration); 21 | } 22 | 23 | public static Vector2LinearMovingAnimatorWithStartValue Linear(Vector2 velocity, float duration) 24 | { 25 | return new Vector2LinearMovingAnimatorWithStartValue(velocity, duration); 26 | } 27 | 28 | public static Vector3LinearMovingAnimator Linear(Vector3 start, Vector3 velocity, float duration) 29 | { 30 | return new Vector3LinearMovingAnimator(start, velocity, duration); 31 | } 32 | 33 | public static Vector3LinearMovingAnimatorWithStartValue Linear(Vector3 velocity, float duration) 34 | { 35 | return new Vector3LinearMovingAnimatorWithStartValue(velocity, duration); 36 | } 37 | } 38 | 39 | public class Vector1LinearMovingAnimator : IAnimator 40 | { 41 | private readonly float start; 42 | private readonly float velocity; 43 | private readonly float duration; 44 | 45 | public Vector1LinearMovingAnimator(float start, float velocity, float duration) 46 | { 47 | this.start = start; 48 | this.velocity = velocity; 49 | this.duration = duration; 50 | } 51 | 52 | public (float, float) Update(float time) 53 | { 54 | var value = start + velocity * Mathf.Min(time, duration); 55 | return (value, Mathf.Min(time, duration)); 56 | } 57 | } 58 | 59 | public class Vector1LinearMovingAnimatorWithStartValue : IAnimatorWithStartValue 60 | { 61 | private readonly float velocity; 62 | private readonly float duration; 63 | 64 | public Vector1LinearMovingAnimatorWithStartValue(float velocity, float duration) 65 | { 66 | this.velocity = velocity; 67 | this.duration = duration; 68 | } 69 | 70 | public IAnimator Start(float startValue) 71 | { 72 | return new Vector1LinearMovingAnimator(startValue, velocity, duration); 73 | } 74 | } 75 | 76 | public class Vector2LinearMovingAnimator : IAnimator 77 | { 78 | private readonly Vector2 start; 79 | private readonly Vector2 velocity; 80 | private readonly float duration; 81 | 82 | public Vector2LinearMovingAnimator(Vector2 start, Vector2 velocity, float duration) 83 | { 84 | this.start = start; 85 | this.velocity = velocity; 86 | this.duration = duration; 87 | } 88 | 89 | public (Vector2, float) Update(float time) 90 | { 91 | var value = start + velocity * Mathf.Min(time, duration); 92 | return (value, Mathf.Min(time, duration)); 93 | } 94 | } 95 | 96 | public class Vector2LinearMovingAnimatorWithStartValue : IAnimatorWithStartValue 97 | { 98 | private readonly Vector2 velocity; 99 | private readonly float duration; 100 | 101 | public Vector2LinearMovingAnimatorWithStartValue(Vector2 velocity, float duration) 102 | { 103 | this.velocity = velocity; 104 | this.duration = duration; 105 | } 106 | 107 | public IAnimator Start(Vector2 startValue) 108 | { 109 | return new Vector2LinearMovingAnimator(startValue, velocity, duration); 110 | } 111 | } 112 | 113 | public class Vector3LinearMovingAnimator : IAnimator 114 | { 115 | private readonly Vector3 start; 116 | private readonly Vector3 velocity; 117 | private readonly float duration; 118 | 119 | public Vector3LinearMovingAnimator(Vector3 start, Vector3 velocity, float duration) 120 | { 121 | this.start = start; 122 | this.velocity = velocity; 123 | this.duration = duration; 124 | } 125 | 126 | public (Vector3, float) Update(float time) 127 | { 128 | var value = start + velocity * Mathf.Min(time, duration); 129 | return (value, Mathf.Min(time, duration)); 130 | } 131 | } 132 | 133 | public class Vector3LinearMovingAnimatorWithStartValue : IAnimatorWithStartValue 134 | { 135 | private readonly Vector3 velocity; 136 | private readonly float duration; 137 | 138 | public Vector3LinearMovingAnimatorWithStartValue(Vector3 velocity, float duration) 139 | { 140 | this.velocity = velocity; 141 | this.duration = duration; 142 | } 143 | 144 | public IAnimator Start(Vector3 startValue) 145 | { 146 | return new Vector3LinearMovingAnimator(startValue, velocity, duration); 147 | } 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Moving/LinearAnimator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c9b873be82504796849cf5ba1ba1a051 3 | timeCreated: 1593310415 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Scheduler.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7449372804554557b9c5f7c29873e8c4 3 | timeCreated: 1538838813 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Scheduler/TimeScheduler.cs: -------------------------------------------------------------------------------- 1 | using Cysharp.Threading.Tasks; 2 | using UnityEngine; 3 | 4 | namespace AnimeTask 5 | { 6 | public class TimeScheduler : IScheduler 7 | { 8 | public float DeltaTime => Time.deltaTime; 9 | public PlayerLoopTiming UpdateTiming => PlayerLoopTiming.Update; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Scheduler/TimeScheduler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f0437061e48649dfb6ff636e44e5a22f 3 | timeCreated: 1538838820 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Scheduler/UnscaledTimeScheduler.cs: -------------------------------------------------------------------------------- 1 | using Cysharp.Threading.Tasks; 2 | using UnityEngine; 3 | 4 | namespace AnimeTask 5 | { 6 | public class UnscaledTimeScheduler : IScheduler 7 | { 8 | public float DeltaTime => Time.unscaledDeltaTime; 9 | public PlayerLoopTiming UpdateTiming => PlayerLoopTiming.Update; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Scheduler/UnscaledTimeScheduler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a815dc30e9146f6a63cf0a26d73f32e 3 | timeCreated: 1538838870 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3566147fb13f433aa422e0941de88e2c 3 | timeCreated: 1538308771 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/ActionTranslator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using Cysharp.Threading.Tasks; 4 | using JetBrains.Annotations; 5 | using Object = UnityEngine.Object; 6 | 7 | namespace AnimeTask 8 | { 9 | public static partial class TranslateTo 10 | { 11 | [MustUseReturnValue] 12 | public static UniTask ToAction(this IAnimator animator, Action action, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 13 | { 14 | return Anime.Play(animator, new ActionTranslator(action), scheduler, cancellationToken, skipToken); 15 | } 16 | 17 | [MustUseReturnValue] 18 | public static UniTask ToAction(this IAnimator animator, Action action, Object unityObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 19 | { 20 | return Anime.Play(animator, new ActionTranslatorWithObject(action, unityObject), scheduler, cancellationToken, skipToken); 21 | } 22 | } 23 | 24 | public class ActionTranslator : ITranslator 25 | { 26 | public bool Alive => true; 27 | 28 | private readonly Action action; 29 | 30 | public ActionTranslator(Action action) 31 | { 32 | this.action = action; 33 | } 34 | 35 | public void Update(T value) 36 | { 37 | action(value); 38 | } 39 | } 40 | 41 | public class ActionTranslatorWithObject : ITranslator 42 | { 43 | public bool Alive => unityObject != null; 44 | 45 | private readonly Action action; 46 | private readonly Object unityObject; 47 | 48 | public ActionTranslatorWithObject(Action action, Object unityObject) 49 | { 50 | this.action = action; 51 | this.unityObject = unityObject; 52 | } 53 | 54 | public void Update(T value) 55 | { 56 | action(value); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/ActionTranslator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a18e9a5e69324e3694465efce99c41e7 3 | timeCreated: 1538310671 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/BindTranslator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using Cysharp.Threading.Tasks; 4 | using JetBrains.Annotations; 5 | using Object = UnityEngine.Object; 6 | 7 | namespace AnimeTask 8 | { 9 | public static partial class TranslateTo 10 | { 11 | [MustUseReturnValue] 12 | public static UniTask ToBind(this IAnimator animator, Func getter, Action setter, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 13 | { 14 | return Anime.Play(animator, new BindTranslator(getter, setter), scheduler, cancellationToken, skipToken); 15 | } 16 | 17 | [MustUseReturnValue] 18 | public static UniTask ToBind(this IAnimatorWithStartValue animator, Func getter, Action setter, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 19 | { 20 | return Anime.PlayTo(animator, new BindTranslator(getter, setter), scheduler, cancellationToken, skipToken); 21 | } 22 | 23 | [MustUseReturnValue] 24 | public static UniTask ToBind(this IAnimator animator, Func getter, Action setter, Object unityObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 25 | { 26 | return Anime.Play(animator, new BindTranslatorWithObject(getter, setter, unityObject), scheduler, cancellationToken, skipToken); 27 | } 28 | 29 | [MustUseReturnValue] 30 | public static UniTask ToBind(this IAnimatorWithStartValue animator, Func getter, Action setter, Object unityObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 31 | { 32 | return Anime.PlayTo(animator, new BindTranslatorWithObject(getter, setter, unityObject), scheduler, cancellationToken, skipToken); 33 | } 34 | } 35 | 36 | public class BindTranslator : IValueTranslator 37 | { 38 | public bool Alive => true; 39 | 40 | private readonly Func getter; 41 | private readonly Action setter; 42 | 43 | public T Current => getter(); 44 | 45 | public BindTranslator(Func getter, Action setter) 46 | { 47 | this.getter = getter; 48 | this.setter = setter; 49 | } 50 | 51 | public void Update(T value) 52 | { 53 | setter(value); 54 | } 55 | } 56 | 57 | public class BindTranslatorWithObject : IValueTranslator 58 | { 59 | public bool Alive => unityObject != null; 60 | 61 | private readonly Func getter; 62 | private readonly Action setter; 63 | private readonly Object unityObject; 64 | 65 | public T Current => getter(); 66 | 67 | public BindTranslatorWithObject(Func getter, Action setter, Object unityObject) 68 | { 69 | this.getter = getter; 70 | this.setter = setter; 71 | this.unityObject = unityObject; 72 | } 73 | 74 | public void Update(T value) 75 | { 76 | setter(value); 77 | } 78 | } 79 | } -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/BindTranslator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e7c0feb12d5d4553a07c683e478539dd 3 | timeCreated: 1612340453 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/MaterialTranslator.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using Cysharp.Threading.Tasks; 3 | using JetBrains.Annotations; 4 | using UnityEngine; 5 | 6 | namespace AnimeTask 7 | { 8 | public static partial class TranslateTo 9 | { 10 | [MustUseReturnValue] 11 | public static UniTask ToMaterialPropertyColor(this IAnimator animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 12 | { 13 | CheckAlive(renderer); 14 | return Anime.Play(animator, new MaterialPropertyColorTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 15 | } 16 | 17 | [MustUseReturnValue] 18 | public static UniTask ToMaterialPropertyColor(this IAnimator animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 19 | { 20 | CheckAlive(renderer); 21 | return Anime.Play(animator, new MaterialPropertyColorTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 22 | } 23 | 24 | [MustUseReturnValue] 25 | public static UniTask ToMaterialPropertyColor(this IAnimatorWithStartValue animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 26 | { 27 | CheckAlive(renderer); 28 | return Anime.PlayTo(animator, new MaterialPropertyColorTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 29 | } 30 | 31 | [MustUseReturnValue] 32 | public static UniTask ToMaterialPropertyColor(this IAnimatorWithStartValue animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 33 | { 34 | CheckAlive(renderer); 35 | return Anime.PlayTo(animator, new MaterialPropertyColorTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 36 | } 37 | 38 | [MustUseReturnValue] 39 | public static UniTask ToMaterialPropertyFloat(this IAnimator animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 40 | { 41 | CheckAlive(renderer); 42 | return Anime.Play(animator, new MaterialPropertyFloatTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 43 | } 44 | 45 | [MustUseReturnValue] 46 | public static UniTask ToMaterialPropertyFloat(this IAnimator animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 47 | { 48 | CheckAlive(renderer); 49 | return Anime.Play(animator, new MaterialPropertyFloatTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 50 | } 51 | 52 | [MustUseReturnValue] 53 | public static UniTask ToMaterialPropertyFloat(this IAnimatorWithStartValue animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 54 | { 55 | CheckAlive(renderer); 56 | return Anime.PlayTo(animator, new MaterialPropertyFloatTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 57 | } 58 | 59 | [MustUseReturnValue] 60 | public static UniTask ToMaterialPropertyFloat(this IAnimatorWithStartValue animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 61 | { 62 | CheckAlive(renderer); 63 | return Anime.PlayTo(animator, new MaterialPropertyFloatTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 64 | } 65 | 66 | [MustUseReturnValue] 67 | public static UniTask ToMaterialPropertyInt(this IAnimator animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 68 | { 69 | CheckAlive(renderer); 70 | return Anime.Play(animator, new MaterialPropertyIntTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 71 | } 72 | 73 | [MustUseReturnValue] 74 | public static UniTask ToMaterialPropertyInt(this IAnimator animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 75 | { 76 | CheckAlive(renderer); 77 | return Anime.Play(animator, new MaterialPropertyIntTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 78 | } 79 | 80 | [MustUseReturnValue] 81 | public static UniTask ToMaterialPropertyInt(this IAnimatorWithStartValue animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 82 | { 83 | CheckAlive(renderer); 84 | return Anime.PlayTo(animator, new MaterialPropertyIntTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 85 | } 86 | 87 | [MustUseReturnValue] 88 | public static UniTask ToMaterialPropertyInt(this IAnimatorWithStartValue animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 89 | { 90 | CheckAlive(renderer); 91 | return Anime.PlayTo(animator, new MaterialPropertyIntTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 92 | } 93 | } 94 | 95 | public class MaterialPropertyColorTranslator : IValueTranslator 96 | { 97 | public bool Alive => renderer != null; 98 | public Color Current => materialPropertyBlock.GetColor(nameID); 99 | 100 | private readonly Renderer renderer; 101 | private readonly int nameID; 102 | private readonly MaterialPropertyBlock materialPropertyBlock; 103 | 104 | public MaterialPropertyColorTranslator(Renderer renderer, int nameID) 105 | { 106 | this.renderer = renderer; 107 | this.nameID = nameID; 108 | materialPropertyBlock = new MaterialPropertyBlock(); 109 | renderer.GetPropertyBlock(materialPropertyBlock); 110 | } 111 | 112 | public MaterialPropertyColorTranslator(Renderer renderer, string name) 113 | { 114 | this.renderer = renderer; 115 | nameID = Shader.PropertyToID(name); 116 | materialPropertyBlock = new MaterialPropertyBlock(); 117 | renderer.GetPropertyBlock(materialPropertyBlock); 118 | } 119 | 120 | public void Update(Color value) 121 | { 122 | materialPropertyBlock.SetColor(nameID, value); 123 | renderer.SetPropertyBlock(materialPropertyBlock); 124 | } 125 | } 126 | 127 | public class MaterialPropertyFloatTranslator : IValueTranslator 128 | { 129 | public bool Alive => renderer != null; 130 | public float Current => materialPropertyBlock.GetFloat(nameID); 131 | 132 | private readonly Renderer renderer; 133 | private readonly int nameID; 134 | private readonly MaterialPropertyBlock materialPropertyBlock; 135 | 136 | public MaterialPropertyFloatTranslator(Renderer renderer, int nameID) 137 | { 138 | this.renderer = renderer; 139 | this.nameID = nameID; 140 | materialPropertyBlock = new MaterialPropertyBlock(); 141 | renderer.GetPropertyBlock(materialPropertyBlock); 142 | } 143 | 144 | public MaterialPropertyFloatTranslator(Renderer renderer, string name) 145 | { 146 | this.renderer = renderer; 147 | nameID = Shader.PropertyToID(name); 148 | materialPropertyBlock = new MaterialPropertyBlock(); 149 | renderer.GetPropertyBlock(materialPropertyBlock); 150 | } 151 | 152 | public void Update(float value) 153 | { 154 | materialPropertyBlock.SetFloat(nameID, value); 155 | renderer.SetPropertyBlock(materialPropertyBlock); 156 | } 157 | } 158 | 159 | public class MaterialPropertyIntTranslator : IValueTranslator 160 | { 161 | public bool Alive => renderer != null; 162 | public int Current => materialPropertyBlock.GetInt(nameID); 163 | 164 | private readonly Renderer renderer; 165 | private readonly int nameID; 166 | private readonly MaterialPropertyBlock materialPropertyBlock; 167 | 168 | public MaterialPropertyIntTranslator(Renderer renderer, int nameID) 169 | { 170 | this.renderer = renderer; 171 | this.nameID = nameID; 172 | materialPropertyBlock = new MaterialPropertyBlock(); 173 | renderer.GetPropertyBlock(materialPropertyBlock); 174 | } 175 | 176 | public MaterialPropertyIntTranslator(Renderer renderer, string name) 177 | { 178 | this.renderer = renderer; 179 | nameID = Shader.PropertyToID(name); 180 | materialPropertyBlock = new MaterialPropertyBlock(); 181 | renderer.GetPropertyBlock(materialPropertyBlock); 182 | } 183 | 184 | public void Update(int value) 185 | { 186 | materialPropertyBlock.SetInt(nameID, value); 187 | renderer.SetPropertyBlock(materialPropertyBlock); 188 | } 189 | } 190 | } -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/MaterialTranslator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e1853c79726c4e92a21fbfd329ae5309 3 | timeCreated: 1609833718 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/NoneTranslator.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using Cysharp.Threading.Tasks; 3 | using JetBrains.Annotations; 4 | 5 | namespace AnimeTask 6 | { 7 | public static partial class TranslateTo 8 | { 9 | [MustUseReturnValue] 10 | public static UniTask ToNone(this IAnimator animator, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 11 | { 12 | return Anime.Play(animator, new NoneTranslator(), scheduler, cancellationToken, skipToken); 13 | } 14 | 15 | [MustUseReturnValue] 16 | public static UniTask ToNone(this IAnimatorWithStartValue animator, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 17 | { 18 | return Anime.PlayTo(animator, new NoneTranslator(), scheduler, cancellationToken, skipToken); 19 | } 20 | } 21 | 22 | public class NoneTranslator : IValueTranslator 23 | { 24 | public bool Alive => true; 25 | public T Current => default; 26 | 27 | public void Update(T value) 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/NoneTranslator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22e314e26de94bddac4d1d0717b18eac 3 | timeCreated: 1610092245 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/ProgressTranslator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using Cysharp.Threading.Tasks; 4 | using JetBrains.Annotations; 5 | 6 | namespace AnimeTask 7 | { 8 | public static partial class TranslateTo 9 | { 10 | [MustUseReturnValue] 11 | public static UniTask ToProgress(this IAnimator animator, IProgress progress, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 12 | { 13 | return Anime.Play(animator, new ProgressTranslator(progress), scheduler, cancellationToken, skipToken); 14 | } 15 | } 16 | 17 | public class ProgressTranslator : ITranslator 18 | { 19 | public bool Alive => true; 20 | 21 | private readonly IProgress progress; 22 | 23 | public ProgressTranslator(IProgress progress) 24 | { 25 | this.progress = progress; 26 | } 27 | 28 | public void Update(T value) 29 | { 30 | progress.Report(value); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/ProgressTranslator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 69e4b72db5d54d9dbba514c8244372cc 3 | timeCreated: 1608992511 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/ReactivePropertyTranslator.cs: -------------------------------------------------------------------------------- 1 | #if ANIMETASK_UNIRX_SUPPORT 2 | using System.Threading; 3 | using Cysharp.Threading.Tasks; 4 | using JetBrains.Annotations; 5 | using UniRx; 6 | 7 | namespace AnimeTask 8 | { 9 | public static partial class TranslateTo 10 | { 11 | [MustUseReturnValue] 12 | public static UniTask ToReactiveProperty(this IAnimator animator, ReactiveProperty reactiveProperty, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 13 | { 14 | return Anime.Play(animator, new ReactivePropertyTranslator(reactiveProperty), scheduler, cancellationToken, skipToken); 15 | } 16 | 17 | [MustUseReturnValue] 18 | public static UniTask ToReactiveProperty(this IAnimatorWithStartValue animator, ReactiveProperty reactiveProperty, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 19 | { 20 | return Anime.PlayTo(animator, new ReactivePropertyTranslator(reactiveProperty), scheduler, cancellationToken, skipToken); 21 | } 22 | } 23 | 24 | public class ReactivePropertyTranslator : IValueTranslator 25 | { 26 | public bool Alive => true; 27 | 28 | public T Current => reactiveProperty.Value; 29 | private readonly ReactiveProperty reactiveProperty; 30 | 31 | public ReactivePropertyTranslator(ReactiveProperty reactiveProperty) 32 | { 33 | this.reactiveProperty = reactiveProperty; 34 | } 35 | 36 | public void Update(T value) 37 | { 38 | reactiveProperty.Value = value; 39 | } 40 | } 41 | } 42 | #endif -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/ReactivePropertyTranslator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8681165c431ff4c2a9661c04fe6efc43 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/RectTransformTranslator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c6f1856e8fd4c82847a8fa4caf9e87d 3 | timeCreated: 1612368565 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/TransformTranslator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3aff84122f3846f4ab0015d6f6f2511a 3 | timeCreated: 1538308843 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/Translator.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using UnityEngine; 3 | 4 | namespace AnimeTask 5 | { 6 | public static partial class TranslateTo 7 | { 8 | public static void CheckAlive(GameObject gameObject) 9 | { 10 | if (gameObject == null) throw new TaskCanceledException(); 11 | } 12 | 13 | public static void CheckAlive(Component component) 14 | { 15 | if (component == null) throw new TaskCanceledException(); 16 | if (component.gameObject == null) throw new TaskCanceledException(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/Translator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b6ac6a6069ca4c2ab5d60029ad88df03 3 | timeCreated: 1624852061 -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/UGuiTranslator.cs: -------------------------------------------------------------------------------- 1 | #if ANIMETASK_UGUI_SUPPORT 2 | using System.Threading; 3 | using Cysharp.Threading.Tasks; 4 | using JetBrains.Annotations; 5 | using UnityEngine; 6 | using UnityEngine.UI; 7 | 8 | namespace AnimeTask 9 | { 10 | public static partial class TranslateTo 11 | { 12 | [MustUseReturnValue] 13 | public static UniTask ToText(this IAnimator animator, Text text, string format, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 14 | { 15 | CheckAlive(text); 16 | return Anime.Play(animator, new TextTranslator(text, format), scheduler, CancellationTokenSource.CreateLinkedTokenSource(text.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 17 | } 18 | 19 | [MustUseReturnValue] 20 | public static UniTask ToColor(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 21 | { 22 | CheckAlive(graphic); 23 | return Anime.Play(animator, new ColorTranslator(graphic), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 24 | } 25 | 26 | [MustUseReturnValue] 27 | public static UniTask ToColor(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 28 | { 29 | CheckAlive(graphic); 30 | return Anime.PlayTo(animator, new ColorTranslator(graphic), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 31 | } 32 | 33 | [MustUseReturnValue] 34 | public static UniTask ToColorR(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 35 | { 36 | CheckAlive(graphic); 37 | return Anime.Play(animator, new ColorXTranslator(graphic, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 38 | } 39 | 40 | [MustUseReturnValue] 41 | public static UniTask ToColorR(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 42 | { 43 | CheckAlive(graphic); 44 | return Anime.PlayTo(animator, new ColorXTranslator(graphic, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 45 | } 46 | 47 | [MustUseReturnValue] 48 | public static UniTask ToColorG(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 49 | { 50 | CheckAlive(graphic); 51 | return Anime.Play(animator, new ColorXTranslator(graphic, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 52 | } 53 | 54 | [MustUseReturnValue] 55 | public static UniTask ToColorG(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 56 | { 57 | CheckAlive(graphic); 58 | return Anime.PlayTo(animator, new ColorXTranslator(graphic, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 59 | } 60 | 61 | [MustUseReturnValue] 62 | public static UniTask ToColorB(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 63 | { 64 | CheckAlive(graphic); 65 | return Anime.Play(animator, new ColorXTranslator(graphic, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 66 | } 67 | 68 | [MustUseReturnValue] 69 | public static UniTask ToColorB(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 70 | { 71 | CheckAlive(graphic); 72 | return Anime.PlayTo(animator, new ColorXTranslator(graphic, 2), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 73 | } 74 | 75 | [MustUseReturnValue] 76 | public static UniTask ToColorA(this IAnimator animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 77 | { 78 | CheckAlive(graphic); 79 | return Anime.Play(animator, new ColorXTranslator(graphic, 3), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 80 | } 81 | 82 | [MustUseReturnValue] 83 | public static UniTask ToColorA(this IAnimatorWithStartValue animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 84 | { 85 | CheckAlive(graphic); 86 | return Anime.PlayTo(animator, new ColorXTranslator(graphic, 3), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 87 | } 88 | 89 | [MustUseReturnValue] 90 | public static UniTask ToFillAmount(this IAnimator animator, Image image, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 91 | { 92 | CheckAlive(image); 93 | return Anime.Play(animator, new FillAmountTranslator(image), scheduler, CancellationTokenSource.CreateLinkedTokenSource(image.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 94 | } 95 | 96 | [MustUseReturnValue] 97 | public static UniTask ToFillAmount(this IAnimatorWithStartValue animator, Image image, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 98 | { 99 | CheckAlive(image); 100 | return Anime.PlayTo(animator, new FillAmountTranslator(image), scheduler, CancellationTokenSource.CreateLinkedTokenSource(image.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 101 | } 102 | 103 | [MustUseReturnValue] 104 | public static UniTask ToColorA(this IAnimator animator, CanvasGroup canvasGroup, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 105 | { 106 | CheckAlive(canvasGroup); 107 | return Anime.Play(animator, new CanvasGroupTranslator(canvasGroup), scheduler, CancellationTokenSource.CreateLinkedTokenSource(canvasGroup.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 108 | } 109 | 110 | [MustUseReturnValue] 111 | public static UniTask ToColorA(this IAnimatorWithStartValue animator, CanvasGroup canvasGroup, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) 112 | { 113 | CheckAlive(canvasGroup); 114 | return Anime.PlayTo(animator, new CanvasGroupTranslator(canvasGroup), scheduler, CancellationTokenSource.CreateLinkedTokenSource(canvasGroup.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken); 115 | } 116 | } 117 | 118 | public class TextTranslator : ITranslator 119 | { 120 | public bool Alive => text != null; 121 | 122 | private readonly Text text; 123 | private readonly string format; 124 | 125 | public TextTranslator(Text text, string format) 126 | { 127 | this.text = text; 128 | this.format = format; 129 | } 130 | 131 | public void Update(float value) 132 | { 133 | text.text = string.Format(format, value); 134 | } 135 | } 136 | 137 | public class ColorTranslator : IValueTranslator 138 | { 139 | public bool Alive => graphic != null; 140 | public Color Current => graphic.color; 141 | 142 | private readonly Graphic graphic; 143 | 144 | public ColorTranslator(Graphic graphic) 145 | { 146 | this.graphic = graphic; 147 | } 148 | 149 | public void Update(Color value) 150 | { 151 | graphic.color = value; 152 | } 153 | } 154 | 155 | public class ColorXTranslator : IValueTranslator 156 | { 157 | public bool Alive => graphic != null; 158 | public float Current => graphic.color[Index]; 159 | 160 | public int Index { get; } 161 | private readonly Graphic graphic; 162 | 163 | public ColorXTranslator(Graphic graphic, int index) 164 | { 165 | Index = index; 166 | this.graphic = graphic; 167 | } 168 | 169 | public void Update(float value) 170 | { 171 | var c = graphic.color; 172 | c[Index] = value; 173 | graphic.color = c; 174 | } 175 | } 176 | 177 | public class FillAmountTranslator : IValueTranslator 178 | { 179 | public bool Alive => image != null; 180 | public float Current => image.fillAmount; 181 | 182 | private readonly Image image; 183 | 184 | public FillAmountTranslator(Image image) 185 | { 186 | this.image = image; 187 | } 188 | 189 | public void Update(float value) 190 | { 191 | image.fillAmount = value; 192 | } 193 | } 194 | 195 | public class CanvasGroupTranslator : IValueTranslator 196 | { 197 | public bool Alive => canvasGroup != null; 198 | public float Current => canvasGroup.alpha; 199 | 200 | private readonly CanvasGroup canvasGroup; 201 | 202 | public CanvasGroupTranslator(CanvasGroup canvasGroup) 203 | { 204 | this.canvasGroup = canvasGroup; 205 | } 206 | 207 | public void Update(float value) 208 | { 209 | canvasGroup.alpha = value; 210 | } 211 | } 212 | } 213 | #endif 214 | -------------------------------------------------------------------------------- /Assets/AnimeTask/Scripts/Translator/UGuiTranslator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c950fc5c758444d8128bb3738cc57fd 3 | timeCreated: 1538308875 -------------------------------------------------------------------------------- /Assets/AnimeTask/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dev.kyubuns.animetask", 3 | "displayName": "AnimeTask", 4 | "version": "1.13.1", 5 | "unity": "2020.3", 6 | "description": "Task Animation Library for Unity", 7 | "documentationUrl": "https://github.com/kyubuns/AnimeTask", 8 | "dependencies": { 9 | "com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask" 10 | }, 11 | "author": { 12 | "name": "kyubuns", 13 | "email": "kyubuns@gmail.com", 14 | "url": "https://kyubuns.dev/" 15 | }, 16 | "type": "library" 17 | } 18 | -------------------------------------------------------------------------------- /Assets/AnimeTask/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba9a59f6c1b2244f4b4c938fc6aa672e 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: db0e946df41e048efa180a56be9c9b09 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Editor/PackageExporter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using UnityEditor; 4 | using UnityEngine; 5 | 6 | namespace Development 7 | { 8 | public static class PackageExporter 9 | { 10 | private const string Target = "Assets/AnimeTask"; 11 | 12 | [MenuItem("Export/Package")] 13 | public static void Export() 14 | { 15 | var packageText = AssetDatabase.LoadAssetAtPath(Path.Combine(Target, "package.json")); 16 | var package = JsonUtility.FromJson(packageText.text); 17 | 18 | var outputPath = Path.Combine(Path.GetDirectoryName(Application.dataPath) ?? "", $"{package.displayName}_v{package.version}.unitypackage"); 19 | AssetDatabase.ExportPackage(new[] { Target }, outputPath, ExportPackageOptions.Recurse); 20 | Debug.LogFormat("ExportPackage {0}", outputPath); 21 | } 22 | } 23 | 24 | [Serializable] 25 | public class PackageJson 26 | { 27 | public string displayName; 28 | public string version; 29 | } 30 | } -------------------------------------------------------------------------------- /Assets/Editor/PackageExporter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8e2907c6987bb4bed9cc06916140f39c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Sample.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 21dba7b14199e46c58a4fc16ce81c39d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Sample/Sample.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | using Cysharp.Threading.Tasks; 6 | using UnityEngine; 7 | 8 | namespace AnimeTask.Sample 9 | { 10 | public class Sample : MonoBehaviour 11 | { 12 | [SerializeField] private AnimationCurve sample12 = default; 13 | 14 | private static readonly int ShaderColor = Shader.PropertyToID("_Color"); 15 | 16 | public async UniTask Sample01() 17 | { 18 | using (var cubes = new SampleCubes(new Vector3(-5f, 0f, 0f))) 19 | { 20 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 21 | await Easing.Create(new Vector3(5f, 0f, 0f), 2f).ToLocalPosition(cubes[0]); 22 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 23 | } 24 | } 25 | 26 | public async UniTask Sample02() 27 | { 28 | using (var cubes = new SampleCubes(new Vector3(0f, 3f, 0f), new Vector3(0f, 3f, 0f), new Vector3(0f, 3f, 0f))) 29 | { 30 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 31 | await UniTask.WhenAll( 32 | CircleAnimation(cubes[0], 0.0f), 33 | CircleAnimation(cubes[1], 0.2f), 34 | CircleAnimation(cubes[2], 0.4f) 35 | ); 36 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 37 | } 38 | } 39 | 40 | public async UniTask Sample03() 41 | { 42 | using (var cubes = new SampleCubes(new Vector3(-5f, 0f, 0f))) 43 | { 44 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 45 | CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); 46 | cancellationTokenSource.Token.Register(() => Debug.Log("Cancel")); 47 | cancellationTokenSource.CancelAfter(500); 48 | 49 | await Easing.Create(new Vector3(5f, 0f, 0f), 2f).ToLocalPosition(cubes[0], cancellationTokenSource.Token); 50 | await UniTask.Delay(TimeSpan.FromSeconds(1), cancellationToken: cancellationTokenSource.Token); 51 | } 52 | } 53 | 54 | private async UniTask CircleAnimation(GameObject go, float delay) 55 | { 56 | await UniTask.Delay(TimeSpan.FromSeconds(delay)); 57 | await Easing.Create(0.0f, Mathf.PI * 2.0f, 2f) 58 | .Convert(x => new Vector3(Mathf.Sin(x), Mathf.Cos(x), 0.0f) * 3.0f) 59 | .ToLocalPosition(go); 60 | } 61 | 62 | public async UniTask Sample04() 63 | { 64 | using (var cubes = new SampleCubes(new Vector3(-5f, 0f, 0f))) 65 | { 66 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 67 | await UniTask.WhenAll( 68 | Moving.Linear(2f, 2f).ToLocalPositionX(cubes[0]), 69 | Animator.Delay(1.8f).Concat(Easing.Create(Vector3.zero, 0.2f)).DebugLog().ToLocalScale(cubes[0]) 70 | ); 71 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 72 | } 73 | } 74 | 75 | public async UniTask Sample05() 76 | { 77 | using (var cubes = new SampleCubes(new Vector3(-5f, 0f, 0f))) 78 | { 79 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 80 | await UniTask.WhenAll( 81 | Easing.Create(Quaternion.identity, Quaternion.Euler(30f, 0f, 0f), 0.5f).ToGlobalRotation(cubes[0]) 82 | ); 83 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 84 | } 85 | } 86 | 87 | public async UniTask Sample06() 88 | { 89 | var p = Enumerable.Range(0, 11) 90 | .Select(x => Enumerable.Range(0, 11).Select(y => new Vector3(x - 5f, y - 5f, 0))) 91 | .SelectMany(x => x) 92 | .ToArray(); 93 | using (var cubes = new SampleCubes(p)) 94 | { 95 | for (var i = 0; i < 5; ++i) 96 | { 97 | await UniTask.WhenAll( 98 | cubes.All.Select(x => 99 | { 100 | var r = x.GetComponent(); 101 | var pb = new MaterialPropertyBlock(); 102 | r.GetPropertyBlock(pb); 103 | return Easing.Create(pb.GetColor(ShaderColor), UnityEngine.Random.ColorHSV(), 0.5f).ToMaterialPropertyColor(r, "_Color"); 104 | }) 105 | ); 106 | } 107 | } 108 | } 109 | 110 | public async UniTask Sample07() 111 | { 112 | using (var cubes = new SampleCubes(new Vector3(-5f, 0f, 0f))) 113 | { 114 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 115 | 116 | var a = Easing.Create(new Vector3(-5f, 0f, 0f), new Vector3(5f, 0f, 0f), 2f); 117 | await UniTask.WhenAll( 118 | a.ToLocalPosition(cubes[0]), 119 | a.Convert(x => Vector3.one * Mathf.Abs(x.x)).ToLocalScale(cubes[0]) 120 | ); 121 | 122 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 123 | } 124 | } 125 | 126 | public async UniTask Sample08() 127 | { 128 | using (var cubes = new SampleCubes(new Vector3(-5f, -1f, 0f), new Vector3(0f, 1f, 0f))) 129 | { 130 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 131 | 132 | var a = Easing.Create(new Vector3(5f, 0f, 0f), 2f); 133 | await UniTask.WhenAll( 134 | a.ToLocalPosition(cubes[0]), 135 | a.ToLocalPosition(cubes[1]) 136 | ); 137 | 138 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 139 | } 140 | } 141 | 142 | public async UniTask Sample09() 143 | { 144 | using (var cubes = new SampleCubes(new Vector3(-5f, 0f, 0f))) 145 | { 146 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 147 | 148 | var a = Animator.Concat( 149 | Easing.Create(-5f, 0f, 2f), 150 | Animator.Delay(1f), 151 | Easing.Create(0f, 5f, 2f) 152 | ); 153 | 154 | await UniTask.WhenAll( 155 | a.Convert(x => new Vector3(x, 0f, 0f)).ToLocalPosition(cubes[0]), 156 | a.Convert(x => Vector3.one * Mathf.Abs(x)).ToLocalScale(cubes[0]) 157 | ); 158 | 159 | await Easing.Create(5f, 0f, 2f) 160 | .Delay(1f) 161 | .Concat(Easing.Create(0f, -5f, 2f)) 162 | .Convert(x => new Vector3(x, 0f, 0f)) 163 | .ToLocalPosition(cubes[0]); 164 | 165 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 166 | } 167 | } 168 | 169 | public async UniTask Sample10() 170 | { 171 | using (var cubes = new SampleCubes(new Vector3(0f, 0f, 0f), new Vector3(0f, 1f, 0f))) 172 | { 173 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 174 | 175 | var moveAnimation = Easing.Create(0f, 5f, 2f); 176 | await UniTask.WhenAll( 177 | moveAnimation.ToLocalPositionX(cubes[0]), 178 | moveAnimation.RelativeDelay(-0.5f).Concat(moveAnimation).ToLocalPositionX(cubes[1]) 179 | ); 180 | 181 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 182 | } 183 | } 184 | 185 | public async UniTask Sample11() 186 | { 187 | using (var cubes = new SampleCubes(new Vector3(0f, 0f, 0f))) 188 | { 189 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 190 | 191 | await Easing.Create(new Vector3(5f, 0f, 0f), x => x / 2f) 192 | .Concat(Easing.Create(new Vector3(5f, 2f, 0f), x => x / 2f)) 193 | .Concat(Easing.Create(new Vector3(-5f, 0f, 0f), x => x / 2f)) 194 | .ToLocalPosition(cubes[0]); 195 | 196 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 197 | } 198 | } 199 | 200 | public async UniTask Sample12() 201 | { 202 | using (var cubes = new SampleCubes(new Vector3(0f, 0f, 0f))) 203 | { 204 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 205 | 206 | await Moving.AnimationCurve(sample12, 2f).ToLocalPositionX(cubes[0]); 207 | 208 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 209 | } 210 | } 211 | 212 | public async UniTask Sample13() 213 | { 214 | using (var cubes = new SampleCubes(new Vector3(-5f, 0f, 0f))) 215 | { 216 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 217 | 218 | var skipTokenSource = new SkipTokenSource(); 219 | Easing.Create(new Vector3(5f, 0f, 0f), 5f).ToLocalPosition(cubes[0], default, skipTokenSource.Token).Forget(); 220 | 221 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 222 | 223 | skipTokenSource.Skip(); 224 | 225 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 226 | } 227 | } 228 | } 229 | } 230 | -------------------------------------------------------------------------------- /Assets/Sample/Sample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f1112e3729690453bb28106332869ad0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Sample/Sample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8e97e8efcea34432dbcc6ec0c41f9263 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Sample/SampleMenu.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Cysharp.Threading.Tasks; 3 | using UnityEditor; 4 | using UnityEngine; 5 | using UnityEngine.UI; 6 | 7 | namespace AnimeTask.Sample 8 | { 9 | public class SampleMenu : MonoBehaviour 10 | { 11 | public Sample Sample; 12 | public Dropdown Dropdown; 13 | 14 | private readonly List list = new List 15 | { 16 | new Dropdown.OptionData("Sample01"), 17 | new Dropdown.OptionData("Sample02"), 18 | new Dropdown.OptionData("Sample03"), 19 | new Dropdown.OptionData("Sample04"), 20 | new Dropdown.OptionData("Sample05"), 21 | new Dropdown.OptionData("Sample06"), 22 | new Dropdown.OptionData("Sample07"), 23 | new Dropdown.OptionData("Sample08"), 24 | new Dropdown.OptionData("Sample09"), 25 | new Dropdown.OptionData("Sample10"), 26 | new Dropdown.OptionData("Sample11"), 27 | new Dropdown.OptionData("Sample12"), 28 | new Dropdown.OptionData("Sample13"), 29 | }; 30 | 31 | public void Start() 32 | { 33 | Dropdown.options = list; 34 | Dropdown.onValueChanged.AddListener(Play); 35 | Play(0); 36 | } 37 | 38 | private void Play(int index) 39 | { 40 | Debug.Log($"Play {list[index].text}"); 41 | Sample.Invoke(list[index].text, 0.0f); 42 | } 43 | } 44 | 45 | public static class SampleEditorMenu 46 | { 47 | [MenuItem("Test/Sample01")] 48 | public static void Sample01() 49 | { 50 | GameObject.Find("Sample").GetComponent().Sample01().Forget(); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Assets/Sample/SampleMenu.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3f58208be3020414085ce2784270fed9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Sample/SampleUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using Object = UnityEngine.Object; 5 | 6 | namespace AnimeTask.Sample 7 | { 8 | public static class Util 9 | { 10 | public static GameObject CreatePrimitiveCube(Vector3 position) 11 | { 12 | var cube = GameObject.CreatePrimitive(PrimitiveType.Cube); 13 | cube.transform.localPosition = position; 14 | return cube; 15 | } 16 | } 17 | 18 | public class SampleCubes : IDisposable 19 | { 20 | private readonly List cubes = new List(); 21 | public IReadOnlyList All => cubes; 22 | public GameObject this[int index] => cubes[index]; 23 | 24 | public SampleCubes(params Vector3[] positions) 25 | { 26 | foreach (var position in positions) 27 | { 28 | cubes.Add(Util.CreatePrimitiveCube(position)); 29 | } 30 | } 31 | 32 | public void Dispose() 33 | { 34 | foreach (var cube in cubes) 35 | { 36 | if (cube != null) 37 | { 38 | if (Application.isPlaying) Object.Destroy(cube); 39 | else Object.DestroyImmediate(cube); 40 | } 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Assets/Sample/SampleUtil.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 821b2446c8454335993eca096f2f349a 3 | timeCreated: 1538836600 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 kyubuns 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.cysharp.unitask": "ssh://git@github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask", 4 | "com.neuecc.unirx": "https://github.com/neuecc/UniRx.git?path=Assets/Plugins/UniRx/Scripts", 5 | "com.unity.2d.sprite": "1.0.0", 6 | "com.unity.ide.rider": "2.0.7", 7 | "com.unity.ide.visualstudio": "2.0.11", 8 | "com.unity.ide.vscode": "1.2.3", 9 | "com.unity.test-framework": "1.1.29", 10 | "com.unity.textmeshpro": "3.0.6", 11 | "com.unity.timeline": "1.4.8", 12 | "com.unity.ugui": "1.0.0", 13 | "com.unity.modules.ai": "1.0.0", 14 | "com.unity.modules.androidjni": "1.0.0", 15 | "com.unity.modules.animation": "1.0.0", 16 | "com.unity.modules.assetbundle": "1.0.0", 17 | "com.unity.modules.audio": "1.0.0", 18 | "com.unity.modules.cloth": "1.0.0", 19 | "com.unity.modules.director": "1.0.0", 20 | "com.unity.modules.imageconversion": "1.0.0", 21 | "com.unity.modules.imgui": "1.0.0", 22 | "com.unity.modules.jsonserialize": "1.0.0", 23 | "com.unity.modules.particlesystem": "1.0.0", 24 | "com.unity.modules.physics": "1.0.0", 25 | "com.unity.modules.physics2d": "1.0.0", 26 | "com.unity.modules.screencapture": "1.0.0", 27 | "com.unity.modules.terrain": "1.0.0", 28 | "com.unity.modules.terrainphysics": "1.0.0", 29 | "com.unity.modules.tilemap": "1.0.0", 30 | "com.unity.modules.ui": "1.0.0", 31 | "com.unity.modules.uielements": "1.0.0", 32 | "com.unity.modules.umbra": "1.0.0", 33 | "com.unity.modules.unityanalytics": "1.0.0", 34 | "com.unity.modules.unitywebrequest": "1.0.0", 35 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 36 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 37 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 38 | "com.unity.modules.unitywebrequestwww": "1.0.0", 39 | "com.unity.modules.vehicles": "1.0.0", 40 | "com.unity.modules.video": "1.0.0", 41 | "com.unity.modules.vr": "1.0.0", 42 | "com.unity.modules.wind": "1.0.0", 43 | "com.unity.modules.xr": "1.0.0" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Packages/packages-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.cysharp.unitask": { 4 | "version": "ssh://git@github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask", 5 | "depth": 0, 6 | "source": "git", 7 | "dependencies": {}, 8 | "hash": "3cc0c80b1e5949f10fafc170cc083207c8fba33f" 9 | }, 10 | "com.neuecc.unirx": { 11 | "version": "https://github.com/neuecc/UniRx.git?path=Assets/Plugins/UniRx/Scripts", 12 | "depth": 0, 13 | "source": "git", 14 | "dependencies": {}, 15 | "hash": "284d5c50d3f1ddd9fa7df3d382ea904732a9c2ff" 16 | }, 17 | "com.unity.2d.sprite": { 18 | "version": "1.0.0", 19 | "depth": 0, 20 | "source": "builtin", 21 | "dependencies": {} 22 | }, 23 | "com.unity.ext.nunit": { 24 | "version": "1.0.6", 25 | "depth": 1, 26 | "source": "registry", 27 | "dependencies": {}, 28 | "url": "https://packages.unity.com" 29 | }, 30 | "com.unity.ide.rider": { 31 | "version": "2.0.7", 32 | "depth": 0, 33 | "source": "registry", 34 | "dependencies": { 35 | "com.unity.test-framework": "1.1.1" 36 | }, 37 | "url": "https://packages.unity.com" 38 | }, 39 | "com.unity.ide.visualstudio": { 40 | "version": "2.0.11", 41 | "depth": 0, 42 | "source": "registry", 43 | "dependencies": { 44 | "com.unity.test-framework": "1.1.9" 45 | }, 46 | "url": "https://packages.unity.com" 47 | }, 48 | "com.unity.ide.vscode": { 49 | "version": "1.2.3", 50 | "depth": 0, 51 | "source": "registry", 52 | "dependencies": {}, 53 | "url": "https://packages.unity.com" 54 | }, 55 | "com.unity.test-framework": { 56 | "version": "1.1.29", 57 | "depth": 0, 58 | "source": "registry", 59 | "dependencies": { 60 | "com.unity.ext.nunit": "1.0.6", 61 | "com.unity.modules.imgui": "1.0.0", 62 | "com.unity.modules.jsonserialize": "1.0.0" 63 | }, 64 | "url": "https://packages.unity.com" 65 | }, 66 | "com.unity.textmeshpro": { 67 | "version": "3.0.6", 68 | "depth": 0, 69 | "source": "registry", 70 | "dependencies": { 71 | "com.unity.ugui": "1.0.0" 72 | }, 73 | "url": "https://packages.unity.com" 74 | }, 75 | "com.unity.timeline": { 76 | "version": "1.4.8", 77 | "depth": 0, 78 | "source": "registry", 79 | "dependencies": { 80 | "com.unity.modules.director": "1.0.0", 81 | "com.unity.modules.animation": "1.0.0", 82 | "com.unity.modules.audio": "1.0.0", 83 | "com.unity.modules.particlesystem": "1.0.0" 84 | }, 85 | "url": "https://packages.unity.com" 86 | }, 87 | "com.unity.ugui": { 88 | "version": "1.0.0", 89 | "depth": 0, 90 | "source": "builtin", 91 | "dependencies": { 92 | "com.unity.modules.ui": "1.0.0", 93 | "com.unity.modules.imgui": "1.0.0" 94 | } 95 | }, 96 | "com.unity.modules.ai": { 97 | "version": "1.0.0", 98 | "depth": 0, 99 | "source": "builtin", 100 | "dependencies": {} 101 | }, 102 | "com.unity.modules.androidjni": { 103 | "version": "1.0.0", 104 | "depth": 0, 105 | "source": "builtin", 106 | "dependencies": {} 107 | }, 108 | "com.unity.modules.animation": { 109 | "version": "1.0.0", 110 | "depth": 0, 111 | "source": "builtin", 112 | "dependencies": {} 113 | }, 114 | "com.unity.modules.assetbundle": { 115 | "version": "1.0.0", 116 | "depth": 0, 117 | "source": "builtin", 118 | "dependencies": {} 119 | }, 120 | "com.unity.modules.audio": { 121 | "version": "1.0.0", 122 | "depth": 0, 123 | "source": "builtin", 124 | "dependencies": {} 125 | }, 126 | "com.unity.modules.cloth": { 127 | "version": "1.0.0", 128 | "depth": 0, 129 | "source": "builtin", 130 | "dependencies": { 131 | "com.unity.modules.physics": "1.0.0" 132 | } 133 | }, 134 | "com.unity.modules.director": { 135 | "version": "1.0.0", 136 | "depth": 0, 137 | "source": "builtin", 138 | "dependencies": { 139 | "com.unity.modules.audio": "1.0.0", 140 | "com.unity.modules.animation": "1.0.0" 141 | } 142 | }, 143 | "com.unity.modules.imageconversion": { 144 | "version": "1.0.0", 145 | "depth": 0, 146 | "source": "builtin", 147 | "dependencies": {} 148 | }, 149 | "com.unity.modules.imgui": { 150 | "version": "1.0.0", 151 | "depth": 0, 152 | "source": "builtin", 153 | "dependencies": {} 154 | }, 155 | "com.unity.modules.jsonserialize": { 156 | "version": "1.0.0", 157 | "depth": 0, 158 | "source": "builtin", 159 | "dependencies": {} 160 | }, 161 | "com.unity.modules.particlesystem": { 162 | "version": "1.0.0", 163 | "depth": 0, 164 | "source": "builtin", 165 | "dependencies": {} 166 | }, 167 | "com.unity.modules.physics": { 168 | "version": "1.0.0", 169 | "depth": 0, 170 | "source": "builtin", 171 | "dependencies": {} 172 | }, 173 | "com.unity.modules.physics2d": { 174 | "version": "1.0.0", 175 | "depth": 0, 176 | "source": "builtin", 177 | "dependencies": {} 178 | }, 179 | "com.unity.modules.screencapture": { 180 | "version": "1.0.0", 181 | "depth": 0, 182 | "source": "builtin", 183 | "dependencies": { 184 | "com.unity.modules.imageconversion": "1.0.0" 185 | } 186 | }, 187 | "com.unity.modules.subsystems": { 188 | "version": "1.0.0", 189 | "depth": 1, 190 | "source": "builtin", 191 | "dependencies": { 192 | "com.unity.modules.jsonserialize": "1.0.0" 193 | } 194 | }, 195 | "com.unity.modules.terrain": { 196 | "version": "1.0.0", 197 | "depth": 0, 198 | "source": "builtin", 199 | "dependencies": {} 200 | }, 201 | "com.unity.modules.terrainphysics": { 202 | "version": "1.0.0", 203 | "depth": 0, 204 | "source": "builtin", 205 | "dependencies": { 206 | "com.unity.modules.physics": "1.0.0", 207 | "com.unity.modules.terrain": "1.0.0" 208 | } 209 | }, 210 | "com.unity.modules.tilemap": { 211 | "version": "1.0.0", 212 | "depth": 0, 213 | "source": "builtin", 214 | "dependencies": { 215 | "com.unity.modules.physics2d": "1.0.0" 216 | } 217 | }, 218 | "com.unity.modules.ui": { 219 | "version": "1.0.0", 220 | "depth": 0, 221 | "source": "builtin", 222 | "dependencies": {} 223 | }, 224 | "com.unity.modules.uielements": { 225 | "version": "1.0.0", 226 | "depth": 0, 227 | "source": "builtin", 228 | "dependencies": { 229 | "com.unity.modules.ui": "1.0.0", 230 | "com.unity.modules.imgui": "1.0.0", 231 | "com.unity.modules.jsonserialize": "1.0.0", 232 | "com.unity.modules.uielementsnative": "1.0.0" 233 | } 234 | }, 235 | "com.unity.modules.uielementsnative": { 236 | "version": "1.0.0", 237 | "depth": 1, 238 | "source": "builtin", 239 | "dependencies": { 240 | "com.unity.modules.ui": "1.0.0", 241 | "com.unity.modules.imgui": "1.0.0", 242 | "com.unity.modules.jsonserialize": "1.0.0" 243 | } 244 | }, 245 | "com.unity.modules.umbra": { 246 | "version": "1.0.0", 247 | "depth": 0, 248 | "source": "builtin", 249 | "dependencies": {} 250 | }, 251 | "com.unity.modules.unityanalytics": { 252 | "version": "1.0.0", 253 | "depth": 0, 254 | "source": "builtin", 255 | "dependencies": { 256 | "com.unity.modules.unitywebrequest": "1.0.0", 257 | "com.unity.modules.jsonserialize": "1.0.0" 258 | } 259 | }, 260 | "com.unity.modules.unitywebrequest": { 261 | "version": "1.0.0", 262 | "depth": 0, 263 | "source": "builtin", 264 | "dependencies": {} 265 | }, 266 | "com.unity.modules.unitywebrequestassetbundle": { 267 | "version": "1.0.0", 268 | "depth": 0, 269 | "source": "builtin", 270 | "dependencies": { 271 | "com.unity.modules.assetbundle": "1.0.0", 272 | "com.unity.modules.unitywebrequest": "1.0.0" 273 | } 274 | }, 275 | "com.unity.modules.unitywebrequestaudio": { 276 | "version": "1.0.0", 277 | "depth": 0, 278 | "source": "builtin", 279 | "dependencies": { 280 | "com.unity.modules.unitywebrequest": "1.0.0", 281 | "com.unity.modules.audio": "1.0.0" 282 | } 283 | }, 284 | "com.unity.modules.unitywebrequesttexture": { 285 | "version": "1.0.0", 286 | "depth": 0, 287 | "source": "builtin", 288 | "dependencies": { 289 | "com.unity.modules.unitywebrequest": "1.0.0", 290 | "com.unity.modules.imageconversion": "1.0.0" 291 | } 292 | }, 293 | "com.unity.modules.unitywebrequestwww": { 294 | "version": "1.0.0", 295 | "depth": 0, 296 | "source": "builtin", 297 | "dependencies": { 298 | "com.unity.modules.unitywebrequest": "1.0.0", 299 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 300 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 301 | "com.unity.modules.audio": "1.0.0", 302 | "com.unity.modules.assetbundle": "1.0.0", 303 | "com.unity.modules.imageconversion": "1.0.0" 304 | } 305 | }, 306 | "com.unity.modules.vehicles": { 307 | "version": "1.0.0", 308 | "depth": 0, 309 | "source": "builtin", 310 | "dependencies": { 311 | "com.unity.modules.physics": "1.0.0" 312 | } 313 | }, 314 | "com.unity.modules.video": { 315 | "version": "1.0.0", 316 | "depth": 0, 317 | "source": "builtin", 318 | "dependencies": { 319 | "com.unity.modules.audio": "1.0.0", 320 | "com.unity.modules.ui": "1.0.0", 321 | "com.unity.modules.unitywebrequest": "1.0.0" 322 | } 323 | }, 324 | "com.unity.modules.vr": { 325 | "version": "1.0.0", 326 | "depth": 0, 327 | "source": "builtin", 328 | "dependencies": { 329 | "com.unity.modules.jsonserialize": "1.0.0", 330 | "com.unity.modules.physics": "1.0.0", 331 | "com.unity.modules.xr": "1.0.0" 332 | } 333 | }, 334 | "com.unity.modules.wind": { 335 | "version": "1.0.0", 336 | "depth": 0, 337 | "source": "builtin", 338 | "dependencies": {} 339 | }, 340 | "com.unity.modules.xr": { 341 | "version": "1.0.0", 342 | "depth": 0, 343 | "source": "builtin", 344 | "dependencies": { 345 | "com.unity.modules.physics": "1.0.0", 346 | "com.unity.modules.jsonserialize": "1.0.0", 347 | "com.unity.modules.subsystems": "1.0.0" 348 | } 349 | } 350 | } 351 | } 352 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 1024 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_AmbisonicDecoderPlugin: 16 | m_DisableAudio: 0 17 | m_VirtualizeEffects: 1 18 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 8 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ClothInterCollisionSettingsToggle: 0 24 | m_ContactPairsMode: 0 25 | m_BroadphaseType: 0 26 | m_WorldBounds: 27 | m_Center: {x: 0, y: 0, z: 0} 28 | m_Extent: {x: 250, y: 250, z: 250} 29 | m_WorldSubdivisions: 8 30 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/AnimeTask/Sample/Sample.unity 10 | guid: 8e97e8efcea34432dbcc6ec0c41f9263 11 | m_configObjects: {} 12 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 9 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_PrefabRegularEnvironment: {fileID: 0} 12 | m_PrefabUIEnvironment: {fileID: 0} 13 | m_SpritePackerMode: 0 14 | m_SpritePackerPaddingPower: 1 15 | m_EtcTextureCompressorBehavior: 1 16 | m_EtcTextureFastCompressor: 1 17 | m_EtcTextureNormalCompressor: 2 18 | m_EtcTextureBestCompressor: 4 19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;asmref 20 | m_ProjectGenerationRootNamespace: 21 | m_CollabEditorSettings: 22 | inProgressEnabled: 1 23 | m_EnableTextureStreamingInEditMode: 1 24 | m_EnableTextureStreamingInPlayMode: 1 25 | m_AsyncShaderCompilation: 1 26 | m_EnterPlayModeOptionsEnabled: 0 27 | m_EnterPlayModeOptions: 3 28 | m_ShowLightmapResolutionOverlay: 1 29 | m_UseLegacyProbeSampleCount: 1 30 | m_AssetPipelineMode: 1 31 | m_CacheServerMode: 0 32 | m_CacheServerEndpoint: 33 | m_CacheServerNamespacePrefix: default 34 | m_CacheServerEnableDownload: 1 35 | m_CacheServerEnableUpload: 1 36 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0} 39 | m_PreloadedShaders: [] 40 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 41 | type: 0} 42 | m_CustomRenderPipeline: {fileID: 0} 43 | m_TransparencySortMode: 0 44 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 45 | m_DefaultRenderingPath: 1 46 | m_DefaultMobileRenderingPath: 1 47 | m_TierSettings: [] 48 | m_LightmapStripping: 0 49 | m_FogStripping: 0 50 | m_InstancingStripping: 0 51 | m_LightmapKeepPlain: 1 52 | m_LightmapKeepDirCombined: 1 53 | m_LightmapKeepDynamicPlain: 1 54 | m_LightmapKeepDynamicDirCombined: 1 55 | m_LightmapKeepShadowMask: 1 56 | m_LightmapKeepSubtractive: 1 57 | m_FogKeepLinear: 1 58 | m_FogKeepExp: 1 59 | m_FogKeepExp2: 1 60 | m_AlbedoSwatchInfos: [] 61 | m_LightsUseLinearIntensity: 0 62 | m_LightsUseColorTemperature: 0 63 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_ScopedRegistriesSettingsExpanded: 1 16 | oneTimeWarningShown: 0 17 | m_Registries: 18 | - m_Id: main 19 | m_Name: 20 | m_Url: https://packages.unity.com 21 | m_Scopes: [] 22 | m_IsDefault: 1 23 | m_UserSelectedRegistryName: 24 | m_UserAddingNewScopedRegistry: 0 25 | m_RegistryInfoDraft: 26 | m_ErrorMessage: 27 | m_Original: 28 | m_Id: 29 | m_Name: 30 | m_Url: 31 | m_Scopes: [] 32 | m_IsDefault: 0 33 | m_Modified: 0 34 | m_Name: 35 | m_Url: 36 | m_Scopes: 37 | - 38 | m_SelectedScopeIndex: 0 39 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_AutoSyncTransforms: 0 28 | m_AlwaysShowColliders: 0 29 | m_ShowColliderSleep: 1 30 | m_ShowColliderContacts: 0 31 | m_ShowColliderAABB: 0 32 | m_ContactArrowScale: 0.2 33 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 34 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 35 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 36 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 37 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 38 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: 7 | - type: 8 | m_NativeTypeID: 108 9 | m_ManagedTypePPtr: {fileID: 0} 10 | m_ManagedTypeFallback: 11 | defaultPresets: 12 | - m_Preset: {fileID: 2655988077585873504, guid: c1cf8506f04ef2c4a88b64b6c4202eea, 13 | type: 2} 14 | - type: 15 | m_NativeTypeID: 1020 16 | m_ManagedTypePPtr: {fileID: 0} 17 | m_ManagedTypeFallback: 18 | defaultPresets: 19 | - m_Preset: {fileID: 2655988077585873504, guid: 0cd792cc87e492d43b4e95b205fc5cc6, 20 | type: 2} 21 | - type: 22 | m_NativeTypeID: 1006 23 | m_ManagedTypePPtr: {fileID: 0} 24 | m_ManagedTypeFallback: 25 | defaultPresets: 26 | - m_Preset: {fileID: 2655988077585873504, guid: 7a99f8aa944efe94cb9bd74562b7d5f9, 27 | type: 2} 28 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 15 7 | productGUID: 911dfea55610f4930aa3652a2c656b09 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | AndroidEnableSustainedPerformanceMode: 0 11 | defaultScreenOrientation: 4 12 | targetDevice: 2 13 | useOnDemandResources: 0 14 | accelerometerFrequency: 60 15 | companyName: DefaultCompany 16 | productName: AnimeTask 17 | defaultCursor: {fileID: 0} 18 | cursorHotspot: {x: 0, y: 0} 19 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 20 | m_ShowUnitySplashScreen: 1 21 | m_ShowUnitySplashLogo: 1 22 | m_SplashScreenOverlayOpacity: 1 23 | m_SplashScreenAnimation: 1 24 | m_SplashScreenLogoStyle: 1 25 | m_SplashScreenDrawMode: 0 26 | m_SplashScreenBackgroundAnimationZoom: 1 27 | m_SplashScreenLogoAnimationZoom: 1 28 | m_SplashScreenBackgroundLandscapeAspect: 1 29 | m_SplashScreenBackgroundPortraitAspect: 1 30 | m_SplashScreenBackgroundLandscapeUvs: 31 | serializedVersion: 2 32 | x: 0 33 | y: 0 34 | width: 1 35 | height: 1 36 | m_SplashScreenBackgroundPortraitUvs: 37 | serializedVersion: 2 38 | x: 0 39 | y: 0 40 | width: 1 41 | height: 1 42 | m_SplashScreenLogos: [] 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 1024 46 | defaultScreenHeight: 768 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 0 51 | m_MTRendering: 1 52 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 53 | iosShowActivityIndicatorOnLoading: -1 54 | androidShowActivityIndicatorOnLoading: -1 55 | iosAppInBackgroundBehavior: 0 56 | displayResolutionDialog: 1 57 | iosAllowHTTPDownload: 1 58 | allowedAutorotateToPortrait: 1 59 | allowedAutorotateToPortraitUpsideDown: 1 60 | allowedAutorotateToLandscapeRight: 1 61 | allowedAutorotateToLandscapeLeft: 1 62 | useOSAutorotation: 1 63 | use32BitDisplayBuffer: 1 64 | preserveFramebufferAlpha: 0 65 | disableDepthAndStencilBuffers: 0 66 | androidStartInFullscreen: 1 67 | androidBlitType: 0 68 | defaultIsNativeResolution: 1 69 | macRetinaSupport: 1 70 | runInBackground: 1 71 | captureSingleScreen: 0 72 | muteOtherAudioSources: 0 73 | Prepare IOS For Recording: 0 74 | Force IOS Speakers When Recording: 0 75 | deferSystemGesturesMode: 0 76 | hideHomeButton: 0 77 | submitAnalytics: 1 78 | usePlayerLog: 1 79 | bakeCollisionMeshes: 0 80 | forceSingleInstance: 0 81 | resizableWindow: 0 82 | useMacAppStoreValidation: 0 83 | macAppStoreCategory: public.app-category.games 84 | gpuSkinning: 1 85 | graphicsJobs: 0 86 | xboxPIXTextureCapture: 0 87 | xboxEnableAvatar: 0 88 | xboxEnableKinect: 0 89 | xboxEnableKinectAutoTracking: 0 90 | xboxEnableFitness: 0 91 | visibleInBackground: 1 92 | allowFullscreenSwitch: 1 93 | graphicsJobMode: 0 94 | fullscreenMode: 1 95 | xboxSpeechDB: 0 96 | xboxEnableHeadOrientation: 0 97 | xboxEnableGuest: 0 98 | xboxEnablePIXSampling: 0 99 | metalFramebufferOnly: 0 100 | xboxOneResolution: 0 101 | xboxOneSResolution: 0 102 | xboxOneXResolution: 3 103 | xboxOneMonoLoggingLevel: 0 104 | xboxOneLoggingLevel: 1 105 | xboxOneDisableEsram: 0 106 | xboxOnePresentImmediateThreshold: 0 107 | switchQueueCommandMemory: 0 108 | vulkanEnableSetSRGBWrite: 0 109 | m_SupportedAspectRatios: 110 | 4:3: 1 111 | 5:4: 1 112 | 16:10: 1 113 | 16:9: 1 114 | Others: 1 115 | bundleVersion: 0.1 116 | preloadedAssets: [] 117 | metroInputSource: 0 118 | wsaTransparentSwapchain: 0 119 | m_HolographicPauseOnTrackingLoss: 1 120 | xboxOneDisableKinectGpuReservation: 0 121 | xboxOneEnable7thCore: 0 122 | vrSettings: 123 | cardboard: 124 | depthFormat: 0 125 | enableTransitionView: 0 126 | daydream: 127 | depthFormat: 0 128 | useSustainedPerformanceMode: 0 129 | enableVideoLayer: 0 130 | useProtectedVideoMemory: 0 131 | minimumSupportedHeadTracking: 0 132 | maximumSupportedHeadTracking: 1 133 | hololens: 134 | depthFormat: 1 135 | depthBufferSharingEnabled: 0 136 | oculus: 137 | sharedDepthBuffer: 0 138 | dashSupport: 0 139 | enable360StereoCapture: 0 140 | protectGraphicsMemory: 0 141 | enableFrameTimingStats: 0 142 | useHDRDisplay: 0 143 | m_ColorGamuts: 00000000 144 | targetPixelDensity: 30 145 | resolutionScalingMode: 0 146 | androidSupportedAspectRatio: 1 147 | androidMaxAspectRatio: 2.1 148 | applicationIdentifier: {} 149 | buildNumber: {} 150 | AndroidBundleVersionCode: 1 151 | AndroidMinSdkVersion: 16 152 | AndroidTargetSdkVersion: 0 153 | AndroidPreferredInstallLocation: 1 154 | aotOptions: 155 | stripEngineCode: 1 156 | iPhoneStrippingLevel: 0 157 | iPhoneScriptCallOptimization: 0 158 | ForceInternetPermission: 0 159 | ForceSDCardPermission: 0 160 | CreateWallpaper: 0 161 | APKExpansionFiles: 0 162 | keepLoadedShadersAlive: 0 163 | StripUnusedMeshComponents: 1 164 | VertexChannelCompressionMask: 4054 165 | iPhoneSdkVersion: 988 166 | iOSTargetOSVersionString: 8.0 167 | tvOSSdkVersion: 0 168 | tvOSRequireExtendedGameController: 0 169 | tvOSTargetOSVersionString: 9.0 170 | uIPrerenderedIcon: 0 171 | uIRequiresPersistentWiFi: 0 172 | uIRequiresFullScreen: 1 173 | uIStatusBarHidden: 1 174 | uIExitOnSuspend: 0 175 | uIStatusBarStyle: 0 176 | iPhoneSplashScreen: {fileID: 0} 177 | iPhoneHighResSplashScreen: {fileID: 0} 178 | iPhoneTallHighResSplashScreen: {fileID: 0} 179 | iPhone47inSplashScreen: {fileID: 0} 180 | iPhone55inPortraitSplashScreen: {fileID: 0} 181 | iPhone55inLandscapeSplashScreen: {fileID: 0} 182 | iPhone58inPortraitSplashScreen: {fileID: 0} 183 | iPhone58inLandscapeSplashScreen: {fileID: 0} 184 | iPadPortraitSplashScreen: {fileID: 0} 185 | iPadHighResPortraitSplashScreen: {fileID: 0} 186 | iPadLandscapeSplashScreen: {fileID: 0} 187 | iPadHighResLandscapeSplashScreen: {fileID: 0} 188 | appleTVSplashScreen: {fileID: 0} 189 | appleTVSplashScreen2x: {fileID: 0} 190 | tvOSSmallIconLayers: [] 191 | tvOSSmallIconLayers2x: [] 192 | tvOSLargeIconLayers: [] 193 | tvOSLargeIconLayers2x: [] 194 | tvOSTopShelfImageLayers: [] 195 | tvOSTopShelfImageLayers2x: [] 196 | tvOSTopShelfImageWideLayers: [] 197 | tvOSTopShelfImageWideLayers2x: [] 198 | iOSLaunchScreenType: 0 199 | iOSLaunchScreenPortrait: {fileID: 0} 200 | iOSLaunchScreenLandscape: {fileID: 0} 201 | iOSLaunchScreenBackgroundColor: 202 | serializedVersion: 2 203 | rgba: 0 204 | iOSLaunchScreenFillPct: 100 205 | iOSLaunchScreenSize: 100 206 | iOSLaunchScreenCustomXibPath: 207 | iOSLaunchScreeniPadType: 0 208 | iOSLaunchScreeniPadImage: {fileID: 0} 209 | iOSLaunchScreeniPadBackgroundColor: 210 | serializedVersion: 2 211 | rgba: 0 212 | iOSLaunchScreeniPadFillPct: 100 213 | iOSLaunchScreeniPadSize: 100 214 | iOSLaunchScreeniPadCustomXibPath: 215 | iOSUseLaunchScreenStoryboard: 0 216 | iOSLaunchScreenCustomStoryboardPath: 217 | iOSDeviceRequirements: [] 218 | iOSURLSchemes: [] 219 | iOSBackgroundModes: 0 220 | iOSMetalForceHardShadows: 0 221 | metalEditorSupport: 1 222 | metalAPIValidation: 1 223 | iOSRenderExtraFrameOnPause: 0 224 | appleDeveloperTeamID: 225 | iOSManualSigningProvisioningProfileID: 226 | tvOSManualSigningProvisioningProfileID: 227 | iOSManualSigningProvisioningProfileType: 0 228 | tvOSManualSigningProvisioningProfileType: 0 229 | appleEnableAutomaticSigning: 0 230 | iOSRequireARKit: 0 231 | appleEnableProMotion: 0 232 | clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea 233 | templatePackageId: com.unity.template.3d@1.0.3 234 | templateDefaultScene: Assets/Scenes/SampleScene.unity 235 | AndroidTargetArchitectures: 5 236 | AndroidSplashScreenScale: 0 237 | androidSplashScreen: {fileID: 0} 238 | AndroidKeystoreName: 239 | AndroidKeyaliasName: 240 | AndroidBuildApkPerCpuArchitecture: 0 241 | AndroidTVCompatibility: 1 242 | AndroidIsGame: 1 243 | AndroidEnableTango: 0 244 | androidEnableBanner: 1 245 | androidUseLowAccuracyLocation: 0 246 | m_AndroidBanners: 247 | - width: 320 248 | height: 180 249 | banner: {fileID: 0} 250 | androidGamepadSupportLevel: 0 251 | AndroidJvmMaxHeapSize: 4096 252 | resolutionDialogBanner: {fileID: 0} 253 | m_BuildTargetIcons: [] 254 | m_BuildTargetPlatformIcons: [] 255 | m_BuildTargetBatching: 256 | - m_BuildTarget: Standalone 257 | m_StaticBatching: 1 258 | m_DynamicBatching: 0 259 | - m_BuildTarget: tvOS 260 | m_StaticBatching: 1 261 | m_DynamicBatching: 0 262 | - m_BuildTarget: Android 263 | m_StaticBatching: 1 264 | m_DynamicBatching: 0 265 | - m_BuildTarget: iPhone 266 | m_StaticBatching: 1 267 | m_DynamicBatching: 0 268 | - m_BuildTarget: WebGL 269 | m_StaticBatching: 0 270 | m_DynamicBatching: 0 271 | m_BuildTargetGraphicsAPIs: 272 | - m_BuildTarget: AndroidPlayer 273 | m_APIs: 0b00000008000000 274 | m_Automatic: 1 275 | - m_BuildTarget: iOSSupport 276 | m_APIs: 10000000 277 | m_Automatic: 1 278 | - m_BuildTarget: AppleTVSupport 279 | m_APIs: 10000000 280 | m_Automatic: 0 281 | - m_BuildTarget: WebGLSupport 282 | m_APIs: 0b000000 283 | m_Automatic: 1 284 | m_BuildTargetVRSettings: 285 | - m_BuildTarget: Standalone 286 | m_Enabled: 0 287 | m_Devices: 288 | - Oculus 289 | - OpenVR 290 | m_BuildTargetEnableVuforiaSettings: [] 291 | openGLRequireES31: 0 292 | openGLRequireES31AEP: 0 293 | m_TemplateCustomTags: {} 294 | mobileMTRendering: 295 | Android: 1 296 | iPhone: 1 297 | tvOS: 1 298 | m_BuildTargetGroupLightmapEncodingQuality: [] 299 | m_BuildTargetGroupLightmapSettings: [] 300 | playModeTestRunnerEnabled: 0 301 | runPlayModeTestAsEditModeTest: 0 302 | actionOnDotNetUnhandledException: 1 303 | enableInternalProfiler: 0 304 | logObjCUncaughtExceptions: 1 305 | enableCrashReportAPI: 0 306 | cameraUsageDescription: 307 | locationUsageDescription: 308 | microphoneUsageDescription: 309 | switchNetLibKey: 310 | switchSocketMemoryPoolSize: 6144 311 | switchSocketAllocatorPoolSize: 128 312 | switchSocketConcurrencyLimit: 14 313 | switchScreenResolutionBehavior: 2 314 | switchUseCPUProfiler: 0 315 | switchApplicationID: 0x01004b9000490000 316 | switchNSODependencies: 317 | switchTitleNames_0: 318 | switchTitleNames_1: 319 | switchTitleNames_2: 320 | switchTitleNames_3: 321 | switchTitleNames_4: 322 | switchTitleNames_5: 323 | switchTitleNames_6: 324 | switchTitleNames_7: 325 | switchTitleNames_8: 326 | switchTitleNames_9: 327 | switchTitleNames_10: 328 | switchTitleNames_11: 329 | switchTitleNames_12: 330 | switchTitleNames_13: 331 | switchTitleNames_14: 332 | switchPublisherNames_0: 333 | switchPublisherNames_1: 334 | switchPublisherNames_2: 335 | switchPublisherNames_3: 336 | switchPublisherNames_4: 337 | switchPublisherNames_5: 338 | switchPublisherNames_6: 339 | switchPublisherNames_7: 340 | switchPublisherNames_8: 341 | switchPublisherNames_9: 342 | switchPublisherNames_10: 343 | switchPublisherNames_11: 344 | switchPublisherNames_12: 345 | switchPublisherNames_13: 346 | switchPublisherNames_14: 347 | switchIcons_0: {fileID: 0} 348 | switchIcons_1: {fileID: 0} 349 | switchIcons_2: {fileID: 0} 350 | switchIcons_3: {fileID: 0} 351 | switchIcons_4: {fileID: 0} 352 | switchIcons_5: {fileID: 0} 353 | switchIcons_6: {fileID: 0} 354 | switchIcons_7: {fileID: 0} 355 | switchIcons_8: {fileID: 0} 356 | switchIcons_9: {fileID: 0} 357 | switchIcons_10: {fileID: 0} 358 | switchIcons_11: {fileID: 0} 359 | switchIcons_12: {fileID: 0} 360 | switchIcons_13: {fileID: 0} 361 | switchIcons_14: {fileID: 0} 362 | switchSmallIcons_0: {fileID: 0} 363 | switchSmallIcons_1: {fileID: 0} 364 | switchSmallIcons_2: {fileID: 0} 365 | switchSmallIcons_3: {fileID: 0} 366 | switchSmallIcons_4: {fileID: 0} 367 | switchSmallIcons_5: {fileID: 0} 368 | switchSmallIcons_6: {fileID: 0} 369 | switchSmallIcons_7: {fileID: 0} 370 | switchSmallIcons_8: {fileID: 0} 371 | switchSmallIcons_9: {fileID: 0} 372 | switchSmallIcons_10: {fileID: 0} 373 | switchSmallIcons_11: {fileID: 0} 374 | switchSmallIcons_12: {fileID: 0} 375 | switchSmallIcons_13: {fileID: 0} 376 | switchSmallIcons_14: {fileID: 0} 377 | switchManualHTML: 378 | switchAccessibleURLs: 379 | switchLegalInformation: 380 | switchMainThreadStackSize: 1048576 381 | switchPresenceGroupId: 382 | switchLogoHandling: 0 383 | switchReleaseVersion: 0 384 | switchDisplayVersion: 1.0.0 385 | switchStartupUserAccount: 0 386 | switchTouchScreenUsage: 0 387 | switchSupportedLanguagesMask: 0 388 | switchLogoType: 0 389 | switchApplicationErrorCodeCategory: 390 | switchUserAccountSaveDataSize: 0 391 | switchUserAccountSaveDataJournalSize: 0 392 | switchApplicationAttribute: 0 393 | switchCardSpecSize: -1 394 | switchCardSpecClock: -1 395 | switchRatingsMask: 0 396 | switchRatingsInt_0: 0 397 | switchRatingsInt_1: 0 398 | switchRatingsInt_2: 0 399 | switchRatingsInt_3: 0 400 | switchRatingsInt_4: 0 401 | switchRatingsInt_5: 0 402 | switchRatingsInt_6: 0 403 | switchRatingsInt_7: 0 404 | switchRatingsInt_8: 0 405 | switchRatingsInt_9: 0 406 | switchRatingsInt_10: 0 407 | switchRatingsInt_11: 0 408 | switchLocalCommunicationIds_0: 409 | switchLocalCommunicationIds_1: 410 | switchLocalCommunicationIds_2: 411 | switchLocalCommunicationIds_3: 412 | switchLocalCommunicationIds_4: 413 | switchLocalCommunicationIds_5: 414 | switchLocalCommunicationIds_6: 415 | switchLocalCommunicationIds_7: 416 | switchParentalControl: 0 417 | switchAllowsScreenshot: 1 418 | switchAllowsVideoCapturing: 1 419 | switchAllowsRuntimeAddOnContentInstall: 0 420 | switchDataLossConfirmation: 0 421 | switchSupportedNpadStyles: 3 422 | switchNativeFsCacheSize: 32 423 | switchIsHoldTypeHorizontal: 0 424 | switchSupportedNpadCount: 8 425 | switchSocketConfigEnabled: 0 426 | switchTcpInitialSendBufferSize: 32 427 | switchTcpInitialReceiveBufferSize: 64 428 | switchTcpAutoSendBufferSizeMax: 256 429 | switchTcpAutoReceiveBufferSizeMax: 256 430 | switchUdpSendBufferSize: 9 431 | switchUdpReceiveBufferSize: 42 432 | switchSocketBufferEfficiency: 4 433 | switchSocketInitializeEnabled: 1 434 | switchNetworkInterfaceManagerInitializeEnabled: 1 435 | switchPlayerConnectionEnabled: 1 436 | ps4NPAgeRating: 12 437 | ps4NPTitleSecret: 438 | ps4NPTrophyPackPath: 439 | ps4ParentalLevel: 11 440 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 441 | ps4Category: 0 442 | ps4MasterVersion: 01.00 443 | ps4AppVersion: 01.00 444 | ps4AppType: 0 445 | ps4ParamSfxPath: 446 | ps4VideoOutPixelFormat: 0 447 | ps4VideoOutInitialWidth: 1920 448 | ps4VideoOutBaseModeInitialWidth: 1920 449 | ps4VideoOutReprojectionRate: 60 450 | ps4PronunciationXMLPath: 451 | ps4PronunciationSIGPath: 452 | ps4BackgroundImagePath: 453 | ps4StartupImagePath: 454 | ps4StartupImagesFolder: 455 | ps4IconImagesFolder: 456 | ps4SaveDataImagePath: 457 | ps4SdkOverride: 458 | ps4BGMPath: 459 | ps4ShareFilePath: 460 | ps4ShareOverlayImagePath: 461 | ps4PrivacyGuardImagePath: 462 | ps4NPtitleDatPath: 463 | ps4RemotePlayKeyAssignment: -1 464 | ps4RemotePlayKeyMappingDir: 465 | ps4PlayTogetherPlayerCount: 0 466 | ps4EnterButtonAssignment: 1 467 | ps4ApplicationParam1: 0 468 | ps4ApplicationParam2: 0 469 | ps4ApplicationParam3: 0 470 | ps4ApplicationParam4: 0 471 | ps4DownloadDataSize: 0 472 | ps4GarlicHeapSize: 2048 473 | ps4ProGarlicHeapSize: 2560 474 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 475 | ps4pnSessions: 1 476 | ps4pnPresence: 1 477 | ps4pnFriends: 1 478 | ps4pnGameCustomData: 1 479 | playerPrefsSupport: 0 480 | enableApplicationExit: 0 481 | resetTempFolder: 1 482 | restrictedAudioUsageRights: 0 483 | ps4UseResolutionFallback: 0 484 | ps4ReprojectionSupport: 0 485 | ps4UseAudio3dBackend: 0 486 | ps4SocialScreenEnabled: 0 487 | ps4ScriptOptimizationLevel: 0 488 | ps4Audio3dVirtualSpeakerCount: 14 489 | ps4attribCpuUsage: 0 490 | ps4PatchPkgPath: 491 | ps4PatchLatestPkgPath: 492 | ps4PatchChangeinfoPath: 493 | ps4PatchDayOne: 0 494 | ps4attribUserManagement: 0 495 | ps4attribMoveSupport: 0 496 | ps4attrib3DSupport: 0 497 | ps4attribShareSupport: 0 498 | ps4attribExclusiveVR: 0 499 | ps4disableAutoHideSplash: 0 500 | ps4videoRecordingFeaturesUsed: 0 501 | ps4contentSearchFeaturesUsed: 0 502 | ps4attribEyeToEyeDistanceSettingVR: 0 503 | ps4IncludedModules: [] 504 | monoEnv: 505 | splashScreenBackgroundSourceLandscape: {fileID: 0} 506 | splashScreenBackgroundSourcePortrait: {fileID: 0} 507 | spritePackerPolicy: 508 | webGLMemorySize: 256 509 | webGLExceptionSupport: 1 510 | webGLNameFilesAsHashes: 0 511 | webGLDataCaching: 1 512 | webGLDebugSymbols: 0 513 | webGLEmscriptenArgs: 514 | webGLModulesDirectory: 515 | webGLTemplate: APPLICATION:Default 516 | webGLAnalyzeBuildSize: 0 517 | webGLUseEmbeddedResources: 0 518 | webGLCompressionFormat: 1 519 | webGLLinkerTarget: 1 520 | webGLThreadsSupport: 0 521 | scriptingDefineSymbols: {} 522 | platformArchitecture: {} 523 | scriptingBackend: {} 524 | il2cppCompilerConfiguration: {} 525 | managedStrippingLevel: {} 526 | incrementalIl2cppBuild: {} 527 | allowUnsafeCode: 0 528 | additionalIl2CppArgs: 529 | scriptingRuntimeVersion: 1 530 | apiCompatibilityLevelPerPlatform: {} 531 | m_RenderingPath: 1 532 | m_MobileRenderingPath: 1 533 | metroPackageName: Template_3D 534 | metroPackageVersion: 535 | metroCertificatePath: 536 | metroCertificatePassword: 537 | metroCertificateSubject: 538 | metroCertificateIssuer: 539 | metroCertificateNotAfter: 0000000000000000 540 | metroApplicationDescription: Template_3D 541 | wsaImages: {} 542 | metroTileShortName: 543 | metroTileShowName: 0 544 | metroMediumTileShowName: 0 545 | metroLargeTileShowName: 0 546 | metroWideTileShowName: 0 547 | metroSupportStreamingInstall: 0 548 | metroLastRequiredScene: 0 549 | metroDefaultTileSize: 1 550 | metroTileForegroundText: 2 551 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 552 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, a: 1} 553 | metroSplashScreenUseBackgroundColor: 0 554 | platformCapabilities: {} 555 | metroTargetDeviceFamilies: {} 556 | metroFTAName: 557 | metroFTAFileTypes: [] 558 | metroProtocolName: 559 | metroCompilationOverrides: 1 560 | XboxOneProductId: 561 | XboxOneUpdateKey: 562 | XboxOneSandboxId: 563 | XboxOneContentId: 564 | XboxOneTitleId: 565 | XboxOneSCId: 566 | XboxOneGameOsOverridePath: 567 | XboxOnePackagingOverridePath: 568 | XboxOneAppManifestOverridePath: 569 | XboxOneVersion: 1.0.0.0 570 | XboxOnePackageEncryption: 0 571 | XboxOnePackageUpdateGranularity: 2 572 | XboxOneDescription: 573 | XboxOneLanguage: 574 | - enus 575 | XboxOneCapability: [] 576 | XboxOneGameRating: {} 577 | XboxOneIsContentPackage: 0 578 | XboxOneEnableGPUVariability: 0 579 | XboxOneSockets: {} 580 | XboxOneSplashScreen: {fileID: 0} 581 | XboxOneAllowedProductIds: [] 582 | XboxOnePersistentLocalStorageSize: 0 583 | XboxOneXTitleMemory: 8 584 | xboxOneScriptCompiler: 0 585 | XboxOneOverrideIdentityName: 586 | vrEditorSettings: 587 | daydream: 588 | daydreamIconForeground: {fileID: 0} 589 | daydreamIconBackground: {fileID: 0} 590 | cloudServicesEnabled: 591 | UNet: 1 592 | luminIcon: 593 | m_Name: 594 | m_ModelFolderPath: 595 | m_PortalFolderPath: 596 | luminCert: 597 | m_CertPath: 598 | m_PrivateKeyPath: 599 | luminIsChannelApp: 0 600 | luminVersion: 601 | m_VersionCode: 1 602 | m_VersionName: 603 | facebookSdkVersion: 7.9.4 604 | facebookAppId: 605 | facebookCookies: 1 606 | facebookLogging: 1 607 | facebookStatus: 1 608 | facebookXfbml: 0 609 | facebookFrictionlessRequests: 1 610 | apiCompatibilityLevel: 6 611 | cloudProjectId: 612 | framebufferDepthMemorylessMode: 0 613 | projectName: 614 | organizationId: 615 | cloudEnabled: 0 616 | enableNativePlatformBackendsForNewInputSystem: 0 617 | disableOldInputManagerSupport: 0 618 | legacyClampBlendShapeWeights: 0 619 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2020.3.18f1 2 | m_EditorVersionWithRevision: 2020.3.18f1 (a7d1c678663c) 3 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 4 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | particleRaycastBudget: 4 33 | asyncUploadTimeSlice: 2 34 | asyncUploadBufferSize: 4 35 | resolutionScalingFixedDPIFactor: 1 36 | excludedTargetPlatforms: [] 37 | - serializedVersion: 2 38 | name: Low 39 | pixelLightCount: 0 40 | shadows: 0 41 | shadowResolution: 0 42 | shadowProjection: 1 43 | shadowCascades: 1 44 | shadowDistance: 20 45 | shadowNearPlaneOffset: 3 46 | shadowCascade2Split: 0.33333334 47 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 48 | shadowmaskMode: 0 49 | blendWeights: 2 50 | textureQuality: 0 51 | anisotropicTextures: 0 52 | antiAliasing: 0 53 | softParticles: 0 54 | softVegetation: 0 55 | realtimeReflectionProbes: 0 56 | billboardsFaceCameraPosition: 0 57 | vSyncCount: 0 58 | lodBias: 0.4 59 | maximumLODLevel: 0 60 | particleRaycastBudget: 16 61 | asyncUploadTimeSlice: 2 62 | asyncUploadBufferSize: 4 63 | resolutionScalingFixedDPIFactor: 1 64 | excludedTargetPlatforms: [] 65 | - serializedVersion: 2 66 | name: Medium 67 | pixelLightCount: 1 68 | shadows: 1 69 | shadowResolution: 0 70 | shadowProjection: 1 71 | shadowCascades: 1 72 | shadowDistance: 20 73 | shadowNearPlaneOffset: 3 74 | shadowCascade2Split: 0.33333334 75 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 76 | shadowmaskMode: 0 77 | blendWeights: 2 78 | textureQuality: 0 79 | anisotropicTextures: 1 80 | antiAliasing: 0 81 | softParticles: 0 82 | softVegetation: 0 83 | realtimeReflectionProbes: 0 84 | billboardsFaceCameraPosition: 0 85 | vSyncCount: 1 86 | lodBias: 0.7 87 | maximumLODLevel: 0 88 | particleRaycastBudget: 64 89 | asyncUploadTimeSlice: 2 90 | asyncUploadBufferSize: 4 91 | resolutionScalingFixedDPIFactor: 1 92 | excludedTargetPlatforms: [] 93 | - serializedVersion: 2 94 | name: High 95 | pixelLightCount: 2 96 | shadows: 2 97 | shadowResolution: 1 98 | shadowProjection: 1 99 | shadowCascades: 2 100 | shadowDistance: 40 101 | shadowNearPlaneOffset: 3 102 | shadowCascade2Split: 0.33333334 103 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 104 | shadowmaskMode: 1 105 | blendWeights: 2 106 | textureQuality: 0 107 | anisotropicTextures: 1 108 | antiAliasing: 2 109 | softParticles: 0 110 | softVegetation: 1 111 | realtimeReflectionProbes: 1 112 | billboardsFaceCameraPosition: 1 113 | vSyncCount: 1 114 | lodBias: 1 115 | maximumLODLevel: 0 116 | particleRaycastBudget: 256 117 | asyncUploadTimeSlice: 2 118 | asyncUploadBufferSize: 4 119 | resolutionScalingFixedDPIFactor: 1 120 | excludedTargetPlatforms: [] 121 | - serializedVersion: 2 122 | name: Very High 123 | pixelLightCount: 3 124 | shadows: 2 125 | shadowResolution: 2 126 | shadowProjection: 1 127 | shadowCascades: 2 128 | shadowDistance: 40 129 | shadowNearPlaneOffset: 3 130 | shadowCascade2Split: 0.33333334 131 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 132 | shadowmaskMode: 1 133 | blendWeights: 4 134 | textureQuality: 0 135 | anisotropicTextures: 1 136 | antiAliasing: 4 137 | softParticles: 1 138 | softVegetation: 1 139 | realtimeReflectionProbes: 1 140 | billboardsFaceCameraPosition: 1 141 | vSyncCount: 1 142 | lodBias: 1.5 143 | maximumLODLevel: 0 144 | particleRaycastBudget: 1024 145 | asyncUploadTimeSlice: 2 146 | asyncUploadBufferSize: 4 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Ultra 151 | pixelLightCount: 4 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 4 156 | shadowDistance: 150 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 1 164 | antiAliasing: 4 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 2 171 | maximumLODLevel: 0 172 | particleRaycastBudget: 4096 173 | asyncUploadTimeSlice: 2 174 | asyncUploadBufferSize: 4 175 | resolutionScalingFixedDPIFactor: 1 176 | excludedTargetPlatforms: [] 177 | m_PerPlatformDefaultQuality: 178 | Android: 2 179 | Nintendo 3DS: 5 180 | Nintendo Switch: 5 181 | PS4: 5 182 | PSP2: 2 183 | Standalone: 5 184 | Tizen: 2 185 | WebGL: 3 186 | WiiU: 5 187 | Windows Store Apps: 5 188 | XboxOne: 5 189 | iPhone: 2 190 | tvOS: 2 191 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - PostProcessing 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.1 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | UnityAdsSettings: 25 | m_Enabled: 0 26 | m_InitializeOnStartup: 1 27 | m_TestMode: 0 28 | m_IosGameId: 29 | m_AndroidGameId: 30 | m_GameIds: {} 31 | m_GameId: 32 | PerformanceReportingSettings: 33 | m_Enabled: 0 34 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_RenderPipeSettingsPath: 10 | m_FixedTimeStep: 0.016666668 11 | m_MaxDeltaTime: 0.05 12 | -------------------------------------------------------------------------------- /ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AnimeTask 2 | 3 | Task Animation Library for Unity 4 | 5 | --- 6 | 7 | > [!WARNING] 8 | > This is also a very old library. 9 | > If you want to use a new one now, I recommend [PrimeTween](https://github.com/KyryloKuzyk/PrimeTween). 10 | 11 | --- 12 | 13 | ***Read this document in other languages: [日本語](https://github.com/kyubuns/AnimeTask/blob/main/README_ja.md)*** 14 | 15 | ![gif_animation_001](https://user-images.githubusercontent.com/961165/85940937-8c48d500-b95a-11ea-81b5-fddd17166a96.gif) 16 | 17 | ## Sample 18 | 19 | -> [Example of use](https://github.com/kyubuns/AnimeTask/wiki/Gallery) 20 | 21 | ### Basic 22 | 23 | Move from `(-5f, 0f, 0f)` to `(5f, 0f, 0f)` over 2 seconds. 24 | 25 | ```csharp 26 | await Easing.Create(new Vector3(-5f, 0f, 0f), new Vector3(5f, 0f, 0f), 2f).ToLocalPosition(cube); 27 | ``` 28 | 29 | 30 | 31 | ### `PlayTo` 32 | 33 | Move from the current location to a specified location. 34 | 35 | ```csharp 36 | await Easing.Create(new Vector3(-5f, 3f, 0f), 2f).ToLocalPosition(cube); 37 | ``` 38 | 39 | 40 | 41 | ### Easing 42 | 43 | Use [`InCubic`](https://easings.net/#easeInCubic) of [`Easing`](https://easings.net/) to move to a specified position. 44 | 45 | ```csharp 46 | await Easing.Create(new Vector3(-5f, 3f, 0f), 2f).ToLocalPosition(cube); 47 | ``` 48 | 49 | 50 | 51 | ### Linear 52 | 53 | Move at 1 per second for 2 seconds. 54 | 55 | ```csharp 56 | await Moving.Linear(1f, 2f).ToLocalPositionX(cube); 57 | ``` 58 | 59 | ### `Gravity` 60 | 61 | ```csharp 62 | const float xRange = 5f; 63 | const float yRangeMin = 5f; 64 | const float yRangeMax = 10f; 65 | await Moving.Gravity( 66 | new Vector2(Random.Range(-xRange, xRange), Random.Range(yRangeMin, yRangeMax)), 67 | Vector2.down * 9.8f, 68 | 5f 69 | ).ToLocalPosition(shape) 70 | ``` 71 | 72 | 73 | 74 | ### `AnimationCurve` 75 | 76 | ```csharp 77 | [SerializeField] private AnimationCurve sample12 = default; 78 | 79 | public async UniTask Sample12() 80 | { 81 | await Moving.AnimationCurve(sample12).ToLocalPositionX(cube); 82 | } 83 | ``` 84 | 85 | ### CalcDuration 86 | 87 | Move by calculating moving time from distance. 88 | 89 | ```csharp 90 | await Easing.Create(new Vector3(5f, 0f, 0f), x => x / 2f) 91 | .Concat(Easing.Create(new Vector3(5f, 2f, 0f), x => x / 2f)) 92 | .Concat(Easing.Create(new Vector3(-5f, 0f, 0f), x => x / 2f)) 93 | .ToLocalPosition(cubes); 94 | ``` 95 | 96 | ### `TranslateTo.Action` 97 | 98 | `TranslateTo.Action` enables you to use the animated values freely. 99 | 100 | ```csharp 101 | Easing.Create(0, 100, 2f).ToAction(x => Debug.Log(x)) 102 | ``` 103 | 104 | ### `UnscaledTime` 105 | 106 | You can create your own scheduler, so you can stop time for specific objects. 107 | The default is to use `Time.time`, and you can also use `UnscaledTimeScheduler`, which uses `Time.unscaledTime`. 108 | 109 | ```csharp 110 | Easing.Create(new Vector3(-5f, 0f, 0f), new Vector3(5f, 0f, 0f), 2f) 111 | .ToLocalPosition(shape, default, new UnscaledTimeScheduler()); 112 | ``` 113 | 114 | ### Update Timing 115 | 116 | If an update timing is specified in the scheduler, values can be updated at times other than Update. 117 | 118 | ```csharp 119 | public class CustomScheduler : IScheduler 120 | { 121 | public float DeltaTime => Time.deltaTime; 122 | public PlayerLoopTiming UpdateTiming => PlayerLoopTiming.PreUpdate; 123 | } 124 | ``` 125 | 126 | ### `Cancel` 127 | 128 | ```csharp 129 | var cancellationTokenSource = new CancellationTokenSource(); 130 | cancellationTokenSource.Token.Register(() => Debug.Log("Cancel")); 131 | cancellationTokenSource.CancelAfter(500); 132 | 133 | await Easing.Create(new Vector3(5f, 0f, 0f), 2f).ToLocalPosition(cubes[0], cancellationTokenSource.Token); 134 | ``` 135 | 136 | ### `Convert` 137 | 138 | Convert a `float` transition to a circular motion. 139 | 140 | ```csharp 141 | await Easing.Create(0.0f, Mathf.PI * 2.0f, 2f) 142 | .Convert(x => new Vector3(Mathf.Sin(x), Mathf.Cos(x), 0.0f) * 3.0f) 143 | .ToLocalPosition(go); 144 | ``` 145 | 146 | 147 | 148 | ### `Concat` 149 | 150 | It moves from 5f to 0f in 2 seconds, stops for 1 second, and moves to -5f in 2 seconds. 151 | 152 | ```csharp 153 | await Easing.Create(5f, 0f, 2f) 154 | .Delay(1f) 155 | .Concat(Easing.Create(0f, -5f, 2f)) 156 | .ToLocalPositionX(cubes[0]); 157 | ``` 158 | 159 | ### `IProgress` 160 | 161 | Supporting [IProgress](https://docs.microsoft.com/ja-jp/dotnet/api/system.iprogress-1) 162 | 163 | ```csharp 164 | await Easing.Create(2f).ToProgress(Progress.Create(x => Debug.Log(x))); 165 | ``` 166 | 167 | ### `AnimationCanceller` 168 | 169 | ```csharp 170 | var canceller = go.GetAnimationCanceller().Cancel(); 171 | Easing.Create(1.0f, 0.5f).ToLocalPositionX(go, canceller.Token); 172 | 173 | // in other class/scope 174 | var canceller = go.GetAnimationCanceller().Cancel(); 175 | Easing.Create(0.0f, 0.5f).ToLocalPositionX(go, canceller.Token); 176 | ``` 177 | 178 | ### `Skip` 179 | 180 | - Cancel (using CancellationToken) will stop at the position at the moment of `Cancel`. 181 | - Skip (using SkipToken) will move to the last position at the moment of `Skip`. 182 | 183 | ```csharp 184 | var skipTokenSource = new SkipTokenSource(); 185 | Easing.Create(new Vector3(5f, 0f, 0f), 5f).ToLocalPosition(cubes[0], default, skipTokenSource.Token).Forget(); 186 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 187 | skipTokenSource.Skip(); 188 | ``` 189 | 190 | ### `UniRx.Extensions` 191 | 192 | ```csharp 193 | var score = new ReactiveProperty(0); 194 | score 195 | .SubscribeTask(async (x, cancellationToken) => 196 | { 197 | scoreCounter.text = $"{x}"; 198 | await Easing.Create(2f, 1f, 0.5f).ToLocalScale(scoreCounter, cancellationToken); 199 | }); 200 | ``` 201 | 202 | ## Instructions 203 | 204 | - Import AnimeTask via Package Manager 205 | - `https://github.com/kyubuns/AnimeTask.git?path=Assets/AnimeTask` 206 | - Import AnimeTask via UnityPackage 207 | - Import [UniTask](https://github.com/Cysharp/UniTask) 208 | - Import [UnityPackage](https://github.com/kyubuns/AnimeTask/releases) 209 | 210 | ## Way of thinking 211 | 212 | You can pass two arguments to `Play` and `PlayTo`. 213 | The first is the `Animator` and the second is the `Translator`, which have distinct roles. 214 | 215 | ### Animator 216 | 217 | Takes the elapsed time and returns the current value. 218 | 219 | ### Translator 220 | 221 | Reflect the value. 222 | 223 | ## Requirements 224 | 225 | - Requires Unity2020.3 or later 226 | 227 | ## License 228 | 229 | MIT License (see [LICENSE](LICENSE)) 230 | -------------------------------------------------------------------------------- /README_ja.md: -------------------------------------------------------------------------------- 1 | # AnimeTask 2 | 3 | UnityのTaskアニメーションライブラリ 4 | Rx Version! -> [kyubuns/AnimeRx](https://github.com/kyubuns/AnimeRx) 5 | 6 | ***Read this document in other languages: [English](https://github.com/kyubuns/AnimeTask/blob/main/README.md)*** 7 | 8 | Buy Me A Coffee 9 | 10 | ![gif_animation_001](https://user-images.githubusercontent.com/961165/85940937-8c48d500-b95a-11ea-81b5-fddd17166a96.gif) 11 | 12 | ## Sample 13 | 14 | -> [使用例](https://github.com/kyubuns/AnimeTask/wiki/Gallery) 15 | 16 | ### Basic 17 | 18 | `(-5f, 0f, 0f)` から `(5f, 0f, 0f)` へ2秒かけて移動する。 19 | 20 | ```csharp 21 | await Easing.Create(new Vector3(-5f, 0f, 0f), new Vector3(5f, 0f, 0f), 2f).ToLocalPosition(cube); 22 | ``` 23 | 24 | 25 | 26 | ### PlayTo 27 | 28 | 現在地から指定した位置まで移動する。 29 | 30 | ```csharp 31 | await Easing.Create(new Vector3(-5f, 3f, 0f), 2f).ToLocalPosition(cube); 32 | ``` 33 | 34 | 35 | 36 | ### Easing 37 | 38 | [Easing](https://easings.net/)の[InCubic](https://easings.net/#easeInCubic)を利用して、指定した位置まで移動する。 39 | 40 | ```csharp 41 | await Easing.Create(new Vector3(-5f, 3f, 0f), 2f).ToLocalPosition(cube); 42 | ``` 43 | 44 | 45 | 46 | ### Linear 47 | 48 | 秒速1で、2秒間移動する。 49 | 50 | ```csharp 51 | await Moving.Linear(1f, 2f).ToLocalPositionX(cube); 52 | ``` 53 | 54 | ### Gravity 55 | 56 | ```csharp 57 | const float xRange = 5f; 58 | const float yRangeMin = 5f; 59 | const float yRangeMax = 10f; 60 | await Moving.Gravity( 61 | new Vector2(Random.Range(-xRange, xRange), Random.Range(yRangeMin, yRangeMax)), 62 | Vector2.down * 9.8f, 63 | 5f 64 | ).ToLocalPosition(shape) 65 | ``` 66 | 67 | 68 | 69 | ### CalcDuration 70 | 71 | 距離から移動時間を計算して移動する。 72 | 73 | ```csharp 74 | await Easing.Create(new Vector3(5f, 0f, 0f), x => x / 2f) 75 | .Concat(Easing.Create(new Vector3(5f, 2f, 0f), x => x / 2f)) 76 | .Concat(Easing.Create(new Vector3(-5f, 0f, 0f), x => x / 2f)) 77 | .ToLocalPosition(cubes); 78 | ``` 79 | 80 | ### TranslateTo.Action 81 | 82 | `TranslateTo.Action`を利用すると、アニメーションした値を自由に使用出来る。 83 | 84 | ```csharp 85 | Easing.Create(0, 100, 2f).ToAction(x => Debug.Log(x)) 86 | ``` 87 | 88 | ### UnscaledTime 89 | 90 | スケジューラーは自作出来るので、特定のオブジェクトだけ時間を止めたりすることが可能。 91 | デフォルトは`Time.time`を利用していて、`Time.unscaledTime`を利用する`UnscaledTimeScheduler`も利用できる。 92 | 93 | ```csharp 94 | Easing.Create(new Vector3(-5f, 0f, 0f), new Vector3(5f, 0f, 0f), 2f) 95 | .ToLocalPosition(shape, default, new UnscaledTimeScheduler()); 96 | ``` 97 | 98 | ### Update Timing 99 | 100 | スケジューラーで更新タイミングを指定すれば、Update 以外のタイミングで値を更新することも可能です。 101 | 102 | ```csharp 103 | public class CustomScheduler : IScheduler 104 | { 105 | public float DeltaTime => Time.deltaTime; 106 | public PlayerLoopTiming UpdateTiming => PlayerLoopTiming.PreUpdate; 107 | } 108 | ``` 109 | 110 | ### Cancel 111 | 112 | ```csharp 113 | var cancellationTokenSource = new CancellationTokenSource(); 114 | cancellationTokenSource.Token.Register(() => Debug.Log("Cancel")); 115 | cancellationTokenSource.CancelAfter(500); 116 | 117 | await Easing.Create(new Vector3(5f, 0f, 0f), 2f).ToLocalPosition(cubes[0], cancellationTokenSource.Token); 118 | ``` 119 | 120 | ### Delay 121 | 122 | 2秒間右に等速で移動しつつ、最後の0.2秒でScaleを0にする 123 | 124 | ```csharp 125 | await UniTask.WhenAll( 126 | Moving.Linear(3f, 2f).ToLocalPositionX(cube), 127 | Animator.Delay(1.8f, Easing.Create(Vector3.zero, 0.2f)).ToLocalScale(cube), 128 | ); 129 | ``` 130 | 131 | 132 | 133 | ### Convert 134 | 135 | floatの推移を円運動に変換する。 136 | 137 | ```csharp 138 | await Easing.Create(0.0f, Mathf.PI * 2.0f, 2f) 139 | .Convert(x => new Vector3(Mathf.Sin(x), Mathf.Cos(x), 0.0f) * 3.0f) 140 | .ToLocalPosition(go); 141 | ``` 142 | 143 | 144 | 145 | ### Concat 146 | 147 | 2秒で5fから0fまで移動し、1秒停止したあと、2秒で-5fへ移動する。 148 | 149 | ```csharp 150 | await Easing.Create(5f, 0f, 2f) 151 | .Delay(1f) 152 | .Concat(Easing.Create(0f, -5f, 2f)) 153 | .ToLocalPositionX(cubes[0]); 154 | ``` 155 | 156 | ### IProgress 157 | 158 | [IProgress](https://docs.microsoft.com/ja-jp/dotnet/api/system.iprogress-1) をサポートしています。 159 | 160 | ```csharp 161 | await Easing.Create(2f).ToProgress(Progress.Create(x => Debug.Log(x))); 162 | ``` 163 | 164 | ### AnimationCanceller 165 | 166 | ```csharp 167 | var canceller = go.GetAnimationCanceller().Cancel(); 168 | Easing.Create(1.0f, 0.5f).ToLocalPositionX(go, canceller.Token); 169 | 170 | // 他のクラス/スコープ内で、他のアニメを中断する 171 | var canceller = go.GetAnimationCanceller().Cancel(); 172 | Easing.Create(0.0f, 0.5f).ToLocalPositionX(go, canceller.Token); 173 | ``` 174 | 175 | ### Skip 176 | 177 | - (CancellationTokenを用いた) Cancelは `Cancel` した瞬間に、その位置に停止します。 178 | - (SkipTokenを用いた) Skipは `Skip` した瞬間に、終了位置まで移動します。 179 | 180 | ```csharp 181 | var skipTokenSource = new SkipTokenSource(); 182 | Easing.Create(new Vector3(5f, 0f, 0f), 5f).ToLocalPosition(cubes[0], default, skipTokenSource.Token).Forget(); 183 | await UniTask.Delay(TimeSpan.FromSeconds(1)); 184 | skipTokenSource.Skip(); 185 | ``` 186 | 187 | ### UniRx.Extensions 188 | 189 | ```csharp 190 | var score = new ReactiveProperty(0); 191 | score 192 | .SubscribeTask(async (x, cancellationToken) => 193 | { 194 | scoreCounter.text = $"{x}"; 195 | await Easing.Create(2f, 1f, 0.5f).ToLocalScale(scoreCounter, cancellationToken); 196 | }); 197 | ``` 198 | 199 | ## Instructions 200 | 201 | - [UniTask](https://github.com/Cysharp/UniTask)をインポート 202 | - AnimeTaskをインポート 203 | - Package Manager `https://github.com/kyubuns/AnimeTask.git?path=Assets/AnimeTask` 204 | - [UnityPackage](https://github.com/kyubuns/AnimeTask/releases) 205 | 206 | ## 考え方 207 | 208 | `Play`や`PlayTo`には2つの引数を渡します。 209 | 1個目が`Animator`、2個目が`Translator`で、これらは明確に役割が異なります。 210 | 211 | ### Animator 212 | 213 | 経過時間を受け取り、現在の値を返す。 214 | 215 | ### Translator 216 | 217 | 値を反映する。 218 | 219 | ## Requirements 220 | 221 | - Unity2019.4 以降。 222 | 223 | ## License 224 | 225 | MIT License (see [LICENSE](LICENSE)) 226 | 227 | ## Buy me a coffee 228 | 229 | もしこのプロジェクトが気に入ったなら、ぜひコーヒーを奢ってください! 230 | https://www.buymeacoffee.com/kyubuns 231 | 232 | ## 「ゲームに使ったよ!」 233 | 234 | 「このゲームにこのライブラリ使ったよ!」という報告を貰えるとめっちゃ喜びます! 235 | メールやtwitterでお気軽にご連絡ください。 236 | (MITライセンスのため、報告は義務ではありません。) 237 | [メッセージフォーム](https://kyubuns.dev/message.html) 238 | 239 | https://kyubuns.dev/ 240 | --------------------------------------------------------------------------------