You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.2 KiB
34 lines
1.2 KiB
using UnityEngine;
|
|
|
|
public class IVMateCastSkill : State<IVMate>
|
|
{
|
|
public override void Enter()
|
|
{
|
|
Debug.Assert(Owner.Excutor.SkeletonAnimation != null && Owner.Excutor.SkeletonAnimation.TryGetAnimation("skill", out Spine.Animation _), "SkeletonAnimation is null or skill animation not exist");
|
|
Owner.Excutor.SkeletonAnimation.AnimationState.SetAnimation(0, "skill", false);
|
|
Owner.Excutor.SkeletonAnimation.AnimationState.Event += OnSkillEvent;
|
|
|
|
Owner.Excutor.Skill.transform.position = Owner.Excutor.CenterPivot;
|
|
Owner.Excutor.Skill.StartCoolTime();
|
|
}
|
|
|
|
public override void Excute()
|
|
{
|
|
var trackEntry = Owner.Excutor.SkeletonAnimation.AnimationState.GetCurrent(0);
|
|
if (trackEntry is null || trackEntry.IsComplete)
|
|
Owner.ChangeState<IVMateIdle>();
|
|
}
|
|
|
|
public override void Exit()
|
|
{
|
|
Owner.Excutor.SkeletonAnimation.AnimationState.Event -= OnSkillEvent;
|
|
}
|
|
|
|
private void OnSkillEvent(Spine.TrackEntry trackEntry, Spine.Event e)
|
|
{
|
|
if (e.Data.Name == "cast")
|
|
{
|
|
Owner.Excutor.Skill.Cast(Owner.Excutor, BuffMgr.Instance.GetCharAtk());
|
|
}
|
|
}
|
|
}
|