From adb364a79f5dd69de08f72072cc2261131314e53 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 2 Sep 2021 13:01:49 +0800 Subject: +override rootmotion --- Assets/Scripts/Unit/AnimationData.cs | 48 +++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 4 deletions(-) (limited to 'Assets/Scripts/Unit/AnimationData.cs') diff --git a/Assets/Scripts/Unit/AnimationData.cs b/Assets/Scripts/Unit/AnimationData.cs index 4114966c..80891d83 100644 --- a/Assets/Scripts/Unit/AnimationData.cs +++ b/Assets/Scripts/Unit/AnimationData.cs @@ -76,14 +76,24 @@ public enum EAnimationParameter [Serializable] public class ParameterDictionary : SerializableDictionary { } +[Serializable] public class RootMotionOverrideData { - public class PosData + [Serializable] + public class PosData { - Vector3 position; - float frame; + [SerializeField] Vector3 position; + [SerializeField] float frame; } - List positions; + [SerializeField] public List positions; + public RootMotionOverrideData() + { + positions = new List(); + } + public Vector3 GetPosition(float frame) + { + return Vector3.zero; + } } // 某个动画的数据,包括帧事件、碰撞盒、速度曲线 @@ -334,6 +344,28 @@ public class AnimationData : ScriptableObject return events; } + public int GetMaxAnimationEventsCount() + { + List frames = GetAnimationEventFrameIndices(); + if(frames == null) + { + ListPool.Release(frames); + return 0; + } + int count = 0; + for(int i = 0; i < frames.Count; ++i) + { + List events = GetAnimationEventsAtFrame(frames[i]); + if (count < events.Count) + { + count = events.Count; + } + ListPool.Release(events); + } + ListPool.Release(frames); + return count; + } + public List GetAnimationEventFrameIndices() { if (animationEvents == null) @@ -359,7 +391,15 @@ public class AnimationData : ScriptableObject } } + public void AddRootMotionOverriderData( ) + { + this.overrideRootMotion = new RootMotionOverrideData(); + } + public void DeleteRootMotionOverrideData() + { + this.overrideRootMotion = null; + } #if UNITY_EDITOR public void OnSaveToDisk() -- cgit v1.1-26-g67d0