/// <summary> /// Finds all the UI game objects and assigns them to a variable /// </summary> void FindAllGameObjects() { //We need to make refernces to various buttons/text game objects, but using GameObject.Find is inefficient if we do it every update. //Therefore, we assign variables to them and only use GameObject.Find once for each object in startup. navigationPanel = AuxFunctions.FindObject(gameObject, "NavigationPanel"); selectionPanel = AuxFunctions.FindObject(gameObject, "SelectionPanel"); //The Mode Selection Tab GUI Objects defaultSimulator = AuxFunctions.FindObject(gameObject, "DefaultSimulator"); mixAndMatchMode = AuxFunctions.FindObject(gameObject, "MixAndMatchMode"); simLoadField = AuxFunctions.FindObject(gameObject, "SimLoadField"); simLoadRobot = AuxFunctions.FindObject(gameObject, "SimLoadRobot"); simLoadReplay = AuxFunctions.FindObject(gameObject, "SimLoadReplay"); splashScreen = AuxFunctions.FindObject(gameObject, "LoadSplash"); errorScreen = AuxFunctions.FindObject(gameObject, "ErrorScreen"); graphics = AuxFunctions.FindObject(gameObject, "Graphics"); input = AuxFunctions.FindObject(gameObject, "Input"); settingsMode = AuxFunctions.FindObject(gameObject, "SettingsMode"); enableTankDriveText = AuxFunctions.FindObject(gameObject, "EnableTankDriveText").GetComponent <Text>(); errorText = AuxFunctions.FindObject(errorScreen, "ErrorText").GetComponent <Text>(); simFieldSelectText = AuxFunctions.FindObject(defaultSimulator, "SimFieldSelectText"); simRobotSelectText = AuxFunctions.FindObject(defaultSimulator, "SimRobotSelectText"); AuxFunctions.FindObject(gameObject, "QualitySettingsText").GetComponent <Text>().text = QualitySettings.names[QualitySettings.GetQualityLevel()]; mixAndMatchModeScript = AuxFunctions.FindObject(gameObject, "MixAndMatchModeScript"); Debug.Log(mixAndMatchModeScript.ToString()); }
/// <summary> /// Spawns a new gamepiece at its defined spawn location, or at the field's origin if one hasn't been defined. /// </summary> /// <param name="index">0 if primary gamepiece, 1 if secondary gamepiece</param> public void SpawnGamepiece(int index) { if (gamepieceNames[index] != null) { try //In case the game piece somehow doens't exist in the scene { GameObject gameobject = Instantiate(AuxFunctions.FindObject(gamepieceNames[index]).GetComponentInParent <BRigidBody>().gameObject, gamepieceSpawn[index], UnityEngine.Quaternion.identity); gameobject.name = gamepieceNames[index] + "(Clone)"; gameobject.GetComponent <BRigidBody>().collisionFlags = BulletSharp.CollisionFlags.None; gameobject.GetComponent <BRigidBody>().velocity = UnityEngine.Vector3.zero; gameobject.tag = "Gamepiece_" + ((index == 0) ? "Primary" : "Secondary"); // Tagging so we can use it with the scoring area gameobject.GetComponent <GamePieceRememberSpawnParams>().PieceType = index; // allow us to easily reinstantiate from other scripts // gameobject.GetComponent<SphereCollider>().isTrigger = true; // gameobject.transform.GetChild(0).gameObject.AddComponent<MeshCollider>(); // gameobject.transform.GetChild(0).gameObject.GetComponent<MeshCollider>().isTrigger = true; // gameobject.transform.GetChild(0).gameObject.GetComponent<MeshCollider>().inflateMesh = true; // gameobject.transform.GetChild(0).gameObject.GetComponent<MeshCollider>().convex = true; // gameobject.transform.GetChild(0).gameObject.GetComponent<MeshCollider>().sharedMesh = // gameobject.transform.GetChild(0).gameObject.GetComponent<MeshFilter>().mesh; spawnedGamepieces[index].Add(gameobject); } catch { UserMessageManager.Dispatch("Gamepiece not found!", 5); } } else { UserMessageManager.Dispatch("You must define the gamepiece first!", 5); } }
public void StartRuler() { usingRuler = true; rulerStartPoint.SetActive(true); AuxFunctions.FindObject(canvas, "RulerStartButton").SetActive(false); AuxFunctions.FindObject(canvas, "RulerTooltipText").SetActive(true); }
/// <summary> /// Updates Tank Drive Slider from MainMenu to the active Scene. /// </summary> public void OnEnable() { tankDriveSwitch = AuxFunctions.FindObject("TankDriveSwitch"); tankDriveSwitch.GetComponent <Slider>().value = InputControl.mPlayerList[InputControl.activePlayerIndex].isTankDrive ? 1 : 0; unitConversionSwitch = AuxFunctions.FindObject("UnitConversionSwitch"); unitConversionSwitch.GetComponent <Slider>().value = PlayerPrefs.GetString("Measure").Equals("Metric") ? 1 : 0; }
void FindAllGameObjects() { //We need to make refernces to various buttons/text game objects, but using GameObject.Find is inefficient if we do it every update. //Therefore, we assign variables to them and only use GameObject.Find once for each object in startup. selectionPanel = AuxFunctions.FindObject(gameObject, "SelectionPanel"); //The Mode Selection Tab GUI Objects defaultSimulator = AuxFunctions.FindObject(gameObject, "DefaultSimulator"); driverPracticeMode = AuxFunctions.FindObject(gameObject, "DriverPracticeMode"); mixAndMatchMode = AuxFunctions.FindObject(gameObject, "MixAndMatchMode"); dpmConfiguration = AuxFunctions.FindObject(gameObject, "DPMConfiguration"); localMultiplayer = AuxFunctions.FindObject(gameObject, "LocalMultiplayer"); simLoadField = AuxFunctions.FindObject(gameObject, "SimLoadField"); simLoadRobot = AuxFunctions.FindObject(gameObject, "SimLoadRobot"); simLoadReplay = AuxFunctions.FindObject(gameObject, "SimLoadReplay"); dpmLoadField = AuxFunctions.FindObject(gameObject, "DPMLoadField"); dpmLoadRobot = AuxFunctions.FindObject(gameObject, "DPMLoadRobot"); multiplayerLoadField = AuxFunctions.FindObject(gameObject, "MultiplayerLoadField"); multiplayerLoadRobot = AuxFunctions.FindObject(gameObject, "MultiplayerLoadRobot"); splashScreen = AuxFunctions.FindObject(gameObject, "LoadSplash"); graphics = AuxFunctions.FindObject(gameObject, "Graphics"); input = AuxFunctions.FindObject(gameObject, "Input"); settingsMode = AuxFunctions.FindObject(gameObject, "SettingsMode"); simFieldSelectText = AuxFunctions.FindObject(defaultSimulator, "SimFieldSelectText"); simRobotSelectText = AuxFunctions.FindObject(defaultSimulator, "SimRobotSelectText"); dpmFieldSelectText = AuxFunctions.FindObject(driverPracticeMode, "DPMFieldSelectText"); dpmRobotSelectText = AuxFunctions.FindObject(driverPracticeMode, "DPMRobotSelectText"); configurationText = AuxFunctions.FindObject(dpmConfiguration, "ConfigurationText"); inputConflict = AuxFunctions.FindObject(gameObject, "InputConflict"); AuxFunctions.FindObject(gameObject, "QualitySettingsText").GetComponent <Text>().text = QualitySettings.names[QualitySettings.GetQualityLevel()]; }
/// <summary> /// Finds all the necessary UI elements that need to be updated/modified /// </summary> private void FindElements() { canvas = GameObject.Find("Canvas"); freeroamCameraWindow = AuxFunctions.FindObject(canvas, "FreeroamPanel"); spawnpointWindow = AuxFunctions.FindObject(canvas, "SpawnpointPanel"); swapWindow = AuxFunctions.FindObject(canvas, "SwapPanel"); wheelPanel = AuxFunctions.FindObject(canvas, "WheelPanel"); driveBasePanel = AuxFunctions.FindObject(canvas, "DriveBasePanel"); manipulatorPanel = AuxFunctions.FindObject(canvas, "ManipulatorPanel"); addRobotPanel = AuxFunctions.FindObject("MultiplayerPanel"); driverStationPanel = AuxFunctions.FindObject(canvas, "DriverStationPanel"); changeRobotPanel = AuxFunctions.FindObject(canvas, "ChangeRobotPanel"); robotListPanel = AuxFunctions.FindObject(changeRobotPanel, "RobotListPanel"); changeFieldPanel = AuxFunctions.FindObject(canvas, "ChangeFieldPanel"); inputManagerPanel = AuxFunctions.FindObject(canvas, "InputManagerPanel"); orientWindow = AuxFunctions.FindObject(canvas, "OrientWindow"); resetDropdown = GameObject.Find("Reset Robot Dropdown"); exitPanel = AuxFunctions.FindObject(canvas, "ExitPanel"); loadingPanel = AuxFunctions.FindObject(canvas, "LoadingPanel"); unitConversionButton = AuxFunctions.FindObject(canvas, "UnitConversionButton"); sensorManager = GameObject.Find("SensorManager").GetComponent <SensorManager>(); robotCameraManager = GameObject.Find("RobotCameraList").GetComponent <RobotCameraManager>(); mixAndMatchPanel = AuxFunctions.FindObject(canvas, "MixAndMatchPanel"); }
// Use this for initialization void Start() { canvas = GameObject.Find("Canvas"); toolkitWindow = AuxFunctions.FindObject(canvas, "ToolkitPanel"); //Ruler Objects rulerStartPoint = GameObject.Find("RulerStartPoint"); rulerEndPoint = GameObject.Find("RulerEndPoint"); rulerWindow = AuxFunctions.FindObject(canvas, "RulerPanel"); rulerText = AuxFunctions.FindObject(canvas, "RulerText").GetComponent <Text>(); rulerXText = AuxFunctions.FindObject(canvas, "RulerXAxisText").GetComponent <Text>(); rulerYText = AuxFunctions.FindObject(canvas, "RulerYAxisText").GetComponent <Text>(); rulerZText = AuxFunctions.FindObject(canvas, "RulerZAxisText").GetComponent <Text>(); //Stopwatch Objects stopwatchWindow = AuxFunctions.FindObject(canvas, "StopwatchPanel"); stopwatchText = AuxFunctions.FindObject(canvas, "StopwatchText").GetComponent <Text>(); stopwatchStartButtonText = AuxFunctions.FindObject(canvas, "StopwatchStartText").GetComponent <Text>(); stopwatchPauseButtonText = AuxFunctions.FindObject(canvas, "StopwatchPauseText").GetComponent <Text>(); //Dummy Robot Objects dummyWindow = AuxFunctions.FindObject(canvas, "DummyRobotPanel"); dummyList = AuxFunctions.FindObject(canvas, "DummyList").GetComponent <DummyScrollable>(); dummyIndicator = GameObject.Find("DummyIndicator"); dummyIndicator.SetActive(false); }
// Use this for initialization void Start() { canvas = GameObject.Find("Canvas"); toolkitWindow = AuxFunctions.FindObject(canvas, "ToolkitPanel"); sensorManagerGUI = GameObject.Find("StateMachine").GetComponent <SensorManagerGUI>(); //Ruler Objects rulerStartPoint = GameObject.Find("RulerStartPoint"); rulerEndPoint = GameObject.Find("RulerEndPoint"); rulerWindow = AuxFunctions.FindObject(canvas, "RulerPanel"); rulerText = AuxFunctions.FindObject(canvas, "RulerText").GetComponent <Text>(); rulerXText = AuxFunctions.FindObject(canvas, "RulerXAxisText").GetComponent <Text>(); rulerYText = AuxFunctions.FindObject(canvas, "RulerYAxisText").GetComponent <Text>(); rulerZText = AuxFunctions.FindObject(canvas, "RulerZAxisText").GetComponent <Text>(); //Stopwatch Objects stopwatchWindow = AuxFunctions.FindObject(canvas, "StopwatchPanel"); stopwatchText = AuxFunctions.FindObject(canvas, "StopwatchText").GetComponent <Text>(); stopwatchStartButtonText = AuxFunctions.FindObject(canvas, "StopwatchStartText").GetComponent <Text>(); stopwatchPauseButtonText = AuxFunctions.FindObject(canvas, "StopwatchPauseText").GetComponent <Text>(); //Stats Objects statsWindow = AuxFunctions.FindObject(canvas, "StatsPanel"); speedEntry = AuxFunctions.FindObject(statsWindow, "SpeedEntry"); speedUnit = AuxFunctions.FindObject(speedEntry, "Unit").GetComponent <Text>(); accelerationEntry = AuxFunctions.FindObject(statsWindow, "AccelerationEntry"); accelerationUnit = AuxFunctions.FindObject(accelerationEntry, "Unit").GetComponent <Text>(); angularVelocityEntry = AuxFunctions.FindObject(statsWindow, "AngularVelocityEntry"); weightEntry = AuxFunctions.FindObject(statsWindow, "WeightEntry"); weightUnit = AuxFunctions.FindObject(weightEntry, "Unit").GetComponent <Text>(); }
/// <summary> /// Finds all the necessary UI elements that need to be updated/modified /// </summary> private void FindElements() { canvas = GameObject.Find("Canvas"); freeroamCameraWindow = AuxFunctions.FindObject(canvas, "FreeroamPanel"); spawnpointWindow = AuxFunctions.FindObject(canvas, "SpawnpointPanel"); swapWindow = AuxFunctions.FindObject(canvas, "SwapPanel"); wheelPanel = AuxFunctions.FindObject(canvas, "WheelPanel"); driveBasePanel = AuxFunctions.FindObject(canvas, "DriveBasePanel"); manipulatorPanel = AuxFunctions.FindObject(canvas, "ManipulatorPanel"); addRobotPanel = AuxFunctions.FindObject("MultiplayerPanel"); driverStationPanel = AuxFunctions.FindObject(canvas, "DriverStationPanel"); changeRobotPanel = AuxFunctions.FindObject(canvas, "ChangeRobotPanel"); changeFieldPanel = AuxFunctions.FindObject(canvas, "ChangeFieldPanel"); driverStationPanel = AuxFunctions.FindObject(canvas, "DriverStationPanel"); inputManagerPanel = AuxFunctions.FindObject(canvas, "InputManagerPanel"); orientWindow = AuxFunctions.FindObject(canvas, "OrientWindow"); resetDropdown = GameObject.Find("Reset Robot Dropdown"); exitPanel = AuxFunctions.FindObject(canvas, "ExitPanel"); loadingPanel = AuxFunctions.FindObject(canvas, "LoadingPanel"); }
// Use this for initialization void Start() { stateMachine = GameObject.Find("StateMachine"); canvas = GameObject.Find("Canvas"); cameraToolTip = GameObject.Find("TooltipText (9)"); orientWindow = AuxFunctions.FindObject(canvas, "OrientWindow"); resetDropdown = GameObject.Find("Reset Robot Dropdown"); isOrienting = false; }
/// <summary> /// Toggles between meter and feet measurements /// </summary> public void ToggleUnitConversion() { if (canvas != null) { unitConversionSwitch = AuxFunctions.FindObject(canvas, "UnitConversionSwitch"); int i = (int)unitConversionSwitch.GetComponent <Slider>().value; main.IsMetric = (i == 1 ? true : false); } }
/// <summary> /// Finds all the necessary UI elements that need to be updated/modified /// </summary> private void FindElements() { canvas = GameObject.Find("Canvas"); mixAndMatchPanel = AuxFunctions.FindObject(canvas, "MixAndMatchPanel"); multiplayerPanel = AuxFunctions.FindObject(canvas, "MultiplayerPanel"); simUI = StateMachine.Instance.gameObject.GetComponent <SimUI>(); }
/// <summary> /// Find ALL the GUI stuff needed for the sensor GUI to work /// </summary> private void FindElements() { canvas = GameObject.Find("Canvas"); simUI = gameObject.GetComponent <SimUI>(); sensorManager = GameObject.Find("SensorManager").GetComponent <SensorManager>(); dynamicCamera = GameObject.Find("Main Camera").GetComponent <DynamicCamera>(); toolkit = GameObject.Find("StateMachine").GetComponent <Toolkit>(); sensorOptionPanel = AuxFunctions.FindObject(canvas, "SensorOptionPanel"); sensorTypePanel = AuxFunctions.FindObject(canvas, "SensorTypePanel"); configureSensorButton = AuxFunctions.FindObject(canvas, "ConfigureSensorButton"); //For sensor option panel addSensorButton = AuxFunctions.FindObject(sensorOptionPanel, "AddNewSensor"); selectExistingButton = AuxFunctions.FindObject(sensorOptionPanel, "ConfigureExistingSensor"); cancelOptionButton = AuxFunctions.FindObject(sensorOptionPanel, "CancelButton"); sensorOptionToolTip = AuxFunctions.FindObject(sensorOptionPanel, "ToolTipPanel"); //For choosing sensor type addUltrasonicButton = AuxFunctions.FindObject(sensorTypePanel, "AddUltrasonic"); addBeamBreakerButton = AuxFunctions.FindObject(sensorTypePanel, "AddBeamBreaker"); addGyroButton = AuxFunctions.FindObject(sensorTypePanel, "AddGyro"); cancelTypeButton = AuxFunctions.FindObject(sensorTypePanel, "CancelButton"); //For Sensor position and attachment configuration configureSensorPanel = AuxFunctions.FindObject(canvas, "SensorConfigurationPanel"); changeSensorNodeButton = AuxFunctions.FindObject(configureSensorPanel, "ChangeNodeButton"); sensorConfigurationModeButton = AuxFunctions.FindObject(configureSensorPanel, "ConfigurationMode"); sensorNodeText = AuxFunctions.FindObject(configureSensorPanel, "NodeText").GetComponent <Text>(); cancelNodeSelectionButton = AuxFunctions.FindObject(configureSensorPanel, "CancelNodeSelectionButton"); deleteSensorButton = AuxFunctions.FindObject(configureSensorPanel, "DeleteSensorButton"); hideSensorButton = AuxFunctions.FindObject(configureSensorPanel, "HideSensorButton"); //For Sensor angle configuration sensorAnglePanel = AuxFunctions.FindObject(canvas, "SensorAnglePanel"); xAngleEntry = AuxFunctions.FindObject(sensorAnglePanel, "xAngleEntry"); yAngleEntry = AuxFunctions.FindObject(sensorAnglePanel, "yAngleEntry"); zAngleEntry = AuxFunctions.FindObject(sensorAnglePanel, "zAngleEntry"); showAngleButton = AuxFunctions.FindObject(configureSensorPanel, "ShowSensorAngleButton"); editAngleButton = AuxFunctions.FindObject(sensorAnglePanel, "EditButton"); //For range configuration sensorRangePanel = AuxFunctions.FindObject(canvas, "SensorRangePanel"); RangeEntry = AuxFunctions.FindObject(sensorRangePanel, "RangeEntry"); showRangeButton = AuxFunctions.FindObject(configureSensorPanel, "ShowSensorRangeButton"); editRangeButton = AuxFunctions.FindObject(sensorRangePanel, "EditButton"); rangeUnit = AuxFunctions.FindObject(sensorRangePanel, "RangeUnit").GetComponent <Text>(); lockPositionButton = AuxFunctions.FindObject(configureSensorPanel, "LockPositionButton"); lockAngleButton = AuxFunctions.FindObject(configureSensorPanel, "LockAngleButton"); lockRangeButton = AuxFunctions.FindObject(configureSensorPanel, "LockRangeButton"); showSensorButton = AuxFunctions.FindObject(canvas, "ShowOutputButton"); sensorOutputPanel = AuxFunctions.FindObject(canvas, "SensorOutputBorder"); robotCameraGUI = GameObject.Find("StateMachine").GetComponent <RobotCameraGUI>(); }
/// <summary> /// Update the sensor output at the corresponding sensorOutputPanel /// </summary> public virtual void UpdateOutputDisplay() { GameObject outputPanel = GameObject.Find(gameObject.name + "_Panel"); if (outputPanel != null) { GameObject inputField = AuxFunctions.FindObject(outputPanel, "Entry"); inputField.GetComponent <InputField>().text = ReturnOutput().ToString(); } }
public override void UpdateOutputDisplay() { base.UpdateOutputDisplay(); GameObject outputPanel = GameObject.Find(gameObject.name + "_Panel"); if (outputPanel != null) { GameObject outputText = AuxFunctions.FindObject(outputPanel, "Text"); outputText.GetComponent <Text>().text = gameObject.name + " Output (1 closed)"; } }
/// <summary> /// Disable the ruler /// </summary> private void DisableRuler() { ignoreClick = true; firstPoint = BulletSharp.Math.Vector3.Zero; usingRuler = false; rulerStartPoint.GetComponent <LineRenderer>().enabled = false; rulerStartPoint.SetActive(false); rulerEndPoint.SetActive(false); AuxFunctions.FindObject(canvas, "RulerStartButton").SetActive(true); AuxFunctions.FindObject(canvas, "RulerTooltipText").SetActive(false); }
public void ShowControlPanel(bool show) { if (show) { AuxFunctions.FindObject(canvas, "InputManagerPanel").SetActive(true); } else { AuxFunctions.FindObject(canvas, "InputManagerPanel").SetActive(false); } }
/// <summary> /// Toggles between meter and feet measurements /// </summary> public void ToggleUnitConversion() { if (canvas != null) { unitConversionSwitch = AuxFunctions.FindObject(canvas, "UnitConversionSwitch"); int i = (int)unitConversionSwitch.GetComponent <Slider>().value; main.IsMetric = (i == 1 ? true : false); PlayerPrefs.SetString("Measure", i == 1 ? "Metric" : "Imperial"); //Debug.Log("Metric: " + main.IsMetric); } }
public void UpdateTankText() { if (Controls.IsTankDrive) { enableTankDriveText = AuxFunctions.FindObject(gameObject, "EnableTankDriveText").GetComponent <Text>(); enableTankDriveText.text = "Switch Arcade Drive"; } else { enableTankDriveText = AuxFunctions.FindObject(gameObject, "EnableTankDriveText").GetComponent <Text>(); enableTankDriveText.text = "Switch Tank Drive"; } }
/// <summary> /// Initiate ruler /// </summary> public void StartRuler() { usingRuler = true; rulerStartPoint.SetActive(true); AuxFunctions.FindObject(canvas, "RulerStartButton").SetActive(false); AuxFunctions.FindObject(canvas, "RulerTooltipText").SetActive(true); if (SimUI.changeAnalytics) { Analytics.CustomEvent("Used Ruler", new Dictionary <string, object> //for analytics tracking { }); } }
public override void UpdateOutputDisplay() { GameObject outputPanel = GameObject.Find(gameObject.name + "_Panel"); if (outputPanel != null) { GameObject inputField = AuxFunctions.FindObject(outputPanel, "Entry"); inputField.GetComponent <InputField>().text = state; //Debug.Log(state); GameObject outputText = AuxFunctions.FindObject(outputPanel, "Text"); outputText.GetComponent <Text>().text = gameObject.name + " Output"; } }
/// <summary> /// FInds all the gameobjects and stores them in variables for efficiency /// </summary> void Start() { canvas = GameObject.Find("Canvas"); multiplayerWindow = AuxFunctions.FindObject(canvas, "MultiplayerPanel"); addRobotWindow = AuxFunctions.FindObject(canvas, "AddRobotPanel"); for (int i = 0; i < robotButtons.Length; i++) { robotButtons[i] = AuxFunctions.FindObject(canvas, "Robot" + (i + 1) + "Button"); } simUI = StateMachine.Instance.gameObject.GetComponent <SimUI>(); highlight = AuxFunctions.FindObject(canvas, "HighlightActiveRobot"); }
public void StartGamepieceSpawn(int index) { if (definingRelease || definingIntake || addingGamepiece) { Debug.Log("User Error"); //Message Manager already dispatches error message to user } else if (settingSpawn == 0) { if (GameObject.Find(gamepieceNames[index]) != null) { if (spawnIndicator != null) { Destroy(spawnIndicator); } if (spawnIndicator == null) { spawnIndicator = Instantiate(AuxFunctions.FindObject(gamepieceNames[index]).GetComponentInParent <BRigidBody>().gameObject, new UnityEngine.Vector3(0, 3, 0), UnityEngine.Quaternion.identity); spawnIndicator.name = "SpawnIndicator"; Destroy(spawnIndicator.GetComponent <BRigidBody>()); if (spawnIndicator.transform.GetChild(0) != null) { spawnIndicator.transform.GetChild(0).name = "SpawnIndicatorMesh"; } Renderer render = spawnIndicator.GetComponentInChildren <Renderer>(); render.material.shader = Shader.Find("Transparent/Diffuse"); Color newColor = render.material.color; newColor.a = 0.6f; render.material.color = newColor; } spawnIndicator.transform.position = gamepieceSpawn[index]; settingSpawn = index + 1; DynamicCamera dynamicCamera = Camera.main.transform.GetComponent <DynamicCamera>(); lastCameraState = dynamicCamera.cameraState; dynamicCamera.SwitchCameraState(new DynamicCamera.SateliteState(dynamicCamera)); //MainState.ControlsDisabled = true; } else { UserMessageManager.Dispatch("You must define the gamepiece first!", 5f); } } else { FinishGamepieceSpawn(); //if already setting spawn, end editing process } }
/// <summary> /// Find all robot camera related GUI elements in the canvas /// </summary> public void FindGUIElements() { canvas = GameObject.Find("Canvas"); sensorManagerGUI = GameObject.Find("StateMachine").GetComponent <SensorManagerGUI>(); //For robot camera view window robotCameraView = Resources.Load("Images/RobotCameraView") as RenderTexture; robotCameraViewWindow = AuxFunctions.FindObject(canvas, "RobotCameraPanelBorder"); //For robot camera manager robotCameraListObject = GameObject.Find("RobotCameraList"); robotCameraManager = robotCameraListObject.GetComponent <RobotCameraManager>(); //For camera indicator if (CameraIndicator == null) { CameraIndicator = AuxFunctions.FindObject(robotCameraListObject, "CameraIndicator"); } showCameraButton = AuxFunctions.FindObject(canvas, "ShowCameraButton"); //For camera position and attachment configuration configureCameraPanel = AuxFunctions.FindObject(canvas, "CameraConfigurationPanel"); configureRobotCameraButton = AuxFunctions.FindObject(canvas, "CameraConfigurationButton"); changeCameraNodeButton = AuxFunctions.FindObject(configureCameraPanel, "ChangeNodeButton"); cameraConfigurationModeButton = AuxFunctions.FindObject(configureCameraPanel, "ConfigurationMode"); cameraNodeText = AuxFunctions.FindObject(configureCameraPanel, "NodeText").GetComponent <Text>(); cancelNodeSelectionButton = AuxFunctions.FindObject(configureCameraPanel, "CancelNodeSelectionButton"); //For camera angle configuration cameraAnglePanel = AuxFunctions.FindObject(canvas, "CameraAnglePanel"); xAngleEntry = AuxFunctions.FindObject(cameraAnglePanel, "xAngleEntry"); yAngleEntry = AuxFunctions.FindObject(cameraAnglePanel, "yAngleEntry"); zAngleEntry = AuxFunctions.FindObject(cameraAnglePanel, "zAngleEntry"); showAngleButton = AuxFunctions.FindObject(configureCameraPanel, "ShowCameraAngleButton"); editAngleButton = AuxFunctions.FindObject(cameraAnglePanel, "EditButton"); //For field of view configuration cameraFOVPanel = AuxFunctions.FindObject(canvas, "CameraFOVPanel"); FOVEntry = AuxFunctions.FindObject(cameraFOVPanel, "FOVEntry"); showFOVButton = AuxFunctions.FindObject(configureCameraPanel, "ShowCameraFOVButton"); editFOVButton = AuxFunctions.FindObject(cameraFOVPanel, "EditButton"); lockPositionButton = AuxFunctions.FindObject(configureCameraPanel, "LockPositionButton"); lockAngleButton = AuxFunctions.FindObject(configureCameraPanel, "LockAngleButton"); lockFOVButton = AuxFunctions.FindObject(configureCameraPanel, "LockFOVButton"); }
public override void UpdateOutputDisplay() { base.UpdateOutputDisplay(); GameObject outputPanel = GameObject.Find(gameObject.name + "_Panel"); if (outputPanel != null) { GameObject outputText = AuxFunctions.FindObject(outputPanel, "Text"); if (isMetric) { outputText.GetComponent <Text>().text = gameObject.name + " Output (meters)"; } else { outputText.GetComponent <Text>().text = gameObject.name + " Output (feet)"; } } }
void FindElements() { canvas = GameObject.Find("Canvas"); simUI = GetComponent <SimUI>(); dpmWindow = AuxFunctions.FindObject(canvas, "DPMPanel"); configWindow = AuxFunctions.FindObject(canvas, "ConfigurationPanel"); enableDPMText = AuxFunctions.FindObject(canvas, "EnableDPMText").GetComponent <Text>(); primaryGamepieceText = AuxFunctions.FindObject(canvas, "PrimaryGamepieceText").GetComponent <Text>(); secondaryGamepieceText = AuxFunctions.FindObject(canvas, "SecondaryGamepieceText").GetComponent <Text>(); configuringText = AuxFunctions.FindObject(canvas, "ConfiguringText").GetComponent <Text>(); configHeaderText = AuxFunctions.FindObject(canvas, "ConfigHeaderText").GetComponent <Text>(); releaseVelocityPanel = AuxFunctions.FindObject(canvas, "ReleaseVelocityPanel"); xOffsetEntry = AuxFunctions.FindObject(canvas, "XOffsetEntry"); yOffsetEntry = AuxFunctions.FindObject(canvas, "YOffsetEntry"); zOffsetEntry = AuxFunctions.FindObject(canvas, "ZOffsetEntry"); releaseSpeedEntry = AuxFunctions.FindObject(canvas, "ReleaseSpeedEntry"); releaseVerticalEntry = AuxFunctions.FindObject(canvas, "ReleaseVerticalEntry"); releaseHorizontalEntry = AuxFunctions.FindObject(canvas, "ReleaseHorizontalEntry"); releaseMechanismText = AuxFunctions.FindObject(canvas, "ReleaseMechanismText").GetComponent <Text>(); intakeMechanismText = AuxFunctions.FindObject(canvas, "IntakeMechanismText").GetComponent <Text>(); defineIntakeWindow = AuxFunctions.FindObject(canvas, "DefineIntakePanel"); defineReleaseWindow = AuxFunctions.FindObject(canvas, "DefineReleasePanel"); defineGamepieceWindow = AuxFunctions.FindObject(canvas, "DefineGamepiecePanel"); setSpawnWindow = AuxFunctions.FindObject(canvas, "SetGamepieceSpawnPanel"); intakeControlText = AuxFunctions.FindObject(canvas, "IntakeInputButton").GetComponentInChildren <Text>(); releaseControlText = AuxFunctions.FindObject(canvas, "ReleaseInputButton").GetComponentInChildren <Text>(); spawnControlText = AuxFunctions.FindObject(canvas, "SpawnInputButton").GetComponentInChildren <Text>(); primaryCountText = AuxFunctions.FindObject(canvas, "PrimaryCountText").GetComponent <Text>(); secondaryCountText = AuxFunctions.FindObject(canvas, "SecondaryCountText").GetComponent <Text>(); lockPanel = AuxFunctions.FindObject(canvas, "DPMLockPanel"); }
/// <summary> /// Spawns a new gamepiece at its defined spawn location, or at the field's origin if one hasn't been defined. /// </summary> /// <param name="index">0 if primary gamepiece, 1 if secondary gamepiece</param> public void SpawnGamepiece(int index) { if (gamepieceNames[index] != null) { try //In case the game piece somehow doens't exist in the scene { GameObject gameobject = Instantiate(AuxFunctions.FindObject(gamepieceNames[index]).GetComponentInParent <BRigidBody>().gameObject, gamepieceSpawn[index], UnityEngine.Quaternion.identity); gameobject.GetComponent <BRigidBody>().collisionFlags = BulletSharp.CollisionFlags.None; gameobject.GetComponent <BRigidBody>().velocity = UnityEngine.Vector3.zero; spawnedGamepieces[index].Add(gameobject); } catch { UserMessageManager.Dispatch("Gamepiece not found!", 5); } } else { UserMessageManager.Dispatch("You must define the gamepiece first!", 5); } }
/// <summary> /// Finds all the necessary UI elements that need to be updated/modified /// </summary> private void FindElements() { canvas = GameObject.Find("Canvas"); freeroamCameraWindow = AuxFunctions.FindObject(canvas, "FreeroamPanel"); spawnpointWindow = AuxFunctions.FindObject(canvas, "SpawnpointPanel"); multiplayerPanel = AuxFunctions.FindObject(canvas, "MultiplayerPanel"); driverStationPanel = AuxFunctions.FindObject(canvas, "DriverStationPanel"); changeRobotPanel = AuxFunctions.FindObject(canvas, "ChangeRobotPanel"); robotListPanel = AuxFunctions.FindObject(changeRobotPanel, "RobotListPanel"); changeFieldPanel = AuxFunctions.FindObject(canvas, "ChangeFieldPanel"); inputManagerPanel = AuxFunctions.FindObject(canvas, "InputManagerPanel"); checkSavePanel = AuxFunctions.FindObject(canvas, "CheckSavePanel"); unitConversionSwitch = AuxFunctions.FindObject(canvas, "UnitConversionSwitch"); hotKeyPanel = AuxFunctions.FindObject(canvas, "HotKeyPanel"); hotKeyButton = AuxFunctions.FindObject(canvas, "DisplayHotKeyButton"); orientWindow = AuxFunctions.FindObject(canvas, "OrientWindow"); resetDropdown = GameObject.Find("Reset Robot Dropdown"); exitPanel = AuxFunctions.FindObject(canvas, "ExitPanel"); loadingPanel = AuxFunctions.FindObject(canvas, "LoadingPanel"); analyticsPanel = AuxFunctions.FindObject(canvas, "AnalyticsPanel"); sensorManager = GameObject.Find("SensorManager").GetComponent <SensorManager>(); robotCameraManager = GameObject.Find("RobotCameraList").GetComponent <RobotCameraManager>(); robotCameraGUI = GameObject.Find("StateMachine").GetComponent <RobotCameraGUI>(); mixAndMatchPanel = AuxFunctions.FindObject(canvas, "MixAndMatchPanel"); toolbar = AuxFunctions.FindObject(canvas, "Toolbar"); changePanel = AuxFunctions.FindObject(canvas, "ChangePanel"); addPanel = AuxFunctions.FindObject(canvas, "AddPanel"); CheckControlPanel(); }
/// <summary> /// Finds all the necessary UI elements that need to be updated/modified /// </summary> private void FindElements() { canvas = GameObject.Find("Canvas"); mixAndMatchPanel = AuxFunctions.FindObject(canvas, "MixAndMatchPanel"); wheelPanel = AuxFunctions.FindObject(canvas, "WheelPanel"); driveBasePanel = AuxFunctions.FindObject(canvas, "DriveBasePanel"); manipulatorPanel = AuxFunctions.FindObject(canvas, "ManipulatorPanel"); addRobotPanel = AuxFunctions.FindObject("MultiplayerPanel"); changeRobotPanel = AuxFunctions.FindObject(canvas, "ChangeRobotPanel"); inputManagerPanel = AuxFunctions.FindObject(canvas, "InputManagerPanel"); exitPanel = AuxFunctions.FindObject(canvas, "ExitPanel"); loadingPanel = AuxFunctions.FindObject(canvas, "LoadingPanel"); simUI = StateMachine.Instance.gameObject.GetComponent <SimUI>(); }
/// <summary> /// Enables tank drive. /// </summary> public void OnEnableTankDrive() { if (!Controls.TankDriveEnabled) { Controls.TankDriveEnabled = true; Controls.IsTankDrive = true; Controls.CheckForKeyRemoval = false; Controls.SwitchControls(); Controls.Save(); enableTankDriveText = AuxFunctions.FindObject(gameObject, "EnableTankDriveText").GetComponent <Text>(); enableTankDriveText.text = "Switch Arcade Drive"; } else { Controls.TankDriveEnabled = false; Controls.IsTankDrive = false; Controls.CheckForKeyRemoval = true; Controls.SwitchControls(); Controls.Save(); enableTankDriveText = AuxFunctions.FindObject(gameObject, "EnableTankDriveText").GetComponent <Text>(); enableTankDriveText.text = "Switch Tank Drive"; } }