Reputation: 555
If I follow instructions here and I have a game that changes the state over time, how do I reset the state?
Here's my attempt at pseudo code that does not work:
AFRAME.scenes[0].systems.state.state.game = AFRAME.scenes[0].systems.state.initialState.game;
Or perhaps it is not possible to fetch initial settings from the component, and instead I should create a global constant in my project like initialStateMine
that is used by the state component for initialization and also another function to reset the state?
Upvotes: 0
Views: 207
Reputation: 13233
Yeah, keep an initial state in a variable. Then if you want to replace Object.assign(state, initialState)
;
Upvotes: 1