public CharacterCustomizationController( CharacterCreationManager manager, Sheet character, List <CharacterCustomizationStep> staticSteps = null ) : base() { if (staticSteps == null) { this.staticSteps = new List <CharacterCustomizationStep> (); } else { this.staticSteps = staticSteps; } this.head = new CharacterCustomizationStep(this); this.head.OnDidEnter += HeadStateEntered; this.tail = new ConfirmCustomization(this); this.tail.OnDidEnter += TailStateEntered; this.head.LinkDestination(tail); this.manager = manager; this.character = character; }
public virtual void Confirm(OptButton tbn = null) { if (featuresSelected == null) { return; } // Debug.Log("Okay now " + this.GetType().ToString()); // Debug.Log("-> " + this.destination.GetType().ToString()); //check features for feature pointers. wire them into to be the next state, with the last customization state //pointing to this destination... List <CharacterCustomizationStep> steps = new List <CharacterCustomizationStep>(); foreach (GenericFeature f in featuresSelected) { if (f is FeaturePointer) { FeaturePointer pointer = (FeaturePointer)f; steps.Add(pointer.GetCustomizationStep(characterCustomization)); } } if (steps.Count > 0) { CharacterCustomizationStep nextStep = steps [0]; CharacterCustomizationStep nextPrevious = this; for (int i = 1; i < steps.Count; i++) { nextStep.destination = steps [i]; nextStep.previous = nextPrevious; nextPrevious = nextStep; nextStep = steps [i]; } nextStep.destination = destination; nextStep.previous = nextPrevious; characterCustomization.SwitchState(steps [0]); } else { characterCustomization.SwitchState(destination); } }
void StartOver() { Exiting(this, characterCustomization.head); CharacterCustomizationStep step = previous; while (step != characterCustomization.head) { step.ResetFeaturesSelected(); //step.Entered (step); //step.Exited (step); if (step is ChooseClass) { ChooseClass cc = (ChooseClass)step; cc.CleanLastChosen(); } step = step.previous; } characterCustomization.UpdateSheet(); characterCustomization.HeadStateEntered(characterCustomization.head, this); }
public void AddStaticStep(CharacterCustomizationStep step) { tail.previous.LinkDestination(step); step.LinkDestination(tail); }
public void LinkDestination(CharacterCustomizationStep dest) { destination = dest; dest.previous = this; }