예제 #1
0
    /// <summary>
    /// Overrides the behavior.
    /// </summary>
    public void SetBehavior(RCC_CarControllerV3 carController)
    {
        if (RCC_Settings.Instance.selectedBehaviorType == null)
        {
            return;
        }

        RCC_Settings.BehaviorType currentBehaviorType = RCC_Settings.Instance.selectedBehaviorType;

        carController.steeringHelper = currentBehaviorType.steeringHelper;
        carController.tractionHelper = currentBehaviorType.tractionHelper;
        carController.ABS            = currentBehaviorType.ABS;
        carController.ESP            = currentBehaviorType.ESP;
        carController.TCS            = currentBehaviorType.TCS;

        carController.highspeedsteerAngle        = Mathf.Clamp(carController.highspeedsteerAngle, currentBehaviorType.highSpeedSteerAngleMinimum, currentBehaviorType.highSpeedSteerAngleMaximum);
        carController.highspeedsteerAngleAtspeed = Mathf.Clamp(carController.highspeedsteerAngleAtspeed, currentBehaviorType.highSpeedSteerAngleAtspeedMinimum, currentBehaviorType.highSpeedSteerAngleAtspeedMaximum);

        carController.steerHelperAngularVelStrength = Mathf.Clamp(carController.steerHelperAngularVelStrength, currentBehaviorType.steerHelperAngularVelStrengthMinimum, currentBehaviorType.steerHelperAngularVelStrengthMaximum);
        carController.steerHelperLinearVelStrength  = Mathf.Clamp(carController.steerHelperLinearVelStrength, currentBehaviorType.steerHelperLinearVelStrengthMinimum, currentBehaviorType.steerHelperLinearVelStrengthMaximum);

        carController.tractionHelperStrength  = Mathf.Clamp(carController.tractionHelperStrength, currentBehaviorType.tractionHelperStrengthMinimum, currentBehaviorType.tractionHelperStrengthMaximum);
        carController.antiRollFrontHorizontal = Mathf.Clamp(carController.antiRollFrontHorizontal, currentBehaviorType.antiRollFrontHorizontalMinimum, Mathf.Infinity);
        carController.antiRollRearHorizontal  = Mathf.Clamp(carController.antiRollRearHorizontal, currentBehaviorType.antiRollRearHorizontalMinimum, Mathf.Infinity);

        carController.gearShiftingDelay = Mathf.Clamp(carController.gearShiftingDelay, 0f, currentBehaviorType.gearShiftingDelayMaximum);
        carController.rigid.angularDrag = Mathf.Clamp(carController.rigid.angularDrag, currentBehaviorType.angularDrag, 1f);
    }
예제 #2
0
    // Use this for initialization
    void Awake()
    {
        int type = 0;

        if (useless == Useless.Behavior)
        {
            RCC_Settings.BehaviorType behavior = RCC_Settings.Instance.behaviorType;

            switch (behavior)
            {
            case (RCC_Settings.BehaviorType.Simulator):
                type = 0;
                break;

            case (RCC_Settings.BehaviorType.Racing):
                type = 1;
                break;

            case (RCC_Settings.BehaviorType.SemiArcade):
                type = 2;
                break;

            case (RCC_Settings.BehaviorType.Drift):
                type = 3;
                break;

            case (RCC_Settings.BehaviorType.Fun):
                type = 4;
                break;

            case (RCC_Settings.BehaviorType.Custom):
                type = 5;
                break;
            }
        }
        else
        {
            if (!RCC_Settings.Instance.useAccelerometerForSteering && !RCC_Settings.Instance.useSteeringWheelForSteering)
            {
                type = 0;
            }
            if (RCC_Settings.Instance.useAccelerometerForSteering)
            {
                type = 1;
            }
            if (RCC_Settings.Instance.useSteeringWheelForSteering)
            {
                type = 2;
            }
        }

        GetComponent <Dropdown>().value = type;
        GetComponent <Dropdown>().RefreshShownValue();
    }
    void CheckBehavior()
    {
        // Getting friction curves.
        forwardFrictionCurve  = wheelCollider.forwardFriction;
        sidewaysFrictionCurve = wheelCollider.sidewaysFriction;

        RCC_Settings.BehaviorType behavior = RCCSettings.selectedBehaviorType;

        if (behavior != null)
        {
            forwardFrictionCurve  = SetFrictionCurves(forwardFrictionCurve, behavior.forwardExtremumSlip, behavior.forwardExtremumValue, behavior.forwardAsymptoteSlip, behavior.forwardAsymptoteValue);
            sidewaysFrictionCurve = SetFrictionCurves(sidewaysFrictionCurve, behavior.sidewaysExtremumSlip, behavior.sidewaysExtremumValue, behavior.sidewaysAsymptoteSlip, behavior.sidewaysAsymptoteValue);
        }

        // Assigning new frictons if one of the behavior preset selected above.
        wheelCollider.forwardFriction  = forwardFrictionCurve;
        wheelCollider.sidewaysFriction = sidewaysFrictionCurve;
    }
예제 #4
0
	private void CheckBehavior(){

		// Getting friction curves.
		forwardFrictionCurve = wheelCollider.forwardFriction;
		sidewaysFrictionCurve = wheelCollider.sidewaysFriction;

		//	Getting behavior if selected.
		RCC_Settings.BehaviorType behavior = RCCSettings.selectedBehaviorType;

		//	If there is a selected behavior, override friction curves.
		if (behavior != null) {

			forwardFrictionCurve = SetFrictionCurves (forwardFrictionCurve, behavior.forwardExtremumSlip, behavior.forwardExtremumValue, behavior.forwardAsymptoteSlip, behavior.forwardAsymptoteValue);
			sidewaysFrictionCurve = SetFrictionCurves (sidewaysFrictionCurve, behavior.sidewaysExtremumSlip, behavior.sidewaysExtremumValue, behavior.sidewaysAsymptoteSlip, behavior.sidewaysAsymptoteValue);

		}
			
		// Assigning new frictons.
		wheelCollider.forwardFriction = forwardFrictionCurve;
		wheelCollider.sidewaysFriction = sidewaysFrictionCurve;

	}
예제 #5
0
    // Use this for initialization
    void Awake()
    {
        int type = 0;

        if (useless == Useless.Behavior)
        {
            RCC_Settings.BehaviorType behavior = RCC_Settings.Instance.behaviorType;

            switch (behavior)
            {
            case (RCC_Settings.BehaviorType.Simulator):
                type = 0;
                break;

            case (RCC_Settings.BehaviorType.Racing):
                type = 1;
                break;

            case (RCC_Settings.BehaviorType.SemiArcade):
                type = 2;
                break;

            case (RCC_Settings.BehaviorType.Drift):
                type = 3;
                break;

            case (RCC_Settings.BehaviorType.Fun):
                type = 4;
                break;

            case (RCC_Settings.BehaviorType.Custom):
                type = 5;
                break;
            }
        }
        if (useless == Useless.Controller)
        {
            switch (RCC_Settings.Instance.mobileController)
            {
            case RCC_Settings.MobileController.TouchScreen:

                type = 0;

                break;

            case RCC_Settings.MobileController.Gyro:

                type = 1;

                break;

            case RCC_Settings.MobileController.SteeringWheel:

                type = 2;

                break;

            case RCC_Settings.MobileController.Joystick:

                type = 3;

                break;
            }
        }
        if (useless == Useless.Graphics)
        {
            type = QualitySettings.GetQualityLevel();
        }

        GetComponent <Dropdown>().value = type;
        GetComponent <Dropdown>().RefreshShownValue();
    }