void SetAirGateNumbers() { for (int i = 0; i < airGates.Count; i++) { string numberStr = (i + 1).ToString(); Component c = SceneHelper.FindFirstChildInHierarchy(airGates[i], Constants.AirGateNumberFront); Text text; if (c != null) { text = c.GetComponent <Text>(); if (text != null) { text.text = numberStr; } } c = SceneHelper.FindFirstChildInHierarchy(airGates[i], Constants.AirGateNumberBack); if (c != null) { text = c.GetComponent <Text>(); if (text != null) { text.text = numberStr; } } } }
public static void UpdateSettings() { DroneRacer dr = FindDroneRacer(); if (dr != null) { dr.power = PlayerPrefs.GetFloat(Constants.PowerOutput); dr.autoLevelStrength = PlayerPrefs.GetFloat(Constants.AutoLevelStrength); dr.autoLevel = PlayerPrefs.GetInt(Constants.AutoLevel) == 0 ? false : true; dr.altitudeHold = PlayerPrefs.GetInt(Constants.AltitudeHold) == 0 ? false : true; dr.altitudeHoldStrength = PlayerPrefs.GetFloat(Constants.AltitudeHoldStrength); dr.airMode = PlayerPrefs.GetInt(Constants.AirMode) == 0 ? false : true; dr.crashTolerance = PlayerPrefs.GetFloat(Constants.CrashTolerance); dr.detectCrash = PlayerPrefs.GetInt(Constants.DetectCrash) == 0 ? false : true; Camera c = SceneHelper.FindFirstChildInHierarchy <Camera>(dr, Constants.FpvCameraName); c.gameObject.SetActive(true); dr.UpdateCameraAngle(c); dr.UpdateCameraFov(c); DroneRacerJoystickInput.UpdateSettings(); } }
void Start() { top = SceneHelper.FindFirstChildInHierarchy <Transform>(this, "Top").gameObject; bottom = SceneHelper.FindFirstChildInHierarchy <Transform>(this, "Bottom").gameObject; front = SceneHelper.FindFirstChildInHierarchy <Transform>(this, "Front").gameObject; back = SceneHelper.FindFirstChildInHierarchy <Transform>(this, "Back").gameObject; left = SceneHelper.FindFirstChildInHierarchy <Transform>(this, "Left").gameObject; right = SceneHelper.FindFirstChildInHierarchy <Transform>(this, "Right").gameObject; UpdateSides(); }
void Start() { //Debug.Log("Start"); zeroThrustSpinPoint[0] = SceneHelper.FindFirstChildInHierarchy(this, "FrontLeft").GetComponent <Transform>(); zeroThrustSpinPoint[1] = SceneHelper.FindFirstChildInHierarchy(this, "FrontRight").GetComponent <Transform>(); zeroThrustSpinPoint[2] = SceneHelper.FindFirstChildInHierarchy(this, "BackLeft").GetComponent <Transform>(); zeroThrustSpinPoint[3] = SceneHelper.FindFirstChildInHierarchy(this, "BackRight").GetComponent <Transform>(); joystickInput = GetComponent <DroneRacerJoystickInput>(); droneRacerArm = GetComponent <DroneRacerArm>(); droneRigidbody = GetComponent <Rigidbody>(); UpdateSettings(); Initialize(GameManager.GetStartPosition()); }
void Awake() { if (instance == null) { instance = this; } else { Debug.LogError("UiManager has already been created."); } calibrateJoystickSteps = SceneHelper.FindFirstChildInHierarchy(this, "Calibrate").GetComponent <CalibrateJoystickSteps>(); startPanel.gameObject.SetActive(true); flightPanel.gameObject.SetActive(false); settingsPanel.gameObject.SetActive(false); calibrationPanel.gameObject.SetActive(false); ResetFlightPanel(); }
void Awake() { if (instance == null) { instance = this; } else { Debug.LogError("RaceInfoHud has already been created."); } rectTransform = GetComponent <RectTransform>(); startSizeDelta = rectTransform.sizeDelta; column1 = SceneHelper.FindFirstChildInHierarchy(this, "Column1").GetComponent <RectTransform>(); column2 = SceneHelper.FindFirstChildInHierarchy(this, "Column2").GetComponent <RectTransform>(); column3 = SceneHelper.FindFirstChildInHierarchy(this, "Column3").GetComponent <RectTransform>(); column4 = SceneHelper.FindFirstChildInHierarchy(this, "Column4").GetComponent <RectTransform>(); column5 = SceneHelper.FindFirstChildInHierarchy(this, "Column5").GetComponent <RectTransform>(); elapsedTime = SceneHelper.FindFirstChildInHierarchy(this, "ElapsedTime").GetComponent <Text>(); totalLapsText = SceneHelper.FindFirstChildInHierarchy(this, "TotalLaps").GetComponent <Text>(); }
void Awake() { inputMapper = GetComponent <InputMapper>(); moveLeftJoystickLeftRight.gameObject.SetActive(false); SceneHelper.FindFirstChildInHierarchy(moveLeftJoystickLeftRight, "Reset").GetComponent <Button>().onClick.AddListener(ResetCalibration); leftJoystickLeftRightInvert = SceneHelper.FindFirstChildInHierarchy(moveLeftJoystickLeftRight, "InvertToggle").GetComponent <Toggle>(); leftJoystickLeftRightInvert.onValueChanged.AddListener(ToggleInvert); SceneHelper.FindFirstChildInHierarchy(moveLeftJoystickLeftRight, "Next").GetComponent <Button>().onClick.AddListener(CalibrateYawNext); moveLeftJoystickUpDown.gameObject.SetActive(false); SceneHelper.FindFirstChildInHierarchy(moveLeftJoystickUpDown, "Back").GetComponent <Button>().onClick.AddListener(CalibrateThrottleBack); SceneHelper.FindFirstChildInHierarchy(moveLeftJoystickUpDown, "Reset").GetComponent <Button>().onClick.AddListener(ResetCalibration); leftJoystickUpDownInvert = SceneHelper.FindFirstChildInHierarchy(moveLeftJoystickUpDown, "InvertToggle").GetComponent <Toggle>(); leftJoystickUpDownInvert.onValueChanged.AddListener(ToggleInvert); SceneHelper.FindFirstChildInHierarchy(moveLeftJoystickUpDown, "Next").GetComponent <Button>().onClick.AddListener(CalibrateThrottleNext); moveRightJoystickLeftRight.gameObject.SetActive(false); SceneHelper.FindFirstChildInHierarchy(moveRightJoystickLeftRight, "Back").GetComponent <Button>().onClick.AddListener(CalibrateRollBack); SceneHelper.FindFirstChildInHierarchy(moveRightJoystickLeftRight, "Reset").GetComponent <Button>().onClick.AddListener(ResetCalibration); rightJoystickLeftRightInvert = SceneHelper.FindFirstChildInHierarchy(moveRightJoystickLeftRight, "InvertToggle").GetComponent <Toggle>(); rightJoystickLeftRightInvert.onValueChanged.AddListener(ToggleInvert); SceneHelper.FindFirstChildInHierarchy(moveRightJoystickLeftRight, "Next").GetComponent <Button>().onClick.AddListener(CalibrateRollNext); moveRightJoystickUpDown.gameObject.SetActive(false); SceneHelper.FindFirstChildInHierarchy(moveRightJoystickUpDown, "Back").GetComponent <Button>().onClick.AddListener(CalibratePitchBack); SceneHelper.FindFirstChildInHierarchy(moveRightJoystickUpDown, "Reset").GetComponent <Button>().onClick.AddListener(ResetCalibration); rightJoystickUpDownInvert = SceneHelper.FindFirstChildInHierarchy(moveRightJoystickUpDown, "InvertToggle").GetComponent <Toggle>(); rightJoystickUpDownInvert.onValueChanged.AddListener(ToggleInvert); gamepadToggle.onValueChanged.AddListener(ToggleGamepad); SceneHelper.FindFirstChildInHierarchy(moveRightJoystickUpDown, "Finish").GetComponent <Button>().onClick.AddListener(CalibratePitchFinish); trimVerticalLeftSlider = SceneHelper.FindFirstChildInHierarchy(this, "TrimVerticalLeftSlider").GetComponent <ControlSlider>(); scaleVerticalLeftSlider = SceneHelper.FindFirstChildInHierarchy(this, "ScaleVerticalLeftSlider").GetComponent <ControlSlider>(); trimHorizontalLeftSlider = SceneHelper.FindFirstChildInHierarchy(this, "TrimHorizontalLeftSlider").GetComponent <ControlSlider>(); scaleHorizontalLeftSlider = SceneHelper.FindFirstChildInHierarchy(this, "ScaleHorizontalLeftSlider").GetComponent <ControlSlider>(); deadzoneHorizontalLeftSlider = SceneHelper.FindFirstChildInHierarchy(this, "DeadzoneHorizontalLeftSlider").GetComponent <ControlSlider>(); deadzoneVerticalLeftSlider = SceneHelper.FindFirstChildInHierarchy(this, "DeadzoneVerticalLeftSlider").GetComponent <ControlSlider>(); trimVerticalRightSlider = SceneHelper.FindFirstChildInHierarchy(this, "TrimVerticalRightSlider").GetComponent <ControlSlider>(); scaleVerticalRightSlider = SceneHelper.FindFirstChildInHierarchy(this, "ScaleVerticalRightSlider").GetComponent <ControlSlider>(); trimHorizontalRightSlider = SceneHelper.FindFirstChildInHierarchy(this, "TrimHorizontalRightSlider").GetComponent <ControlSlider>(); scaleHorizontalRightSlider = SceneHelper.FindFirstChildInHierarchy(this, "ScaleHorizontalRightSlider").GetComponent <ControlSlider>(); deadzoneHorizontalRightSlider = SceneHelper.FindFirstChildInHierarchy(this, "DeadzoneHorizontalRightSlider").GetComponent <ControlSlider>(); deadzoneVerticalRightSlider = SceneHelper.FindFirstChildInHierarchy(this, "DeadzoneVerticalRightSlider").GetComponent <ControlSlider>(); }