summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Unit/TimelineEventProxy.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/Unit/TimelineEventProxy.cs')
-rw-r--r--Assets/Scripts/Unit/TimelineEventProxy.cs46
1 files changed, 45 insertions, 1 deletions
diff --git a/Assets/Scripts/Unit/TimelineEventProxy.cs b/Assets/Scripts/Unit/TimelineEventProxy.cs
index 7a76cd73..51d437fe 100644
--- a/Assets/Scripts/Unit/TimelineEventProxy.cs
+++ b/Assets/Scripts/Unit/TimelineEventProxy.cs
@@ -7,7 +7,13 @@ using UnityEngine;
// 执行帧事件
[DisallowMultipleComponent]
public partial class TimelineEventProxy
-{
+{
+#if UNITY_EDITOR // ActionTool里
+ public bool isInEditMode;
+ public delegate void RegisterProjectileHandle(Projectile projectile);
+ public RegisterProjectileHandle registerProjectile;
+#endif
+
public enum EEventType
{
EventCamera_Zoom, // 相机聚焦
@@ -118,4 +124,42 @@ public partial class TimelineEventProxy
}
+ void EventProjectile(AnimationEventBase animEvent)
+ {
+ EventProjectile e = animEvent as EventProjectile;
+ if (e == null)
+ return;
+ string projectilePath = e.projectilePath;
+ GameObject prefab = ResourceManager.Instance.LoadAsset<GameObject>(projectilePath);
+ if(prefab == null)
+ {
+ LogHelper.LogError("缺少对应的projectile, " + projectilePath);
+ return;
+ }
+ if(prefab.GetComponent<Projectile>() == null)
+ {
+ LogHelper.LogError("没有projectile脚本");
+ return;
+ }
+ GameObject obj = GameObject.Instantiate(prefab);
+ Projectile projectile = obj.GetComponent<Projectile>();
+ ProjectileInfo info = new ProjectileInfo();
+ info.owner = m_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.sparkPath = e.sparkPath;
+ projectile.Initialize(info);
+
+#if UNITY_EDITOR
+ if(isInEditMode && registerProjectile != null)
+ {
+ registerProjectile(projectile);
+ }
+#endif
+ }
+
} \ No newline at end of file