using UnityEngine;
using System.Collections;
using Game.Plugins.App.Sync;

namespace Pathfinding.Examples {
	[HelpURL("https://arongranberg.com/astar/documentation/stable/class_pathfinding_1_1_examples_1_1_example_mover.php")]
	public class ExampleMover : JNGSyncFrameDefault {
		RVOExampleAgent agent;
		public Transform target;

		// Use this for initialization
		public override void OnSyncLoad()
		{
			base.OnSyncLoad();
			agent = GetComponent<RVOExampleAgent>();
		}

		public override void OnSyncStart()
		{
			base.OnSyncStart();
			agent.SetTarget(target.position);
		}

		public override void OnLateSyncUpdate(int dt, JNFrameInfo frame, Object input)
		{
			base.OnLateSyncUpdate(dt, frame, input);
			if (Input.GetKeyDown(KeyCode.Mouse0)) {
				agent.SetTarget(target.position);
			}
		}
	}
}
