MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / tick

Method tick

Source/Platformer/AINode.cpp:346–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344/* SeqNode */
345
346Status SeqNode::tick(Blackboard* board) {
347 if (_children.empty()) return Status::Success;
348 int index = 0;
349 uint32_t key = getId();
350 if (auto value = board->get(key)) {
351 index = value->toVal<int>();
352 } else
353 board->set(key, Value::alloc(index));
354 auto status = Status::Running;
355 do {
356 status = _children[index]->tick(board);
357 switch (status) {
358 case Status::Running:
359 return Status::Running;
360 case Status::Success: {
361 index++;
362 if (index >= s_cast<int>(_children.size())) {
363 board->remove(key);
364 return Status::Success;
365 }
366 board->set(key, Value::alloc(index));
367 break;
368 }
369 case Status::Failure:
370 board->remove(key);
371 return Status::Failure;
372 }
373 } while (status == Status::Success);
374 return Status::Running;
375}
376
377/* SelNode */
378

Callers 3

updateMethod · 0.80
tic_core_tickFunction · 0.80
scheduleFunction · 0.80

Calls 15

getIdFunction · 0.85
_handlerFunction · 0.85
getStatusMethod · 0.80
getMethod · 0.65
setMethod · 0.65
removeMethod · 0.65
startMethod · 0.65
allocFunction · 0.50
createFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
getOwnerMethod · 0.45

Tested by

no test coverage detected