From 34d01108e9f0c5488e8824f768c43801dd8ed4cc Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 4 Sep 2021 14:02:24 +0800 Subject: *misc --- Assets/Scripts/Unit/TimelineEventProxy.cs | 48 +++++++++++++++++-------------- 1 file changed, 27 insertions(+), 21 deletions(-) (limited to 'Assets/Scripts/Unit/TimelineEventProxy.cs') diff --git a/Assets/Scripts/Unit/TimelineEventProxy.cs b/Assets/Scripts/Unit/TimelineEventProxy.cs index da4185a7..2c5bf608 100644 --- a/Assets/Scripts/Unit/TimelineEventProxy.cs +++ b/Assets/Scripts/Unit/TimelineEventProxy.cs @@ -131,25 +131,28 @@ public partial class TimelineEventProxy m_PrevFrame = frame; } - #region Event Handles + void ExecuteEvents(List events) + { + if (events == null || events.Count == 0) + return; + foreach (var e in events) + { + string name = e.type.ToString(); + MethodInfo method = GetType().GetMethod(name, BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[] { typeof(AnimationEventBase) }, null); + if (method != null) + { + object[] param = new object[] { e }; + method.Invoke(this, param); - void ExecuteEvents(List events) - { - if (events == null || events.Count == 0) - return; - foreach (var e in events) - { - string name = e.type.ToString(); - MethodInfo method = GetType().GetMethod(name, BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[] { typeof(AnimationEventBase) }, null); - if (method != null) - { - object[] param = new object[] { e }; - method.Invoke(this, param); - } - } - } - - void EventEffect(AnimationEventBase animEvent) + if(owner != null) + owner.onTimelineEvent(e); + } + } + } + + #region Event Handles + + void EventEffect(AnimationEventBase animEvent) { EventEffect effect = animEvent as EventEffect; if (effect == null) @@ -204,13 +207,16 @@ public partial class TimelineEventProxy GameObject obj = GameObject.Instantiate(prefab); Projectile projectile = obj.GetComponent(); ProjectileInfo info = new ProjectileInfo(); + info.name = e.name; + info.tag = e.tag; + info.moveType = e.moveType; info.owner = owner; info.position = m_Root.transform.position + e.posOffset; info.rotation = e.rotation; info.scale = e.scale; - info.direction = Vector3.right; - info.velocity = Vector3.right * 10f; - info.lifetime = 5; + info.velocity = e.velocity; + info.acceleration = e.acceleration; + info.lifetime = e.lifeTime; info.sparkPath = e.sparkPath; projectile.Initialize(info); -- cgit v1.1-26-g67d0