Example #1
0
        public Robot BuildRobot(RobotType RobotType)
        {
            var parts = GetRobotPartsFor(RobotType);

            if (parts?.Count == 0)
            {
                return(null);
            }

            switch (RobotType)
            {
            case RobotType.RoboticDog:
                return(_robotService.BuildRobotDog(parts));

            case RobotType.RoboticCat:
                return(_robotService.BuildRobotCat(parts));

            case RobotType.RoboticDrone:
                return(_robotService.BuildRobotDrone(parts));

            case RobotType.RoboticCar:
                return(_robotService.BuildRobotCar(parts));

            default:
                return(null);
            }
        }
Example #2
0
    // RobotType is an enum
    public override Robot BuildRobot(RobotType robotType)
    {
        // Removing all the redundant if statements since they all do the same thing.
        var parts = GetPartsFor(robotType);

        if (parts == null)
        {
            return(null);
        }
        return(_robotService.BuildRobotDog(parts));
    }
Example #3
0
        /// <summary>
        /// Builds a robot of a specific type.
        /// </summary>
        /// <param name="robotType"></param>
        /// <returns></returns>
        public RobotModel BuildRobot(RobotTypeEnum robotType)
        {
            switch (robotType)
            {
            case RobotTypeEnum.RoboticDog:
                return(_robotService.BuildRobotDog(GetRobotPartsFor(robotType)));

            case RobotTypeEnum.RoboticCat:
                return(_robotService.BuildRobotCat(GetRobotPartsFor(robotType)));

            case RobotTypeEnum.RobotocDrone:
                return(_robotService.BuildRobotDrone(GetRobotPartsFor(robotType)));

            default:
                return(_robotService.BuildRobotCar(GetRobotPartsFor(robotType)));
            }
        }