void FixedUpdate()
        {
            // Get constant inputs
            if (!string.IsNullOrEmpty(accelAxis))
            {
                vp.SetAccel(Input.GetAxis(accelAxis));
            }

            if (!string.IsNullOrEmpty(brakeAxis))
            {
                vp.SetBrake(Input.GetAxis(brakeAxis));
            }

            if (!string.IsNullOrEmpty(steerAxis))
            {
                vp.SetSteer(Input.GetAxis(steerAxis));
            }

            if (!string.IsNullOrEmpty(ebrakeAxis))
            {
                vp.SetEbrake(Input.GetAxis(ebrakeAxis));
            }

            if (!string.IsNullOrEmpty(boostButton))
            {
                vp.SetBoost(Input.GetButton(boostButton));
            }

            if (!string.IsNullOrEmpty(pitchAxis))
            {
                vp.SetPitch(Input.GetAxis(pitchAxis));
            }

            if (!string.IsNullOrEmpty(yawAxis))
            {
                vp.SetYaw(Input.GetAxis(yawAxis));
            }

            if (!string.IsNullOrEmpty(rollAxis))
            {
                vp.SetRoll(Input.GetAxis(rollAxis));
            }

            if (!string.IsNullOrEmpty(upshiftButton))
            {
                vp.SetUpshift(Input.GetAxis(upshiftButton));
            }

            if (!string.IsNullOrEmpty(downshiftButton))
            {
                vp.SetDownshift(Input.GetAxis(downshiftButton));
            }
        }
示例#2
0
        void FixedUpdate()
        {
            if (setter)
            {
                accelerationDelta = Input.acceleration - accelerationPrev;
                accelerationPrev  = Input.acceleration;
                vp.SetAccel(setter.accel);
                vp.SetBrake(setter.brake);
                vp.SetEbrake(setter.ebrake);
                vp.SetBoost(setter.boost);

                if (useAccelerometer)
                {
                    vp.SetSteer((Input.acceleration.x + accelerationDelta.x * deltaFactor) * steerFactor);
                    vp.SetYaw(Input.acceleration.x * flipFactor);
                    vp.SetPitch(-Input.acceleration.z * flipFactor);
                }
                else
                {
                    vp.SetSteer(setter.steer);
                }
            }
        }