using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///<<< BEGIN WRITING YOUR CODE FILE_INIT
///<<< END WRITING YOUR CODE
public class TestAgent: behaviac.Agent
{
public string bTName = "BT_Tree";
private behaviac.EBTStatus _status = behaviac.EBTStatus.BT_RUNNING;
private void Awake()
{
initBehaviac();
initAgent();
}
private void Update()
{
if (isExcuteTree() == false) return;
behaviac.Workspace.Instance.DebugUpdate();
_status = this.btexec();
}
private void initBehaviac()
{
// 行为树xml文件路径,我放在了StreamingAssets文件夹下
behaviac.Workspace.Instance.FilePath = Application.streamingAssetsPath;
behaviac.Workspace.Instance.FileFormat = behaviac.Workspace.EFileFormat.EFF_xml;
RegisterInstanceName<TestAgent>("TestAgent");
}
private bool initAgent()
{
bool bRet = this.btload(bTName );
if (!bRet)
UnityEngine.Debug.LogError("Behavior tree data load failed! " + bTName );
else
this.btsetcurrent(bTName );
return bRet;
}
// 是否可以执行行为树
private void isExcuteTree()
{
return true;
}
}
Unity 使用 腾讯Behaviac (三)
猜你喜欢
转载自blog.csdn.net/a0_67/article/details/119270043
今日推荐
周排行