State
Allow an elemental entity to completely change its behavior as its internal energy transitions from solid to plasma.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: State
ARCANUM SCHOOL: Transmutation // Phase Shifting
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// D PATTERN //
interface ElementalState { void react(); }
class FrozenState : ElementalState { override void react() {} }
class PlasmaState : ElementalState { override void react() {} }
class Elemental {
private ElementalState state;
void setState(ElementalState s) { state = s; }
void react() { state.react(); }
}
Dynamic rebinding of core behaviors based on volatile internal states.
Runic Tags:
#behavioral
#state
#dlang
#finite-state-machine