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 CharacterUnarmedAttackTaskAction : ActionTask { [BlackboardOnly, RequiredField] public BBParameter character; [BlackboardOnly, RequiredField] public BBParameter target; protected override string info { get { return "Unarmed Attack"; } } protected override void OnExecute() { ICommand cancelCommand = new CancelAtionsCommand(character.value); CommandInvoker.AddCommand(cancelCommand); } protected override void OnUpdate() { if(target.value == null) EndAction(false); ICommand turnCommand = new TurnCommand(character.value, target.value.position); CommandInvoker.AddCommand(turnCommand); ICommand attackCommand = new CharacterUnarmedAttackCommand(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); } } }