CharacterReloadFirearmCommand.cs 918 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 CharacterReloadFirearmCommand : ICommand
  9. {
  10. CharacterController character;
  11. ItemFirearmRef firearmRef;
  12. public CharacterReloadFirearmCommand(CharacterController character, ItemFirearmRef firearmRef)
  13. {
  14. this.character = character;
  15. this.firearmRef = firearmRef;
  16. }
  17. public void Execute()
  18. {
  19. CharacterReloadFirearmAction action = new CharacterReloadFirearmAction(character, firearmRef);
  20. ActionController actionController = character.GetComponent<ActionController>();
  21. if(actionController.HasAction(action) == false)
  22. {
  23. actionController.AddAction(action);
  24. }
  25. }
  26. }
  27. }