IndieGame/client/Assets/ParadoxNotion/NodeCanvas/Tasks/Actions/GameObject/GetDistance.cs
DOBEST\zhaoyingjie f242607587 初始化工程
2024-10-11 10:12:15 +08:00

28 lines
662 B
C#

using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Actions
{
[Category("GameObject")]
public class GetDistance : ActionTask<Transform>
{
[RequiredField]
public BBParameter<GameObject> target;
[BlackboardOnly]
public BBParameter<float> saveAs;
protected override string info {
get { return string.Format("Get Distance to {0}", target.ToString()); }
}
protected override void OnExecute() {
saveAs.value = Vector3.Distance(agent.position, target.value.transform.position);
EndAction();
}
}
}