51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年06月06日 星期五 19:06:16
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using System.Collections.Generic;
|
|
using Logic.Action;
|
|
using Logic.AI;
|
|
using NodeCanvas.Framework;
|
|
using ParadoxNotion.Design;
|
|
|
|
|
|
namespace NodeCanvas.Tasks.Actions
|
|
{
|
|
[Category("AIAction")]
|
|
public class AIGeneratorAction : ActionTask
|
|
{
|
|
public List<CommonActionType> ActionTypes;
|
|
|
|
|
|
protected override string info
|
|
{
|
|
get { return string.Format($"构建 {ActionTypes[0]} 行为"); }
|
|
}
|
|
|
|
protected override void OnExecute()
|
|
{
|
|
// 直接从Blackboard获取AICalculatorData
|
|
var data = blackboard.GetVariable<AICalculatorData>("Data");
|
|
if (data?.value == null)
|
|
{
|
|
EndAction(false);
|
|
return;
|
|
}
|
|
|
|
data.value.AIActions.Clear();
|
|
data.value.MaxAiAction = null;
|
|
foreach (var actionType in ActionTypes)AIActionGenerator.GeneratorActionIds(data.value, actionType);
|
|
if (data.value.AIActions.Count == 0)
|
|
{
|
|
EndAction(false);
|
|
return;
|
|
}
|
|
|
|
EndAction(true);
|
|
}
|
|
}
|
|
} |