using CommonAI.Zone; using UnityEngine; using CommonAIClient.Unity.Utils; namespace CommonAIClient.Unity.Battle { public partial class ComAIUnit { protected override void RegistAllObjectEvent() { base.RegistAllObjectEvent(); RegistObjectEvent(ObjectEvent_UnitHitEvent); RegistObjectEvent(ObjectEvent_UnitDoActionEvent); } protected virtual void ObjectEvent_UnitHitEvent(UnitHitEvent ev) { Quaternion rot = ObjectRoot.Rotation(); ComAICell launcher = BattleScene.GetBattleObject(ev.senderId); if (launcher != null && launcher != this) { rot = launcher.EffectRoot.Rotation(); Vector3 forward = EffectRoot.Position() - launcher.EffectRoot.Position(); if (forward != Vector3.zero) { rot = Quaternion.LookRotation(forward); } } PlayEffect(ev.effect, ObjectRoot.Position(), rot); } protected virtual void ObjectEvent_UnitDoActionEvent(UnitDoActionEvent ev) { PlayAnim(ev.ActionName, true); } } }