Example #1
0
    /// <summary>
    /// Changes the drive base, destroys old manipulator and creates new manipulator, sets wheels
    /// </summary>
    public void MaMChangeRobot(string robotDirectory, string manipulatorDirectory, int robotHasManipulator)
    {
        robotCameraManager.DetachCamerasFromRobot(main.activeRobot);
        sensorManager.RemoveSensorsFromRobot(main.activeRobot);

        main.ChangeRobot(robotDirectory);

        //If the current robot has a manipulator, destroy the manipulator
        if (robotHasManipulator == 1) //0 is false, 1 is true
        {
            main.DeleteManipulatorNodes();
        }

        //If the new robot has a manipulator, load the manipulator
        int newRobotHasManipulator = PlayerPrefs.GetInt("hasManipulator");

        if (newRobotHasManipulator == 1) //0 is false, 1 is true
        {
            main.LoadManipulator(manipulatorDirectory, main.activeRobot.gameObject);
        }
        else
        {
            main.activeRobot.robotHasManipulator = 0;
        }
    }
Example #2
0
    /// <summary>
    /// Changes the drive base, destroys old manipulator and creates new manipulator, sets wheels
    /// </summary>
    public void MaMChangeRobot(string robotDirectory, string manipulatorDirectory)
    {
        robotCameraManager.DetachCamerasFromRobot(main.ActiveRobot);
        sensorManager.RemoveSensorsFromRobot(main.ActiveRobot);

        //If the current robot has a manipulator, destroy the manipulator
        if (main.ActiveRobot.RobotHasManipulator)
        {
            main.DeleteManipulatorNodes();
        }

        main.ChangeRobot(robotDirectory, true);

        //If the new robot has a manipulator, load the manipulator
        if (RobotTypeManager.HasManipulator)
        {
            main.LoadManipulator(manipulatorDirectory, main.ActiveRobot.gameObject);
        }
        else
        {
            main.ActiveRobot.RobotHasManipulator = false;
        }
    }