51 lines
1.3 KiB
C#
51 lines
1.3 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 AIParamLevel : BaseActionTask
|
|
{
|
|
public bool GreaterThan = true;
|
|
public int Level = 1;
|
|
|
|
|
|
protected override string desc
|
|
{
|
|
get
|
|
{
|
|
if (GreaterThan) return string.Format($"等级大于等于 {Level}");
|
|
return string.Format($"等级小于等于 {Level}");
|
|
}
|
|
}
|
|
|
|
protected override void OnExecute()
|
|
{
|
|
base.OnExecute();
|
|
// 直接从Blackboard获取AICalculatorData
|
|
var data = blackboard.GetVariable<AICalculatorData>("Data");
|
|
if (data?.value?.TargetParam.UnitData == null)
|
|
{
|
|
EndAction(false);
|
|
return;
|
|
}
|
|
|
|
var unit = data.value.TargetParam.UnitData;
|
|
if (GreaterThan) EndAction(unit.UnitFullType.UnitLevel >= Level);
|
|
else EndAction(unit.UnitFullType.UnitLevel <= Level);
|
|
}
|
|
}
|
|
} |