UseIntantEffectItemCommand.cs 893 B

123456789101112131415161718192021222324252627282930
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using KairoEngine.Core;
  5. using KairoEngine.Inventory;
  6. namespace KairoEngine.CharacterSystem
  7. {
  8. public class UseInstantEffectItemCommand : ICommand
  9. {
  10. ItemContainer itemContainer;
  11. ItemRef itemRef;
  12. public UseInstantEffectItemCommand(ItemContainer itemContainer, ItemRef itemRef)
  13. {
  14. this.itemContainer = itemContainer;
  15. this.itemRef = itemRef;
  16. }
  17. public void Execute()
  18. {
  19. UseInstantEffectItemAction action = new UseInstantEffectItemAction(itemContainer, itemRef);
  20. ActionController actionController = itemContainer.GetComponent<ActionController>();
  21. if(actionController.HasAction(action) == false)
  22. {
  23. actionController.AddAction(action);
  24. }
  25. }
  26. }
  27. }