Simple state machine handling similar to old UnrealScript in classes, best feature of that language. When a state is active its' functions shadow those of the class.
class MyClass {
void Function() {
log.Print("default call");
}
void GoRed() { SetState(MyClass::RedLight); }
void GoGreen() { SetState(MyClass::GreenLight); }
void Reset() { SetState(-1); }
state RedLight {
void OnEnter() { // OnEnter / OnExit are optional special titles that will be searched for when the injected 'SetState' function is built
log.Print("entered red light");
}
void Function() {
log.Print("RED LIGHT!");
}
}
state GreenLight {
void OnExit() {
log.Print("left green light");
}
void Function() {
log.Print("GREEN LIGHT");
}
}
}
I've got a working implementation of the above with the limitations of no fields/properties in states. Still working out what the awkward cases are.
Simple state machine handling similar to old UnrealScript in classes, best feature of that language. When a state is active its' functions shadow those of the class.
I've got a working implementation of the above with the limitations of no fields/properties in states. Still working out what the awkward cases are.