Behavior3的erlang支持库
添加如下内容到rebar.config
{deps, [
...
{behavior3erl, "1.0.0"}
]}.
$ rebar3 compile
{TitleMaps, TreeMaps, TreeNodeMaps} = behavior_tree:load_tree_file("example.json"),
{ok, RootID} = behavior_tree:init_btree_by_title(<<"example_ai"/utf8>>, TitleMaps, TreeMaps, TreeNodeMaps),
{_BTStatus, _BTState1} = behavior_tree:execute(RootID, BTState = #{}).
Behavior3 by erlang library
add to rebar.config
{deps, [
...
{behavior3erl, "1.0.0"}
]}.
$ rebar3 compile
{TitleMaps, TreeMaps, TreeNodeMaps} = behavior_tree:load_tree_file("example.json"),
{ok, RootID} = behavior_tree:init_btree_by_title(<<"example_ai"/utf8>>, TitleMaps, TreeMaps, TreeNodeMaps),
{_BTStatus, _BTState1} = behavior_tree:execute(RootID, BTState = #{}).