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 ++++++++++++++++++++++++++++--- Assets/Scripts/Unit/TimelineEventProxy.cs | 1 - 2 files changed, 44 insertions(+), 5 deletions(-) (limited to 'Assets/Scripts/Unit') 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() diff --git a/Assets/Scripts/Unit/TimelineEventProxy.cs b/Assets/Scripts/Unit/TimelineEventProxy.cs index 4a71400c..7d2231c6 100644 --- a/Assets/Scripts/Unit/TimelineEventProxy.cs +++ b/Assets/Scripts/Unit/TimelineEventProxy.cs @@ -73,7 +73,6 @@ public partial class TimelineEventProxy EventBulletTime, // 子弹时间 } - public const int kMaxEventsPerFrame = 10; public const int FPS = 30; // timeline 每秒采样30次 private int m_PrevFrame = -1; -- cgit v1.1-26-g67d0