From bdf47cf0fd36a5c858575a805cca70ab623868eb Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 29 Oct 2020 19:39:42 +0800 Subject: *misc --- Assets/Scripts/Avatar/Abilities/MoveAbility.cs | 68 ++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Assets/Scripts/Avatar/Abilities/MoveAbility.cs (limited to 'Assets/Scripts/Avatar/Abilities/MoveAbility.cs') diff --git a/Assets/Scripts/Avatar/Abilities/MoveAbility.cs b/Assets/Scripts/Avatar/Abilities/MoveAbility.cs new file mode 100644 index 00000000..757cd2d1 --- /dev/null +++ b/Assets/Scripts/Avatar/Abilities/MoveAbility.cs @@ -0,0 +1,68 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class MoveAbility : AbilityBase +{ + Animator m_Animator; + int m_AnimHash; + + /// + /// 在跑动状态时可以切换的ability + /// + private List m_Triggers = new List(); + + public MoveAbility(Animator animator, int animation) + { + m_Animator = animator; + m_AnimHash = animation; + } + + public override void OnInit() + { + + } + + public override void OnDefend() + { + throw new System.NotImplementedException(); + } + + public override void OnEnter() + { + m_Animator.CrossFadeInFixedTime(m_AnimHash, 0.1f); + } + + public override void OnExit() + { + } + + public override void OnHit() + { + } + + public override void OnHurt() + { + } + + public override void OnTranslate(AbilityBase to) + { + } + + public override void OnUpdate() + { + foreach (var abilityTrigger in m_Triggers) + { + if (abilityTrigger.Update() && abilityTrigger.Swallow) + break; + } + } + + public void AddTrigger(Trigger trigger) + { + if (trigger == null || m_Triggers.Contains(trigger)) + return; + m_Triggers.Add(trigger); + } + +} -- cgit v1.1-26-g67d0