60 lines
1.6 KiB
C#
60 lines
1.6 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年06月06日 星期五 19:06:16
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Logic.Action;
|
|
using Logic.AI;
|
|
using NodeCanvas.Framework;
|
|
using ParadoxNotion.Design;
|
|
|
|
|
|
namespace NodeCanvas.Tasks.Actions
|
|
{
|
|
[Category("AIAction")]
|
|
[Serializable]
|
|
public class AIActionRecoveryAndNoMove : BaseActionTask
|
|
{
|
|
protected override string desc => "回血并且原地不动";
|
|
|
|
|
|
protected override void OnExecute()
|
|
{
|
|
base.OnExecute();
|
|
// 直接从Blackboard获取AICalculatorData
|
|
var data = blackboard.GetVariable<AICalculatorData>("Data");
|
|
if (data?.value == null)
|
|
{
|
|
EndAction(false);
|
|
return;
|
|
}
|
|
|
|
var actionId = new CommonActionId();
|
|
actionId.ActionType = CommonActionType.UnitAction;
|
|
actionId.UnitActionType = UnitActionType.Recover;
|
|
var action = ActionLogicFactory.GetActionLogic(actionId);
|
|
if (action.CheckCan(data.value.TargetParam))
|
|
{
|
|
action.Execute(data.value.TargetParam);
|
|
EndAction(true);
|
|
return;
|
|
}
|
|
|
|
if (data.value.TargetParam.UnitData.MP > 0)
|
|
{
|
|
data.value.TargetParam.UnitData.CP = 0;
|
|
data.value.TargetParam.UnitData.MP = 0;
|
|
data.value.TargetParam.UnitData.AP = 0;
|
|
EndAction(true);
|
|
return;
|
|
}
|
|
|
|
EndAction(false);
|
|
}
|
|
}
|
|
} |