private CharacterCreationSubState AdvanceState(CharacterCreationSubState current) { // This character creation state machine can return actual creation state objects - if someone // were to expand and add new creation state(s) that are not MUD-agnostic, then they should also // add and use their own CreationStateMachine handling those states instead of this default one; // they could of course reuse some/all of the states below in addition to their own. if (current is ConfirmCreationEntryState) { return(new GetNameState(this.Session)); } else if (current is GetNameState) { return(new GetPasswordState(this.Session)); } else if (current is GetPasswordState) { return(new ConfirmPasswordState(this.Session)); } else if (current is ConfirmPasswordState) { return(new PickGenderState(this.Session)); } else if (current is PickGenderState) { return(new GetDescriptionState(this.Session)); } else if (current is GetDescriptionState) { return(new SetAttributesState(this.Session)); } else if (current is SetAttributesState) { return(new PickSkillsState(this.Session)); } else if (current is PickSkillsState) { return(new PickTalentsState(this.Session)); } else if (current is PickTalentsState) { return(new PickRaceState(this.Session)); } else if (current is PickRaceState) { // We are done with character creation! return(null); } throw new InvalidOperationException("The character state machine does not know how to calculate the next step after '" + current.GetType().Name + "' succeeds"); }
private CharacterCreationSubState RegressState(CharacterCreationSubState current) { if (current is ConfirmPasswordState) { // If password confirmation failed, try selecting a new password. return(new GetPasswordState(this.Session)); } throw new InvalidOperationException("The character state machine does not know how to calculate the next step after '" + current.GetType().Name + "' fails"); }