Files
TheAuction-GS/UIElementsSchema/Assets/Customer/CustomerController.cs

25 lines
632 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class CustomerController : MonoBehaviour {
NavMeshAgent _navMeshAgent;
private Transform _target;
private void Awake() {
_navMeshAgent = GetComponent<NavMeshAgent>();
}
private void Update() {
_target = PlayerController.Instance.transform;
_navMeshAgent.SetDestination(_target.position);
}
public void SetDestination(Vector3 position) {
if (_target == null) {
_target = this.transform;
}
_target.position = position;
}
}