47 lines
1.1 KiB
C#
47 lines
1.1 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 AIParamCityLevelMoreThanX : BaseActionTask
|
|
{
|
|
public int CityLevel;
|
|
public int Count;
|
|
|
|
protected override string desc => string.Format($"场上 >= {CityLevel} 的城市> {Count} 个");
|
|
|
|
|
|
protected override void OnExecute()
|
|
{
|
|
base.OnExecute();
|
|
// 直接从Blackboard获取AICalculatorData
|
|
var data = blackboard.GetVariable<AICalculatorData>("Data");
|
|
if (data?.value == null)
|
|
{
|
|
EndAction(false);
|
|
return;
|
|
}
|
|
|
|
var count = 0;
|
|
foreach (var city in data.value.Map.CityMap.CityList)
|
|
{
|
|
if (city.Level >= CityLevel) count++;
|
|
}
|
|
EndAction(count > Count);
|
|
}
|
|
}
|
|
} |