Newer
Older
TheVengeance-Project-IADE-Unity2D / Assets / Scripts / NPC / BlackSmith / Actions / InteractAction.cs
@Rackday Rackday on 29 Oct 556 bytes Major Update
  1. using MyCollections.AI.FinitStateMachine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. [CreateAssetMenu(menuName = "Finite State Machine/Action/Interact")]
  6. public class InteractAction : Action
  7. {
  8. public override void Run(FSM fsm)
  9. {
  10. if (Input.GetKeyDown(InputManager.GetKey(InputAction.Interact)))
  11. {
  12. InteractableNPC controller = fsm.Controller as InteractableNPC;
  13. if(controller != null)
  14. {
  15. controller.OnInteract();
  16. }
  17. }
  18. }
  19. }