finishes state flow and adds temp audio

This commit is contained in:
Marcel 2024-05-27 10:19:28 +02:00
parent bc5d7e1941
commit 43d31651cd
6 changed files with 65 additions and 7 deletions

View file

@ -9,26 +9,27 @@ StateMachine::~StateMachine() {
delete currentState;
}
void StateMachine::updateState(State* newState) {
void StateMachine::updateState(State* newState, const Context& context) {
if (newState != currentState) {
delete currentState;
currentState = newState;
currentState->activated(context);
}
}
void StateMachine::pickedUp(const Context& context) {
State* newState = currentState->pickedUp(context);
updateState(newState);
updateState(newState, context);
}
void StateMachine::putDown(const Context& context, Station* newStation) {
State* newState = currentState->putDown(context, newStation);
updateState(newState);
updateState(newState, context);
}
void StateMachine::update(const Context& context) {
State* newState = currentState->update(context);
updateState(newState);
updateState(newState, context);
}
String StateMachine::updateDisplay() const