state machine, parallel seems to work, final state and info about active atomic states
This commit is contained in:
@@ -71,11 +71,24 @@ void PITransitionBase::trigger() {
|
||||
target_path.remove(target_path.size_s() - common_count, common_count);
|
||||
// piCout << "source_path" << source_path;
|
||||
// piCout << "target_path" << target_path;
|
||||
source_state->setChildActiveRecursive(false);
|
||||
// piCout << "source_state before" << source_state;
|
||||
for (int i = target_path.size_s() - 1; i >= 0; --i) {
|
||||
// piCout << "check" << source_state->activeChild() << target_path[i];
|
||||
if (source_state->activeChild() == target_path[i])
|
||||
source_state = target_path[i];
|
||||
else
|
||||
break;
|
||||
}
|
||||
// piCout << "source_state after" << source_state;
|
||||
source_state->setChildrenActiveRecursive(false);
|
||||
for (auto * s: source_path)
|
||||
s->setActive(false);
|
||||
makeAction();
|
||||
for (auto * s: source_target_path)
|
||||
s->setActive(true);
|
||||
for (int i = 0; i < source_target_path.size_s(); ++i) {
|
||||
if (i == source_target_path.size_s() - 1)
|
||||
source_target_path[i]->start();
|
||||
else
|
||||
source_target_path[i]->activeChild(source_target_path[i + 1]);
|
||||
}
|
||||
if (target_state->isCompound()) target_state->start();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user