54 lines
1.2 KiB
C#
54 lines
1.2 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年06月06日 星期五 19:06:16
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using System;
|
|
using Logic.AI;
|
|
using NodeCanvas.Framework;
|
|
using ParadoxNotion.Design;
|
|
|
|
|
|
namespace NodeCanvas.Tasks.Actions
|
|
{
|
|
[Category("AIAction")]
|
|
[Serializable]
|
|
public class MarkAction : ActionTask
|
|
{
|
|
public string MarkStr;
|
|
public bool CheckNotHave;
|
|
|
|
|
|
protected override string info
|
|
{
|
|
get
|
|
{
|
|
if (CheckNotHave) return string.Format($"检查没有 {MarkStr} 标记");
|
|
else return string.Format($"添加 {MarkStr} 标记");
|
|
}
|
|
}
|
|
|
|
protected override void OnExecute()
|
|
{
|
|
// 直接从Blackboard获取AICalculatorData
|
|
var data = blackboard.GetVariable<AICalculatorData>("Data");
|
|
if (data?.value == null)
|
|
{
|
|
EndAction(false);
|
|
return;
|
|
}
|
|
|
|
if (CheckNotHave)
|
|
{
|
|
EndAction(!data.value.Marks.Contains(MarkStr));
|
|
return;
|
|
}
|
|
|
|
data.value.Marks.Add(MarkStr);
|
|
EndAction(true);
|
|
}
|
|
}
|
|
} |