예제 #1
0
        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();
            }
        }
        public static DroneRacerJoystickInput FindDroneRacerJoystickInput()
        {
            DroneRacerJoystickInput drji = null;

            DroneRacer dr = DroneRacer.FindDroneRacer();

            if (dr != null)
            {
                drji = dr.GetComponent <DroneRacerJoystickInput>();
            }

            return(drji);
        }
예제 #3
0
        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());
        }
        public static void UpdateSettings()
        {
            DroneRacer dr = DroneRacer.FindDroneRacer();

            if (dr != null)
            {
                DroneRacerJoystickInput drji = dr.gameObject.GetComponent <DroneRacerJoystickInput>();

                drji.rotationRate     = PlayerPrefs.GetFloat(Constants.RotationRate);
                drji.halfRotationRate = drji.rotationRate / 2;

                drji.exponentialRate = PlayerPrefs.GetInt(Constants.ExponentialRate) == 0 ? false : true;

                drji.exponentialRateFactor = PlayerPrefs.GetFloat(Constants.ExponentialRateFactor);

                drji.throttleChangeRate = PlayerPrefs.GetFloat(Constants.ThrottleChangeRate);
            }
        }
예제 #5
0
 void Awake()
 {
     input = GetComponent <DroneRacerJoystickInput>();
 }