diff options
author | chai <chaifix@163.com> | 2021-09-01 17:47:20 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-09-01 17:47:20 +0800 |
commit | f900853952635a6e82e24fe62548d171823afda0 (patch) | |
tree | 0d2c0bce3f7411c8ab61c13a5ade65bddbac6375 /Assets/Scripts/Unit/TimelineEventProxy.cs | |
parent | a93ea925263c23d5c08b5fca546eef81d6d4fec3 (diff) |
*修改粒子系统在编辑器下的播放
Diffstat (limited to 'Assets/Scripts/Unit/TimelineEventProxy.cs')
-rw-r--r-- | Assets/Scripts/Unit/TimelineEventProxy.cs | 52 |
1 files changed, 45 insertions, 7 deletions
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<AnimationEventBase> 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<FxClear>(); - onClear.RunInEditor = true; - onClear.Initialize(new PlayEffectInfo(path, EffectPlayTypes.Oneshot, m_Root, effect.position, effect.rotation, effect.scale, 0, false)); + FxClear onClear = root.AddComponent<FxClear>();
+ 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 |