public ModelMaker createModel(string Name) { ModelMaker newModel = null; switch (Name) { case "Walter White": newModel = new Walt(); break; case "Mike Ehrmantraut": newModel = new Mike(); break; case "Gustavo Fring": newModel = new Gus(); break; case "Flynn White": newModel = new Flynn(); break; case "Jesse Pinkman": newModel = new Jesse(); break; case "Saul Goodman": newModel = new Saul(); break; } return(newModel); }
private void btnMakeCharacter_Click(object sender, EventArgs e) { string currentHeadCharacterName = cbHead.SelectedItem.ToString(); string currentTorsoCharacterName = cbTorso.SelectedItem.ToString(); string currentLegsCharacterName = cbLegs.SelectedItem.ToString(); ModelFactory currentModelFactory = new ModelFactory(); ModelMaker currentModel = currentModelFactory.createModel(currentHeadCharacterName); pbHead.Image = currentModel.Head; currentModel = currentModelFactory.createModel(currentTorsoCharacterName); pbTorso.Image = currentModel.Torso; currentModel = currentModelFactory.createModel(currentLegsCharacterName); pbLegs.Image = currentModel.Legs; }