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

29 lines
777 B
C#

using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Actions
{
[Category("GameObject")]
[Description("Find a transform child by name within the agent's transform")]
public class FindChildByName : ActionTask<Transform>
{
[RequiredField]
public BBParameter<string> childName;
[BlackboardOnly]
public BBParameter<Transform> saveAs;
protected override string info {
get { return string.Format("{0} = {1}.FindChild({2})", saveAs, agentInfo, childName); }
}
protected override void OnExecute() {
var result = agent.Find(childName.value);
saveAs.value = result;
EndAction(result != null);
}
}
}