/// <summary> /// When the user adds a MaMRobot in multiplayer mode, sets the player prefs to file paths of robot parts /// </summary> void AddMaMRobot() { string baseDirectory = mixAndMatchModeScript.GetComponent <MaMGetters>().GetDriveBase(selectedDriveBase); string manipulatorDirectory = mixAndMatchModeScript.GetComponent <MaMGetters>().GetManipulator(selectedManipulator); RobotTypeManager.IsMixAndMatch = true; RobotTypeManager.RobotPath = mixAndMatchModeScript.GetComponent <MaMGetters>().GetDriveBase(selectedDriveBase); if (selectedManipulator == 0) { RobotTypeManager.HasManipulator = false; } else { RobotTypeManager.HasManipulator = true; RobotTypeManager.ManipulatorPath = manipulatorDirectory; } RobotTypeManager.WheelPath = mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheel(SelectedWheel); RobotTypeManager.SetWheelProperties(mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelMass(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelRadius(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelFriction(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelLateralFriction(SelectedWheel)); PlayerPrefs.SetString("simSelectedReplay", string.Empty); GameObject simulatorObject = GameObject.Find("Simulator"); simulatorObject.GetComponent <LocalMultiplayer>().AddMaMRobot(baseDirectory, manipulatorDirectory, RobotTypeManager.HasManipulator); }
/// <summary> /// When the user changes wheels/drive bases/manipulators within the simulator, changes the robot. /// </summary> void ChangeMaMRobot() { string baseDirectory = mixAndMatchModeScript.GetComponent <MaMGetters>().GetDriveBase(selectedDriveBase); string manipulatorDirectory = mixAndMatchModeScript.GetComponent <MaMGetters>().GetManipulator(selectedManipulator); PlayerPrefs.SetString("simSelectedReplay", string.Empty); RobotTypeManager.IsMixAndMatch = true; RobotTypeManager.RobotPath = baseDirectory; if (selectedManipulator == 0) { RobotTypeManager.HasManipulator = false; } else { RobotTypeManager.HasManipulator = true; RobotTypeManager.ManipulatorPath = manipulatorDirectory; } RobotTypeManager.WheelPath = mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheel(SelectedWheel); RobotTypeManager.SetWheelProperties(mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelMass(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelRadius(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelFriction(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelLateralFriction(SelectedWheel)); StateMachine.SceneGlobal.gameObject.GetComponent <SimUI>().MaMChangeRobot(baseDirectory, manipulatorDirectory); if (PlayerPrefs.GetInt("analytics") == 1) //For analytics tracking { Analytics.CustomEvent("Changed Mix and Match Robot", new Dictionary <string, object> { }); } }
/// <summary> /// When the user adds a MaMRobot in multiplayer mode, sets the player prefs to file paths of robot parts /// </summary> void AddMaMRobot() { string baseDirectory = mixAndMatchModeScript.GetComponent <MaMGetters>().GetDriveBase(selectedDriveBase); string manipulatorDirectory = mixAndMatchModeScript.GetComponent <MaMGetters>().GetManipulator(selectedManipulator); RobotTypeManager.IsMixAndMatch = true; RobotTypeManager.RobotPath = mixAndMatchModeScript.GetComponent <MaMGetters>().GetDriveBase(selectedDriveBase); if (selectedManipulator == 0) { RobotTypeManager.HasManipulator = false; } else { RobotTypeManager.HasManipulator = true; RobotTypeManager.ManipulatorPath = manipulatorDirectory; } RobotTypeManager.WheelPath = mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheel(SelectedWheel); RobotTypeManager.SetWheelProperties(mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelMass(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelRadius(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelFriction(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelLateralFriction(SelectedWheel)); PlayerPrefs.SetString("simSelectedReplay", string.Empty); GameObject simulatorObject = GameObject.Find("Simulator"); AnalyticsManager.GlobalInstance.LogEventAsync(AnalyticsLedger.EventCatagory.AddRobot, AnalyticsLedger.EventAction.Changed, "Local Multiplayer - Mix and Match Robot", AnalyticsLedger.getMilliseconds().ToString()); simulatorObject.GetComponent <LocalMultiplayer>().AddMaMRobot(baseDirectory, manipulatorDirectory, RobotTypeManager.HasManipulator); }
/// <summary> /// When the user changes wheels/drive bases/manipulators within the simulator, changes the robot. /// </summary> void ChangeMaMRobot() { string baseDirectory = mixAndMatchModeScript.GetComponent <MaMGetters>().GetDriveBase(selectedDriveBase); string manipulatorDirectory = mixAndMatchModeScript.GetComponent <MaMGetters>().GetManipulator(selectedManipulator); PlayerPrefs.SetString("simSelectedReplay", string.Empty); RobotTypeManager.IsMixAndMatch = true; RobotTypeManager.RobotPath = baseDirectory; if (selectedManipulator == 0) { RobotTypeManager.HasManipulator = false; } else { RobotTypeManager.HasManipulator = true; RobotTypeManager.ManipulatorPath = manipulatorDirectory; } RobotTypeManager.WheelPath = mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheel(SelectedWheel); RobotTypeManager.SetWheelProperties(mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelMass(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelRadius(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelFriction(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelLateralFriction(SelectedWheel)); StateMachine.SceneGlobal.gameObject.GetComponent <SimUI>().MaMChangeRobot(baseDirectory, manipulatorDirectory); AnalyticsManager.GlobalInstance.LogEventAsync(AnalyticsLedger.EventCatagory.ChangeRobot, AnalyticsLedger.EventAction.Changed, "Robot - Mix and Match", AnalyticsLedger.getMilliseconds().ToString()); }
/// <summary> /// Sets the destination paths of the selected field, robot base and manipulator to be used by MainState. Starts the simulation in Quick Swap Mode. /// </summary> public void StartMaMSim() { RobotTypeManager.IsMixAndMatch = true; RobotTypeManager.RobotPath = mixAndMatchModeScript.GetComponent <MaMGetters>().GetDriveBase(selectedDriveBase); RobotTypeManager.ManipulatorPath = mixAndMatchModeScript.GetComponent <MaMGetters>().GetManipulator(selectedManipulator); RobotTypeManager.WheelPath = mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheel(SelectedWheel); RobotTypeManager.SetWheelProperties(mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelMass(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelRadius(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelFriction(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelLateralFriction(SelectedWheel)); PlayerPrefs.SetString("simSelectedReplay", string.Empty); SceneManager.LoadScene("Scene"); AnalyticsManager.GlobalInstance.LogTimingAsync(AnalyticsLedger.TimingCatagory.MainSimulator, AnalyticsLedger.TimingVarible.Playing, AnalyticsLedger.TimingLabel.MixAndMatch); }
/// <summary> /// Sets the destination paths of the selected field, robot base and manipulator to be used by MainState. Starts the simulation in Quick Swap Mode. /// </summary> public void StartMaMSim() { RobotTypeManager.IsMixAndMatch = true; RobotTypeManager.RobotPath = mixAndMatchModeScript.GetComponent <MaMGetters>().GetDriveBase(selectedDriveBase); RobotTypeManager.ManipulatorPath = mixAndMatchModeScript.GetComponent <MaMGetters>().GetManipulator(selectedManipulator); RobotTypeManager.WheelPath = mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheel(SelectedWheel); RobotTypeManager.SetWheelProperties(mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelMass(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelRadius(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelFriction(SelectedWheel), mixAndMatchModeScript.GetComponent <MaMGetters>().GetWheelLateralFriction(SelectedWheel)); PlayerPrefs.SetString("simSelectedReplay", string.Empty); SceneManager.LoadScene("Scene"); if (PlayerPrefs.GetInt("analytics") == 1) //for analytics tracking { Analytics.CustomEvent("Started Mix and Match", new Dictionary <string, object> { }); } }