49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年06月06日 星期五 19:06:16
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using System.Collections.Generic;
|
|
using Logic.AI;
|
|
using NodeCanvas.Framework;
|
|
using ParadoxNotion.Design;
|
|
using RuntimeData;
|
|
|
|
|
|
namespace NodeCanvas.Tasks.Actions
|
|
{
|
|
[Category("AIAction")]
|
|
public class AIParamSelfCityCount : ActionTask
|
|
{
|
|
public bool Big;
|
|
public int Count;
|
|
|
|
protected override string info
|
|
{
|
|
get
|
|
{
|
|
if (Big) return string.Format($"我方城市数量大于等于 {Count}");
|
|
return string.Format($"我方城市数量小于等于 {Count}");
|
|
}
|
|
}
|
|
|
|
protected override void OnExecute()
|
|
{
|
|
// 直接从Blackboard获取AICalculatorData
|
|
var data = blackboard.GetVariable<AICalculatorData>("Data");
|
|
if (data?.value?.TargetParam.UnitData == null)
|
|
{
|
|
EndAction(false);
|
|
return;
|
|
}
|
|
|
|
var selfCity = new List<CityData>();
|
|
data.value.TargetParam.MapData.GetCityDataListByPlayerId(data.value.TargetParam.PlayerData.Id, selfCity);
|
|
if (Big) EndAction(selfCity.Count >= Count);
|
|
else EndAction(selfCity.Count <= Count);
|
|
}
|
|
}
|
|
} |