behavior3行为树
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
473 B

пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
  1. -module(priority).
  2. -include("eBhv3.hrl").
  3. -export([tick/2]).
  4. -spec tick(bt_node(), bt_state()) -> {bt_status(), bt_state()}.
  5. tick(#{children := Children} = _BTNode, BTState) ->
  6. tick_1(Children, BTState).
  7. tick_1([ChildID | T], BTState) ->
  8. case base_node:execute(ChildID, BTState) of
  9. {?BT_FAILURE, BTState1} ->
  10. tick_1(T, BTState1);
  11. {BTStatus, BTState1} ->
  12. {BTStatus, BTState1}
  13. end;
  14. tick_1([], BTState) ->
  15. {?BT_FAILURE, BTState}.