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.

24 line
753 B

  1. %%%-------------------------------------------------------------------
  2. %%% @author DY
  3. %%% @copyright (C) 2020, <COMPANY>
  4. %%% @doc
  5. %%% 判断体力是否小于某值
  6. %%% 是:SUCCESS
  7. %%% 否:FAILURE
  8. %%% @end
  9. %%% Created : 07. 10月 2020 15:20
  10. %%%-------------------------------------------------------------------
  11. -module(cond_power_lt).
  12. -include("eBhv3.hrl").
  13. -include("example.hrl").
  14. %% API
  15. -export([tick/2]).
  16. tick(#{properties := #{power := LTPower}} = _BTree, #{cur_power := CurPower} = State) ->
  17. case CurPower < LTPower of
  18. true ->
  19. ?INFO("~ts:当前体力低于~w点,必须要尽快休息恢复体力!", [maps:get(uid, State), LTPower]),
  20. {?BT_SUCCESS, State};
  21. false ->
  22. {?BT_FAILURE, State}
  23. end.