69 lines
1.8 KiB
C#
69 lines
1.8 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年06月06日 星期五 19:06:16
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using System;
|
|
using Logic.Action;
|
|
using Logic.AI;
|
|
using NodeCanvas.Framework;
|
|
using ParadoxNotion.Design;
|
|
using RuntimeData;
|
|
|
|
|
|
namespace NodeCanvas.Tasks.Actions
|
|
{
|
|
[Name("判断技能层数")]
|
|
[Category("AI节点")]
|
|
[Serializable]
|
|
public class AIParamSelfSkillLevel : BaseActionTask
|
|
{
|
|
public SkillType SkillType;
|
|
public int Level;
|
|
public bool Equal = false;
|
|
public bool GreaterThan = true;
|
|
|
|
|
|
protected override string desc
|
|
{
|
|
get
|
|
{
|
|
if (Equal) return string.Format($"技能 {SkillType} 层数等于 {Level}");
|
|
else
|
|
{
|
|
if (GreaterThan) return string.Format($"技能 {SkillType} 层数大于等于 {Level}");
|
|
return string.Format($"技能 {SkillType} 层数小于等于 {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;
|
|
unit.GetSkill(SkillType, out var skill);
|
|
if (skill == null)
|
|
{
|
|
EndAction(false);
|
|
return;
|
|
}
|
|
if (Equal) EndAction(skill.Level == Level);
|
|
else
|
|
{
|
|
if (GreaterThan) EndAction(skill.Level >= Level);
|
|
else EndAction(skill.Level <= Level);
|
|
}
|
|
}
|
|
}
|
|
} |