67 lines
1.6 KiB
C#
67 lines
1.6 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
|
|
{
|
|
[Name("迭代一次结束")]
|
|
[Category("AI节点")]
|
|
[Serializable]
|
|
public class AIForeachEnd : BaseActionTask
|
|
{
|
|
protected override string desc
|
|
{
|
|
get { return string.Format($"迭代一次结束"); }
|
|
}
|
|
|
|
protected override void OnExecute()
|
|
{
|
|
base.OnExecute();
|
|
// 直接从Blackboard获取AICalculatorData
|
|
var data = blackboard.GetVariable<AICalculatorData>("Data");
|
|
if (data?.value == null)
|
|
{
|
|
EndAction(false);
|
|
return;
|
|
}
|
|
|
|
if (data.value.ForeachUnit.Count == 0 && data.value.ForeachCity.Count == 0 &&
|
|
data.value.ForeachLegion.Count == 0)
|
|
{
|
|
EndAction(false);
|
|
return;
|
|
}
|
|
|
|
if (data.value.ForeachCity.Count > 0)
|
|
{
|
|
data.value.ForeachCity.RemoveAt(0);
|
|
EndAction(true);
|
|
return;
|
|
}
|
|
if (data.value.ForeachUnit.Count > 0)
|
|
{
|
|
data.value.ForeachUnit.RemoveAt(0);
|
|
EndAction(true);
|
|
return;
|
|
}
|
|
if (data.value.ForeachLegion.Count > 0)
|
|
{
|
|
data.value.ForeachLegion.RemoveAt(0);
|
|
EndAction(true);
|
|
return;
|
|
}
|
|
|
|
EndAction(false);
|
|
}
|
|
}
|
|
} |