From f900853952635a6e82e24fe62548d171823afda0 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 1 Sep 2021 17:47:20 +0800 Subject: =?UTF-8?q?*=E4=BF=AE=E6=94=B9=E7=B2=92=E5=AD=90=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E5=9C=A8=E7=BC=96=E8=BE=91=E5=99=A8=E4=B8=8B=E7=9A=84=E6=92=AD?= =?UTF-8?q?=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Unit/TimelineEventProxy.cs | 52 ++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 7 deletions(-) (limited to 'Assets/Scripts/Unit/TimelineEventProxy.cs') diff --git a/Assets/Scripts/Unit/TimelineEventProxy.cs b/Assets/Scripts/Unit/TimelineEventProxy.cs index 825cf5bf..e56f590a 100644 --- a/Assets/Scripts/Unit/TimelineEventProxy.cs +++ b/Assets/Scripts/Unit/TimelineEventProxy.cs @@ -8,10 +8,36 @@ using UnityEngine; [DisallowMultipleComponent] public partial class TimelineEventProxy { + #if UNITY_EDITOR // ActionTool里 + private static GameObject m_Root_Particles; + public static GameObject Root_Particles + { + get + { + if (m_Root_Particles == null) + m_Root_Particles = new GameObject("Root_Particles"); + return m_Root_Particles; + } + } + private static GameObject m_Root_Projectiles; + public static GameObject Root_Projectiles + { + get + { + if (m_Root_Projectiles == null) + m_Root_Projectiles = new GameObject("Root_Projectiles"); + return m_Root_Projectiles; + } + } + public bool isInEditMode; + public delegate void RegisterProjectileHandle(Projectile projectile); public RegisterProjectileHandle registerProjectile; + + public delegate void RegisterParticleSystemHandle(FxClear vfx); + public RegisterParticleSystemHandle registerParticleSystem; #endif public enum EEventType @@ -91,8 +117,10 @@ public partial class TimelineEventProxy } } m_PrevFrame = frame; - } - + } + + #region Event Handles + void ExecuteEvents(List events) { if (events == null || events.Count == 0) @@ -122,9 +150,16 @@ public partial class TimelineEventProxy GameObject go = GameObject.Instantiate(prefab); go.transform.SetParent(root.transform); - FxClear onClear = root.AddComponent(); - onClear.RunInEditor = true; - onClear.Initialize(new PlayEffectInfo(path, EffectPlayTypes.Oneshot, m_Root, effect.position, effect.rotation, effect.scale, 0, false)); + FxClear onClear = root.AddComponent(); + onClear.gameObject.name = prefab.name + "(Clone)"; + onClear.Initialize(new PlayEffectInfo(path, EffectPlayTypes.Oneshot, m_Root, effect.position, effect.rotation, effect.scale, 0, false)); +#if UNITY_EDITOR + if (isInEditMode && registerParticleSystem != null) + { + registerParticleSystem(onClear); + } + onClear.gameObject.transform.SetParent(Root_Particles.transform); +#endif } } @@ -168,7 +203,10 @@ public partial class TimelineEventProxy { registerProjectile(projectile); } + obj.transform.SetParent(Root_Projectiles.transform); #endif - } - + } + + #endregion + } \ No newline at end of file -- cgit v1.1-26-g67d0