59 lines
1.6 KiB
C#
59 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;
|
|
using RuntimeData;
|
|
|
|
|
|
namespace NodeCanvas.Tasks.Actions
|
|
{
|
|
[Category("AIAction")]
|
|
[Serializable]
|
|
public class AIParamFeelingValue : BaseActionTask
|
|
{
|
|
public bool MoreThan;
|
|
public float Value;
|
|
|
|
protected override string desc
|
|
{
|
|
get
|
|
{
|
|
if (MoreThan) return string.Format($"筛选好感度 >= {Value}");
|
|
return string.Format($"筛选好感度 <= {Value}");
|
|
}
|
|
}
|
|
|
|
|
|
protected override void OnExecute()
|
|
{
|
|
base.OnExecute();
|
|
// 直接从Blackboard获取AICalculatorData
|
|
var data = blackboard.GetVariable<AICalculatorData>("Data");
|
|
if (data?.value?.TargetParam == null)
|
|
{
|
|
EndAction(false);
|
|
return;
|
|
}
|
|
|
|
for (int i = data.value.AIActions.Count - 1; i >= 0; i--)
|
|
{
|
|
var self = data.value.AIActions[i].Param.PlayerData;
|
|
var target = data.value.AIActions[i].Param.TargetPlayerData;
|
|
self.GetCountryDiplomacyInfo(target.Id, out var selfToTarget);
|
|
if (MoreThan && selfToTarget.FeelingValue >= Value) continue;
|
|
if (!MoreThan && selfToTarget.FeelingValue <= Value) continue;
|
|
data.value.AIActions.RemoveAt(i);
|
|
}
|
|
|
|
EndAction(data.value.AIActions.Count > 0);
|
|
}
|
|
}
|
|
} |