Newer
Older
TheVengeance-Project-IADE-Unity2D / Assets / Scripts / NPC / BlackSmith / Actions / LooAtAction.cs
@Rackday Rackday on 29 Oct 559 bytes Major Update
  1. using MyCollections.AI.FinitStateMachine;
  2. using UnityEngine;
  3. [CreateAssetMenu(menuName = "Finite State Machine/Action/LookAt")]
  4. public class LooAtAction : Action
  5. {
  6. public override void Run(FSM fsm)
  7. {
  8. FOV fov = fsm.Controller.AgentFOV;
  9. if (fov != null)
  10. {
  11. GameObject target = fov.GetTarget();
  12. if (target != null)
  13. {
  14. fsm.Controller.LastDirection = fov.TargetDirection;
  15. return;
  16. }
  17. Debug.Log($"Target is null");
  18. }
  19. }
  20. }