public IRobot GetRobotFromFactory(RoboType roboType) { IRobot robotCategory = null; if (shapes.ContainsKey(roboType)) { robotCategory = shapes[roboType]; } else { switch (roboType) { case RoboType.Small: robotCategory = new Robot(RoboType.Small); shapes[RoboType.Small] = robotCategory; break; case RoboType.Large: robotCategory = new Robot(RoboType.Large); shapes[RoboType.Large] = robotCategory; break; default: throw new System.Exception("Robo type not found !!!"); } } return(robotCategory); }
public Robot(RoboType roboType) { this.roboType = roboType; }