using System.Collections; using System.Collections.Generic; using UnityEngine; using NodeCanvas.Framework; using ParadoxNotion.Design; using KairoEngine.Core; namespace KairoEngine.CharacterSystem { [Category("KairoEngine")] public class CharacterHandWeaponAttackTaskAction : ActionTask { [BlackboardOnly, RequiredField] public BBParameter character; [BlackboardOnly, RequiredField] public BBParameter target; protected override string info { get { return "Melee Attack Target"; } } protected override void OnExecute() { ICommand cancelCommand = new CancelAtionsCommand(character.value); CommandInvoker.AddCommand(cancelCommand); } protected override void OnUpdate() { if(target.value == null || character.value == null) EndAction(false); ICommand turnCommand = new TurnCommand(character.value, target.value.position); CommandInvoker.AddCommand(turnCommand); ICommand attackCommand = new CharacterHandWeaponAttackCommand(character.value, target.value.position); CommandInvoker.AddCommand(attackCommand); GenericEvents.StartListening(character.value.unique_name + "-AnimationMeleeEnd", End); } protected override void OnStop() { GenericEvents.StopListening(character.value.unique_name + "-AnimationMeleeEnd", End); } private void End() { GenericEvents.StopListening(character.value.unique_name + "-AnimationMeleeEnd", End); EndAction(true); } } }