ZeroVR/ZeroPacientVR/Assets/Scripts/Tree/SeekPathAstarAction.cs

83 lines
2.5 KiB
C#

// using NodeCanvas.Framework;
// using ParadoxNotion.Design;
// using Pathfinding;
// using UnityEngine;
//
//
// namespace NodeCanvas.Tasks.Actions
// {
// [Name("Seek Path A*")]
// [Category("Kilosoft/Movement")]
// public class SeekPathAstarAction : ActionTask<AIPath>
// {
// [RequiredField]
// public BBParameter<Transform> target;
// public BBParameter<float> speed = 4;
// public BBParameter<float> keepDistance = 0.1f;
// private Vector3? lastRequest;
//
// protected override string info => "Seek A* " + target;
//
// protected override void OnExecute()
// {
// if (target.value == null)
// {
// EndAction(false); return;
// }
//
// if (Vector3.Distance(agent.position, target.value.position) <= keepDistance.value)
// {
// agent.SetPath(null);
// EndAction(true);
// return;
// }
//
// var position = target.value.position;
// lastRequest = position;
// agent.destination = position;
// agent.maxSpeed = speed.value;
// agent.endReachedDistance = keepDistance.value;
// agent.SearchPath();
// }
//
// protected override void OnUpdate()
// {
// if (target.value == null)
// {
// EndAction(false);
// return;
// }
//
// var pos = target.value.position;
// if (lastRequest.HasValue && Vector3.Distance(lastRequest.Value,pos) > 0.1f)
// {
// agent.destination = target.value.position;
// agent.SearchPath();
// }
//
// lastRequest = pos;
//
// if (agent.remainingDistance <= agent.endReachedDistance)
// {
// agent.SetPath(null);
// EndAction(true);
// }
// }
//
// protected override void OnPause() { OnStop(); }
//
// protected override void OnStop()
// {
// agent.SetPath(null);
// lastRequest = null;
// }
//
// public override void OnDrawGizmosSelected()
// {
// if (target.value != null)
// {
// Gizmos.DrawWireSphere(target.value.transform.position, keepDistance.value);
// }
// }
// }
// }