diff options
author | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
commit | 15740faf9fe9fe4be08965098bbf2947e096aeeb (patch) | |
tree | a730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Graphs/UnityEngine.Graphs/LogicNodeLibrary/Animation/AnimationNodes.cs |
Diffstat (limited to 'Runtime/Graphs/UnityEngine.Graphs/LogicNodeLibrary/Animation/AnimationNodes.cs')
-rw-r--r-- | Runtime/Graphs/UnityEngine.Graphs/LogicNodeLibrary/Animation/AnimationNodes.cs | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/Runtime/Graphs/UnityEngine.Graphs/LogicNodeLibrary/Animation/AnimationNodes.cs b/Runtime/Graphs/UnityEngine.Graphs/LogicNodeLibrary/Animation/AnimationNodes.cs new file mode 100644 index 0000000..28d0efd --- /dev/null +++ b/Runtime/Graphs/UnityEngine.Graphs/LogicNodeLibrary/Animation/AnimationNodes.cs @@ -0,0 +1,76 @@ +using UnityEngine; + +namespace UnityEngine.Graphs.LogicGraph +{ + public partial class AnimationNodes + { + [Logic(typeof(Animation))] + [return: Title("Animation State")] + public static AnimationState GetAnimationState (Animation self, [Setting] string animationStateName) + { + return self[animationStateName]; + } + + [Logic(typeof(Animation))] + [return: Title("Animation State")] + public static AnimationState PlayAnimation (Animation self, [Setting] string animationName, [Setting] bool crossfade, [Setting] float fadeLength, [Setting] PlayMode playMode) + { + AnimationState animationState = self[animationName == "" ? self.clip.name : animationName]; + + if (crossfade) + self.CrossFade (animationState.name, fadeLength, playMode); + else + self.Play (animationState.name, playMode); + + return animationState; + } + + [Logic(typeof(Animation))] + [return: Title("Animation State")] + public static AnimationState PlayQueuedAnimation (Animation self, [Setting] string animationName, [Setting] bool crossfade, [Setting] float fadeLength, [Setting] QueueMode queueMode, [Setting] PlayMode playMode) + { + if (animationName == "") + animationName = self.clip.name; + + var animationState = crossfade ? + self.CrossFadeQueued (animationName, fadeLength, queueMode, playMode) : + self.PlayQueued (animationName, queueMode, playMode); + + return animationState; + } + + [Logic(typeof(Animation))] + public static void StopAnimation (Animation self, [Setting] string animationName) + { + if (animationName == "") + self.Stop(); + else + self.Stop(animationName); + } + + [Logic (typeof (Animation))] + public static void SampleAnimation (Animation self) + { + self.Sample (); + } + + [Logic(typeof(Animation))] + public static void StopAnimationState (Animation self, AnimationState animationState) + { + self.Stop(animationState.name); + } + + [Logic(typeof(Animation))] + public static void BlendAnimationState (Animation self, AnimationState animationState, float targetWeight, [Setting] float fadeLength) + { + self.Blend (animationState.name, targetWeight, fadeLength); + } + + [Logic(typeof(Animation))] + public static void SyncAnimationLayer (Animation self, int layer) + { + self.SyncLayer (layer); + } + } +} + |