49 lines
1.2 KiB
C#
49 lines
1.2 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 UnityEngine;
|
|
|
|
|
|
namespace NodeCanvas.Tasks.Actions
|
|
{
|
|
[Category("AIAction")]
|
|
public class AICalculateAction : ActionTask
|
|
{
|
|
public List<CalculateType> CalculateTypes;
|
|
|
|
|
|
protected override string info
|
|
{
|
|
get { return string.Format($"评分策略为 {CalculateTypes[0]}"); }
|
|
}
|
|
|
|
protected override void OnExecute()
|
|
{
|
|
// 直接从Blackboard获取AICalculatorData
|
|
var data = blackboard.GetVariable<AICalculatorData>("Data");
|
|
if (data?.value == null)
|
|
{
|
|
EndAction(false);
|
|
return;
|
|
}
|
|
|
|
data.value.MaxAiAction = AIActionScoreCalculator.CalculateAIActionScore(data.value, CalculateTypes);
|
|
if (data.value.MaxAiAction == null)
|
|
{
|
|
EndAction(false);
|
|
return;
|
|
}
|
|
|
|
EndAction(true);
|
|
}
|
|
}
|
|
} |