From fee35151213939d61d2dbd9d6a0ba71ac93b91cf Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 17 Oct 2020 15:39:34 +0800 Subject: =?UTF-8?q?+=20=E8=BF=9E=E5=87=BB=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbilitySystem/Abilities/AttackAbility.cs | 65 ++++++++++++++++++++-- 1 file changed, 60 insertions(+), 5 deletions(-) (limited to 'Assets/Scripts/AbilitySystem/Abilities/AttackAbility.cs') diff --git a/Assets/Scripts/AbilitySystem/Abilities/AttackAbility.cs b/Assets/Scripts/AbilitySystem/Abilities/AttackAbility.cs index 6732cf57..067d49a8 100644 --- a/Assets/Scripts/AbilitySystem/Abilities/AttackAbility.cs +++ b/Assets/Scripts/AbilitySystem/Abilities/AttackAbility.cs @@ -2,12 +2,67 @@ using System.Collections.Generic; using UnityEngine; -/// -/// 单个招式ability -/// -public class AttackAbilityBase : AbilityBase +public class AttackAbility : AbilityBase { - // 攻击ability默认都会回到idle + Animator m_Animator; + int m_AnimHash; + /// + /// 在跑动状态时可以切换的ability + /// + private List m_Triggers = new List(); + + public AttackAbility(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.CrossFade(m_AnimHash, 0); + } + + 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()) + break; + } + } + + public void AddTrigger(Trigger trigger) + { + if (trigger == null || m_Triggers.Contains(trigger)) + return; + m_Triggers.Add(trigger); + } } -- cgit v1.1-26-g67d0