12345678910111213141516171819202122232425262728 |
- using KairoEngine.Core;
- using KairoEngine.Inventory;
- namespace KairoEngine.CharacterSystem
- {
- public class EquipItemCommand : ICommand
- {
- ItemRef itemRef;
- CharacterController character;
- public EquipItemCommand(ItemRef itemRef, CharacterController character)
- {
- this.itemRef = itemRef;
- this.character = character;
- }
- public void Execute()
- {
- CharacterEquipItemAction action = new CharacterEquipItemAction(itemRef, character);
- ActionController actionController = character.GetComponent<ActionController>();
- if(actionController == null) return;
- if(actionController.HasAction(action) == false)
- {
- actionController.AddAction(action);
- }
- }
- }
- }
|