|
@@ -7,6 +7,7 @@ using ET.EventType;
|
|
namespace ET.Client
|
|
namespace ET.Client
|
|
{
|
|
{
|
|
[Event(SceneType.Current)]
|
|
[Event(SceneType.Current)]
|
|
|
|
+ [FriendOf(typeof(ET.Client.UnitRenderComponet))]
|
|
public class AnimatorEventHandler : AEvent<EventType.PlayAnimatorEvent>
|
|
public class AnimatorEventHandler : AEvent<EventType.PlayAnimatorEvent>
|
|
{
|
|
{
|
|
protected override async ETTask Run(Scene scene, EventType.PlayAnimatorEvent args)
|
|
protected override async ETTask Run(Scene scene, EventType.PlayAnimatorEvent args)
|
|
@@ -17,15 +18,23 @@ namespace ET.Client
|
|
Log.Debug($"Not found UnitRener of object{args.UnitId}");
|
|
Log.Debug($"Not found UnitRener of object{args.UnitId}");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if(args.CommandType == CMDType.Skill)
|
|
|
|
|
|
+ if (component.AniData == null)
|
|
|
|
+ {
|
|
|
|
+ var unit = UnitMgr.Instance.GetUnit(args.UnitId);
|
|
|
|
+ Log.Error($"UnitRender({unit?.ZoneObject}) not contains AnimationData component");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (args.CommandType == CMDType.Skill)
|
|
{
|
|
{
|
|
var m = Regex.Match(args.SkillName, "[Ss]kill(\\d+)");
|
|
var m = Regex.Match(args.SkillName, "[Ss]kill(\\d+)");
|
|
if (m.Success)
|
|
if (m.Success)
|
|
{
|
|
{
|
|
int n = System.Convert.ToInt32(m.Groups[1].Value, 10);
|
|
int n = System.Convert.ToInt32(m.Groups[1].Value, 10);
|
|
- if(n >=0 && AniType.SkillMax > AniType.Skill0 + n)
|
|
|
|
|
|
+ if (n >= 0 && AniType.SkillMax > AniType.Skill0 + n)
|
|
{
|
|
{
|
|
- AnimatorCommand cmd = new AnimatorCommand((AniType)(AniType.Skill0 + n)) {
|
|
|
|
|
|
+ AnimatorCommand cmd = new AnimatorCommand((AniType)(AniType.Skill0 + n))
|
|
|
|
+ {
|
|
Duration = args.Duration,
|
|
Duration = args.Duration,
|
|
Speed = args.Speed,
|
|
Speed = args.Speed,
|
|
GroupId = args.GroupId,
|
|
GroupId = args.GroupId,
|
|
@@ -48,7 +57,7 @@ namespace ET.Client
|
|
};
|
|
};
|
|
component.AppendCommand(cmd);
|
|
component.AppendCommand(cmd);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
await ETTask.CompletedTask;
|
|
await ETTask.CompletedTask;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -89,7 +98,12 @@ namespace ET.Client
|
|
protected override void Awake(UnitRenderComponet self, GameObject go)
|
|
protected override void Awake(UnitRenderComponet self, GameObject go)
|
|
{
|
|
{
|
|
self.GameObject = go;
|
|
self.GameObject = go;
|
|
- self.Awake();
|
|
|
|
|
|
+
|
|
|
|
+ self.AniData = self.GameObject.GetComponent<Mono.AnimationData>();
|
|
|
|
+ if (self.AniData != null)
|
|
|
|
+ {
|
|
|
|
+ self.ExeCommand(UnitRenderComponet.CMDIdle);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -98,7 +112,13 @@ namespace ET.Client
|
|
{
|
|
{
|
|
protected override void Update(UnitRenderComponet self)
|
|
protected override void Update(UnitRenderComponet self)
|
|
{
|
|
{
|
|
- self.Update();
|
|
|
|
|
|
+ if (self.AniData == null) { return; }
|
|
|
|
+
|
|
|
|
+ var cmd = self.FilterCmdList();
|
|
|
|
+ if (cmd != null)
|
|
|
|
+ {
|
|
|
|
+ self.ExeCommand(cmd);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -107,7 +127,10 @@ namespace ET.Client
|
|
{
|
|
{
|
|
protected override void Destroy(UnitRenderComponet self)
|
|
protected override void Destroy(UnitRenderComponet self)
|
|
{
|
|
{
|
|
- self.AniData.Animancer.Stop();
|
|
|
|
|
|
+ if(self.AniData!= null)
|
|
|
|
+ {
|
|
|
|
+ self.AniData.Animancer.Stop();
|
|
|
|
+ }
|
|
UnityEngine.Object.Destroy(self.GameObject);
|
|
UnityEngine.Object.Destroy(self.GameObject);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -119,21 +142,6 @@ namespace ET.Client
|
|
}
|
|
}
|
|
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
- public static void Awake(this UnitRenderComponet self)
|
|
|
|
- {
|
|
|
|
- self.AniData = self.GameObject.GetComponent<Mono.AnimationData>();
|
|
|
|
-
|
|
|
|
- self.ExeCommand(UnitRenderComponet.CMDIdle);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public static void Update(this UnitRenderComponet self)
|
|
|
|
- {
|
|
|
|
- var cmd = self.FilterCmdList();
|
|
|
|
- if(cmd != null)
|
|
|
|
- {
|
|
|
|
- self.ExeCommand(cmd);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
//执行指令
|
|
//执行指令
|
|
private static void ExeCommand(this UnitRenderComponet self, AnimatorCommand cmd)
|
|
private static void ExeCommand(this UnitRenderComponet self, AnimatorCommand cmd)
|