37 lines
781 B
C#
37 lines
781 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
using UnityEngine.AI;
|
|
using UnityEngine.PlayerLoop;
|
|
|
|
public class DigiRonaAgent : MonoBehaviour
|
|
{
|
|
private NavMeshAgent agent;
|
|
private GameObject player;
|
|
|
|
// Use this for initialization
|
|
void Start()
|
|
{
|
|
agent = GetComponent<NavMeshAgent>();
|
|
agent.isStopped = false;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
agent.destination = GameObject.FindWithTag("PlayerBody").transform.position;
|
|
|
|
|
|
if (Input.GetKeyDown("space"))
|
|
{
|
|
agent.isStopped = !agent.isStopped;
|
|
}
|
|
}
|
|
|
|
public void MoveToLocation(Vector3 targetPoint)
|
|
{
|
|
agent.destination = targetPoint;
|
|
agent.isStopped = false;
|
|
}
|
|
|
|
}
|