61 lines
1.5 KiB
C#
61 lines
1.5 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年06月06日 星期五 19:06:16
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using System;
|
|
using Logic.Action;
|
|
using Logic.AI;
|
|
using NodeCanvas.Framework;
|
|
using ParadoxNotion.Design;
|
|
using RuntimeData;
|
|
|
|
|
|
namespace NodeCanvas.Tasks.Actions
|
|
{
|
|
[Name("判断 Action 数量")]
|
|
[Category("AI节点")]
|
|
[Serializable]
|
|
public class AIParamActionCount : BaseActionTask
|
|
{
|
|
public int Count;
|
|
public bool Equal = false;
|
|
public bool GreaterThan = true;
|
|
|
|
|
|
protected override string desc
|
|
{
|
|
get
|
|
{
|
|
if (Equal) return string.Format($"Action 个数等于 {Count}");
|
|
else
|
|
{
|
|
if (GreaterThan) return string.Format($"Action 个数大于等于 {Count}");
|
|
return string.Format($"Action 个数小于等于 {Count}");
|
|
}
|
|
}
|
|
}
|
|
|
|
protected override void OnExecute()
|
|
{
|
|
base.OnExecute();
|
|
// 直接从Blackboard获取AICalculatorData
|
|
var data = blackboard.GetVariable<AICalculatorData>("Data");
|
|
if (data?.value?.AIActions == null)
|
|
{
|
|
EndAction(false);
|
|
return;
|
|
}
|
|
|
|
if (Equal) EndAction(data.value.AIActions.Count == Count);
|
|
else
|
|
{
|
|
if (GreaterThan) EndAction(data.value.AIActions.Count >= Count);
|
|
else EndAction(data.value.AIActions.Count <= Count);
|
|
}
|
|
}
|
|
}
|
|
} |