/// <summary> /// Remove the active robot from the robot parking. /// </summary> public void Destroy() { if (ActiveRobot != 0) { //Remove the robot from the parking and reset the active robot. RobotParking.Remove(ActiveRobot); ActiveRobot = 0; } else { // There's not an active robot. Console.WriteLine("There's no active robot. Try USE [Id] to select a robot."); } }
/// <summary> /// Remove a specific robot from the robot parking by its id. /// </summary> /// <param name="id"></param> public void Destroy(int id) { if (RobotParking.ContainsKey(id)) { //Remove the robot from the parking. RobotParking.Remove(id); //if the id is the current active robot, reset the active robot. If not remains the current value. if (ActiveRobot == id) { ActiveRobot = 0; } } else { // Provided Id not exist in the roboparking dictionary. Console.WriteLine("A robot with that Id does not exist."); } }