67 lines
1.5 KiB
C#
67 lines
1.5 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年06月06日 星期五 19:06:16
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using System;
|
|
using Logic;
|
|
using Logic.AI;
|
|
using NodeCanvas.Framework;
|
|
using ParadoxNotion.Design;
|
|
using UnityEngine;
|
|
|
|
|
|
namespace NodeCanvas.Tasks.Actions
|
|
{
|
|
[Category("AI节点")]
|
|
[Serializable]
|
|
public class BaseActionTask : ActionTask
|
|
{
|
|
[SerializeField]
|
|
private uint nodeId;
|
|
|
|
public uint NodeId
|
|
{
|
|
get => nodeId;
|
|
set => nodeId = value;
|
|
}
|
|
|
|
protected override void OnExecute()
|
|
{
|
|
base.OnExecute();
|
|
MainEditor.Instance.BTNodeId = this.nodeId;
|
|
}
|
|
|
|
#if UNITY_EDITOR
|
|
public override void EndAction(bool success)
|
|
{
|
|
var records = AILogic.GetCurrentAIRecords();
|
|
if (records != null)
|
|
{
|
|
if (records.Count == 0) records.Add(new AIRecord());
|
|
var record = records[^1];
|
|
if (record.Action != null) records.Add(new AIRecord());
|
|
record = records[^1];
|
|
var stateRecord = new AIStateRecord
|
|
{
|
|
ID = nodeId,
|
|
Desc = desc,
|
|
Result = success,
|
|
};
|
|
record.StateRecords.Add(stateRecord);
|
|
}
|
|
|
|
base.EndAction(success);
|
|
}
|
|
#endif
|
|
|
|
|
|
//#if UNITY_EDITOR
|
|
protected override string info => $"<color=#4A90E2>ID:{desc}</color>";
|
|
protected virtual string desc => string.Empty;
|
|
//#endif
|
|
}
|
|
} |