CharacteCheckDamageTaskAction.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using NodeCanvas.Framework;
  5. using ParadoxNotion.Design;
  6. using KairoEngine.Core;
  7. using KairoEngine.Inventory;
  8. namespace KairoEngine.CharacterSystem
  9. {
  10. [Category("KairoEngine")]
  11. public class CharacteCheckDamageTaskAction : ActionTask
  12. {
  13. [BlackboardOnly] public BBParameter<Transform> target;
  14. [BlackboardOnly] public BBParameter<Vector3> targetPosition;
  15. private float waitTime = 0f;
  16. private float counter = 0f;
  17. private ItemBaseFirearm firearm;
  18. private int burstCount = 0;
  19. protected override string info
  20. {
  21. get { return "Check for damage"; }
  22. }
  23. protected override void OnExecute()
  24. {
  25. DamageEvents.OnDamage += OnDamage;
  26. }
  27. private void OnDamage(DamageData damageData)
  28. {
  29. DamageEvents.OnDamage -= OnDamage;
  30. if(target != null) EndAction(true);
  31. targetPosition = damageData.sourcePosition;
  32. EndAction(true);
  33. }
  34. }
  35. }