// Called when the state has been changed away to the given state protected override void onChangedTo(ref GameState newState) { if(newState is GSBattleScene) { // Variables GSBattleScene gsbs= (GSBattleScene)newState; gsbs.info= currBattleInfo; } }
// Called when the state has been changed away to the given state protected virtual void onChangedTo(ref GameState newState) { }
// Called when the state has been changed away from the given state protected virtual void onChangedFrom(ref GameState oldState) { }
// Internally called when the state has been changed away to the given state internal void i_changedTo(ref GameState newState) { onChangedTo(ref newState); }
// Internally called when the state has been changed away from the given state internal void i_changedFrom(ref GameState oldState) { onChangedFrom(ref oldState); }
// --- Methods --- // Adds the given state to the game public void addState(string name, GameState state) { if(!states.add(name, state)) throw new Exception("Could not load in game state: "+name); state.i_init(game); }