Пример #1
0
 /// <summary>
 /// Changes the active robot to a new robot with a given directory
 /// </summary>
 /// <param name="directory"></param>
 /// <returns>whether the process was successful</returns>
 public bool ChangeRobot(string directory)
 {
     sensorManager.RemoveSensorsFromRobot(activeRobot);
     sensorManagerGUI.ShiftOutputPanels();
     sensorManagerGUI.EndProcesses();
     return(activeRobot.InitializeRobot(directory, this));
 }
Пример #2
0
    /// <summary>
    /// Changes the active robot to a new robot with a given directory
    /// </summary>
    /// <param name="directory"></param>
    /// <returns>whether the process was successful</returns>
    public bool ChangeRobot(string directory, bool isMixAndMatch)
    {
        sensorManager.RemoveSensorsFromRobot(ActiveRobot);
        sensorManagerGUI.ShiftOutputPanels();
        sensorManagerGUI.EndProcesses();
        if (ActiveRobot.RobotHasManipulator)
        {
            ActiveRobot.DeleteManipulatorNodes();
            ActiveRobot.RobotHasManipulator = false;
        }

        ActiveRobot.RobotIsMixAndMatch = isMixAndMatch;
        return(ActiveRobot.InitializeRobot(directory, this));
    }
Пример #3
0
        /// <summary>
        /// Changes the active robot to a new robot with a given directory
        /// </summary>
        /// <param name="directory"></param>
        /// <returns>whether the process was successful</returns>
        public bool ChangeRobot(string directory, bool isMixAndMatch)
        {
            sensorManager.RemoveSensorsFromRobot(ActiveRobot);
            sensorManagerGUI.ShiftOutputPanels();
            sensorManagerGUI.EndProcesses();

            RemoveRobot(SpawnedRobots.IndexOf(ActiveRobot));
            //ActiveRobot = null;

            if (LoadRobot(directory, isMixAndMatch))
            {
                DynamicCamera.ControlEnabled = true;
                return(true);
            }

            return(false);
        }
Пример #4
0
        /// <summary>
        /// Changes the active robot to a new robot with a given directory
        /// </summary>
        /// <param name="directory"></param>
        /// <returns>whether the process was successful</returns>
        public bool ChangeRobot(string directory, bool isMixAndMatch)
        {
            sensorManager.RemoveSensorsFromRobot(ActiveRobot);
            sensorManagerGUI.ShiftOutputPanels();
            sensorManagerGUI.EndProcesses();

            int index = SpawnedRobots.IndexOf(ActiveRobot);

            robotCameraManager.RemoveCamerasFromRobot(SpawnedRobots[index]);
            sensorManager.RemoveSensorsFromRobot(SpawnedRobots[index]);

            MaMRobot mamRobot = SpawnedRobots[index] as MaMRobot;

            if (mamRobot != null && mamRobot.RobotHasManipulator)
            {
                UnityEngine.Object.Destroy(mamRobot.ManipulatorObject);
            }

            UnityEngine.Object.Destroy(SpawnedRobots[index].gameObject);
            ActiveRobot = null;

            if (LoadRobot(directory, isMixAndMatch, index))
            {
                DynamicCamera.ControlEnabled = true;

                int i = 0;
                foreach (SimulatorRobot robot in SpawnedRobots)
                {
                    robot.ControlIndex = i;
                    i++;
                }

                return(true);
            }

            return(false);
        }