Fix and integrate BT
This commit is contained in:
@@ -12,7 +12,7 @@ typedef enum BzBTStatus {
|
||||
BZ_BT_ERROR,
|
||||
} BzBTStatus;
|
||||
|
||||
typedef BzBTStatus(*BzBTActionFn)(void *data);
|
||||
typedef BzBTStatus(*BzBTActionFn)(void *data, f32 dt);
|
||||
|
||||
typedef enum BzBTNodeType {
|
||||
// Composite
|
||||
@@ -38,8 +38,12 @@ typedef struct BzBTNodeState BzBTNodeState;
|
||||
|
||||
typedef struct BzBTState {
|
||||
const BzBTNode *root;
|
||||
BzBTNodeState *first;
|
||||
BzBTNodeState *last;
|
||||
BzBTNodeState *_first;
|
||||
BzBTNodeState *_last;
|
||||
|
||||
BzBTActionFn onSuccess;
|
||||
BzBTActionFn onFailure;
|
||||
BzBTActionFn onError;
|
||||
|
||||
BzObjectPool *nodeStatePool;
|
||||
void *userData;
|
||||
@@ -91,6 +95,8 @@ BzBTNode *bzBTNodeNext(const BzBTNode *node);
|
||||
const BzBTNodeState *bzBTNodeStateNext(const BzBTNodeState *state);
|
||||
bool bzBTNodeMatchesState(const BzBTNode *node, const BzBTNodeState *state);
|
||||
|
||||
BzBTNode *bzBTCompStateGetRunningChild(const BzBTNodeState *state);
|
||||
|
||||
i32 bzBTRepeatStateGetIter(const BzBTNodeState *state);
|
||||
f32 bzBTDelayStateGetElapsed(const BzBTNodeState *state);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user