Newer
Older
Hierarchical-Task-Network-Unity-3D / Assets / Scripts / HTN / Agent.cs
using NUnit.Framework;
using UnityEngine;
using UnityEngine.AI;

//ShopKeeper agent

[RequireComponent(typeof(NavMeshAgent)), RequireComponent(typeof(CapsuleCollider))]
public abstract class Agent : MonoBehaviour
{
    //Varibales
    protected NavMeshAgent navMeshAgent;
    [SerializeField] private Vector3 agentDestination;
    [SerializeField] private float remainingDistance;

    //Properties
    public NavMeshAgent NavMeshAgent => navMeshAgent;

    private void Awake()
    {
        navMeshAgent = GetComponent<NavMeshAgent>();
    }
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
      
    }

    // Update is called once per frame
    void Update()
    {
        remainingDistance = navMeshAgent.remainingDistance;
    }

}