2023-08-01 06:49:57 +00:00
|
|
|
using UnityEngine;
|
|
|
|
using System.Collections;
|
|
|
|
|
|
|
|
namespace Pathfinding.Examples {
|
2024-02-20 18:34:40 +00:00
|
|
|
[HelpURL("https://arongranberg.com/astar/documentation/stable/class_pathfinding_1_1_examples_1_1_example_mover.php")]
|
2023-08-01 06:49:57 +00:00
|
|
|
public class ExampleMover : MonoBehaviour {
|
|
|
|
RVOExampleAgent agent;
|
|
|
|
public Transform target;
|
|
|
|
|
|
|
|
// Use this for initialization
|
|
|
|
void Awake () {
|
|
|
|
agent = GetComponent<RVOExampleAgent>();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Start () {
|
|
|
|
agent.SetTarget(target.position);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LateUpdate () {
|
|
|
|
if (Input.GetKeyDown(KeyCode.Mouse0)) {
|
|
|
|
agent.SetTarget(target.position);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|