12345678910111213141516171819202122232425262728293031323334 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using KairoEngine.Core;
- namespace KairoEngine.CharacterSystem
- {
- public class CharacterHandWeaponAttackCommand : ICommand
- {
- CharacterController character;
- Vector3 targetPosition;
- /// <summary>
- /// Command that creates an unarmed attack action.
- /// </summary>
- /// <param name="character">The target character to perform the action.</param>
- /// <param name="targetPosition">The target position where the attack will be performed.</param>
- public CharacterHandWeaponAttackCommand(CharacterController character, Vector3 targetPosition)
- {
- this.character = character;
- this.targetPosition = targetPosition;
- }
- public void Execute()
- {
- CharacterHandWeaponAttackAction action = new CharacterHandWeaponAttackAction(character, targetPosition);
- ActionController actionController = character.GetComponent<ActionController>();
- if(actionController.HasAction(action) == false)
- {
- actionController.AddAction(action);
- }
- }
- }
- }
|