ExampleMover.cs 573 B

12345678910111213141516171819202122232425
  1. using UnityEngine;
  2. using System.Collections;
  3. namespace Pathfinding.Examples {
  4. [HelpURL("http://arongranberg.com/astar/documentation/stable/class_pathfinding_1_1_examples_1_1_example_mover.php")]
  5. public class ExampleMover : MonoBehaviour {
  6. RVOExampleAgent agent;
  7. public Transform target;
  8. // Use this for initialization
  9. void Awake () {
  10. agent = GetComponent<RVOExampleAgent>();
  11. }
  12. void Start () {
  13. agent.SetTarget(target.position);
  14. }
  15. void LateUpdate () {
  16. if (Input.GetKeyDown(KeyCode.Mouse0)) {
  17. agent.SetTarget(target.position);
  18. }
  19. }
  20. }
  21. }