ChangeHitpointsTaskAction.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using NodeCanvas.Framework;
  5. using ParadoxNotion.Design;
  6. namespace KairoEngine.CharacterSystem
  7. {
  8. public class ChangeHitpointsTaskAction : ActionTask
  9. {
  10. [BlackboardOnly] public BBParameter<CharacterController> character;
  11. public int hitpoints;
  12. public GameObject fxPrefab;
  13. protected override string info
  14. {
  15. get
  16. {
  17. return $"Change Hitpoints ({hitpoints})";
  18. }
  19. }
  20. protected override void OnExecute()
  21. {
  22. DamageController damageController = CharacterManager.GetCharacter("Player_Character")?.GetComponent<DamageController>();
  23. if(damageController == null) return;
  24. if(hitpoints > 0)
  25. {
  26. damageController.Heal(hitpoints);
  27. GameObject.Instantiate(fxPrefab, damageController.transform.position, damageController.transform.rotation);
  28. }
  29. else if(hitpoints < 0)
  30. {
  31. }
  32. }
  33. }
  34. }