Newer
Older
TheVengeance-Project-IADE-Unity2D / Assets / Scripts / NPC / BlackSmith / Actions / LooAtAction.cs
@Rackday Rackday on 29 Oct 559 bytes Major Update
using MyCollections.AI.FinitStateMachine;
using UnityEngine;

[CreateAssetMenu(menuName = "Finite State Machine/Action/LookAt")]
public class LooAtAction : Action
{
    public override void Run(FSM fsm)
    {
        FOV fov = fsm.Controller.AgentFOV;
        
        if (fov != null)
        {
            GameObject target = fov.GetTarget();

            if (target != null)
            {
                fsm.Controller.LastDirection = fov.TargetDirection;
                return;
            }

            Debug.Log($"Target is null");
        }
    }
}