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

26 lines
611 B
C#

using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Actions
{
[Category("GameObject")]
public class GetComponent<T> : ActionTask<Transform> where T : Component
{
[BlackboardOnly]
public BBParameter<T> saveAs;
protected override string info {
get { return string.Format("Get {0} as {1}", typeof(T).Name, saveAs.ToString()); }
}
protected override void OnExecute() {
var o = agent.GetComponent<T>();
saveAs.value = o;
EndAction(o != null);
}
}
}