/// <summary> /// Remove the current sensor from the robot /// </summary> /// <param name="robot"></param> public void RemoveSensorsFromRobot(SimulatorRobot robot) { List <GameObject> sensorsOnRobot = sensorManager.GetSensorsFromRobot(robot); foreach (GameObject removingSensors in sensorsOnRobot) { string type = removingSensors.GetComponent <SensorBase>().sensorType; Destroy(removingSensors); sensorManager.RemoveSensor(removingSensors, type); ShiftOutputPanels(); if (currentSensor != null && currentSensor.Equals(removingSensors.GetComponent <SensorBase>())) { currentSensor = null; EndProcesses(); } tabStateMachine.FindState <SensorToolbarState>().RemoveSensorFromDropdown(type, sensorManager.ultrasonicList, sensorManager.beamBreakerList, sensorManager.gyroList); } }
/// <summary> /// Remove the current sensor from the robot /// </summary> /// <param name="robot"></param> public void RemoveSensorsFromRobot(SimulatorRobot robot) { List <GameObject> sensorsOnRobot = sensorManager.GetSensorsFromRobot(robot); foreach (GameObject removingSensors in sensorsOnRobot) { string type = removingSensors.GetComponent <SensorBase>().sensorType; Destroy(removingSensors); sensorManager.RemoveSensor(removingSensors, type); ShiftOutputPanels(); if (currentSensor != null && currentSensor.Equals(removingSensors.GetComponent <SensorBase>())) { currentSensor = null; EndProcesses(); } tabStateMachine.FindState <SensorToolbarState>().RemoveSensorFromDropdown(type, sensorManager.ultrasonicList, sensorManager.beamBreakerList, sensorManager.gyroList); } AnalyticsManager.GlobalInstance.LogEventAsync(AnalyticsLedger.EventCatagory.SensorTab, AnalyticsLedger.EventAction.Removed, "Sensors", AnalyticsLedger.getMilliseconds().ToString()); }