Files
2026-01-13 15:43:33 +00:00

28 lines
665 B
C#

using StarterAssets;
using UnityEngine;
using UnityEngine.AI;
public class Robot : MonoBehaviour
{
[SerializeField] AnimationClip idle;
FirstPersonController player;
NavMeshAgent agent;
Animator animator;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Awake()
{
agent = GetComponent<NavMeshAgent>();
animator = GetComponent<Animator>();
}
void Start()
{
player = FindFirstObjectByType<FirstPersonController>();
}
// Update is called once per frame
void Update()
{
agent.SetDestination(player.transform.position);
}
}