Пример #1
0
    void Update()
    {
        if (RCCSettings.useLightProjectorForLightingEffect)
        {
            Projectors();
        }

        if (trailRenderer)
        {
            TrailRenderers();
        }

        switch (lightType)
        {
        case LightType.HeadLight:
            if (!carController.lowBeamHeadLightsOn && !carController.highBeamHeadLightsOn)
            {
                Lighting(0f);
            }
            if (carController.lowBeamHeadLightsOn && !carController.highBeamHeadLightsOn)
            {
                Lighting(.6f, 50f, 90f);
                transform.localEulerAngles = new Vector3(10f, 0f, 0f);
            }
            else if (carController.highBeamHeadLightsOn)
            {
                Lighting(1f, 200f, 45f);
                transform.localEulerAngles = new Vector3(0f, 0f, 0f);
            }
            break;

        case LightType.BrakeLight:
            Lighting((!carController.lowBeamHeadLightsOn ? (carController._brakeInput >= .1f ? 1f : 0f)  : (carController._brakeInput >= .1f ? 1f : .3f)));
            break;

        case LightType.ReverseLight:
            Lighting(carController.direction == -1 ? 1f : 0f);
            break;

        case LightType.Indicator:
            indicatorsOn = carController.indicatorsOn;
            Indicators();
            break;
        }
    }
Пример #2
0
        public PlayerInput(float _gasInput, float _brakeInput, float _steerInput, float _handbrakeInput, float _clutchInput, float _boostInput, float _idleInput, float _fuelInput, int _direction, bool _canGoReverse, int _currentGear, bool _changingGear, RCC_CarControllerV3.IndicatorsOn _indicatorsOn, bool _lowBeamHeadLightsOn, bool _highBeamHeadLightsOn)
        {
            gasInput       = _gasInput;
            brakeInput     = _brakeInput;
            steerInput     = _steerInput;
            handbrakeInput = _handbrakeInput;
            clutchInput    = _clutchInput;
            boostInput     = _boostInput;
            idleInput      = _idleInput;
            fuelInput      = _fuelInput;
            direction      = _direction;
            canGoReverse   = _canGoReverse;
            currentGear    = _currentGear;
            changingGear   = _changingGear;

            indicatorsOn         = _indicatorsOn;
            lowBeamHeadLightsOn  = _lowBeamHeadLightsOn;
            highBeamHeadLightsOn = _highBeamHeadLightsOn;
        }
Пример #3
0
    void Update()
    {
        if (RCC_Settings.Instance.useLightProjectorForLightingEffect)
        {
            Projectors();
        }

        switch (lightType)
        {
        case LightType.HeadLight:
            if (!carController.lowBeamHeadLightsOn && !carController.highBeamHeadLightsOn)
            {
                Lighting(0f);
            }
            if (carController.lowBeamHeadLightsOn && !carController.highBeamHeadLightsOn)
            {
                Lighting(.6f, 50f, 90f);
                transform.localEulerAngles = new Vector3(10f, 0f, 0f);
            }
            else if (carController.highBeamHeadLightsOn)
            {
                Lighting(1f, 200f, 45f);
                transform.localEulerAngles = new Vector3(0f, 0f, 0f);
            }
            break;

        case LightType.BrakeLight:
            Lighting((!carController.lowBeamHeadLightsOn ? Mathf.Clamp01(carController._brakeInput * 10f)  : Mathf.Clamp(carController._brakeInput * 10f, .3f, 1f)));
            break;

        case LightType.ReverseLight:
            Lighting(carController.direction == -1 ? 1f : 0f);
            break;

        case LightType.Indicator:
            indicatorsOn = carController.indicatorsOn;
            Indicators();
            break;
        }
    }
Пример #4
0
    void Update()
    {
        if (RCCSettings.useLightProjectorForLightingEffect)
        {
            Projectors();
        }

        if (lensFlare)
        {
            LensFlare();
        }

        switch (lightType)
        {
        case LightType.HeadLight:
            if (highBeamLightFound)
            {
                Lighting(carController.lowBeamHeadLightsOn ? .5f : 0f, 50f, 90f);
            }
            else
            {
                Lighting(carController.lowBeamHeadLightsOn ? .5f : 0f, 50f, 90f);

                if (!carController.lowBeamHeadLightsOn && !carController.highBeamHeadLightsOn)
                {
                    Lighting(0f);
                }
                if (carController.lowBeamHeadLightsOn && !carController.highBeamHeadLightsOn)
                {
                    Lighting(.5f, 50f, 90f);
                    transform.localEulerAngles = new Vector3(10f, 0f, 0f);
                }
                else if (carController.highBeamHeadLightsOn)
                {
                    Lighting(.5f, 100f, 45f);
                    transform.localEulerAngles = new Vector3(0f, 0f, 0f);
                }
            }
            break;

        case LightType.BrakeLight:
            if (parkLightFound)
            {
                Lighting(carController._brakeInput >= .1f ? 1f : 0f);
            }
            else
            {
                Lighting(carController._brakeInput >= .1f ? 1f : !carController.lowBeamHeadLightsOn ? 0f : .25f);
            }
            break;

        case LightType.ReverseLight:
            Lighting(carController.direction == -1 ? 1f : 0f);
            break;

        case LightType.ParkLight:
            Lighting((!carController.lowBeamHeadLightsOn ? 0f : .5f));
            break;

        case LightType.Indicator:
            indicatorsOn = carController.indicatorsOn;
            Indicators();
            break;

        case LightType.HighBeamHeadLight:
            Lighting(carController.highBeamHeadLightsOn ? 1f : 0f, 200f, 45f);
            break;
        }
    }
Пример #5
0
    public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    {
        if (!carController)
        {
            return;
        }

        // Sending all inputs, position, rotation, and velocity to the server.
        if (stream.IsWriting)
        {
            //We own this player: send the others our data
            stream.SendNext(carController.gasInput);
            stream.SendNext(carController.brakeInput);
            stream.SendNext(carController.steerInput);
            stream.SendNext(carController.handbrakeInput);
            stream.SendNext(carController.boostInput);
            stream.SendNext(carController.clutchInput);
            stream.SendNext(carController.idleInput);
            stream.SendNext(carController.currentGear);
            stream.SendNext(carController.direction);
            stream.SendNext(carController.changingGear);
            stream.SendNext(carController.semiAutomaticGear);
            //stream.SendNext(carController.fuelInput);
            stream.SendNext(carController.engineRunning);
            stream.SendNext(carController.lowBeamHeadLightsOn);
            stream.SendNext(carController.highBeamHeadLightsOn);
            stream.SendNext(carController.indicatorsOn);
            //Customizations
            stream.SendNext(carController.FrontLeftWheelCollider.wheelCollider.suspensionDistance);
            stream.SendNext(carController.FrontRightWheelCollider.wheelCollider.suspensionDistance);
            stream.SendNext(carController.RearLeftWheelCollider.wheelCollider.suspensionDistance);
            stream.SendNext(carController.RearRightWheelCollider.wheelCollider.suspensionDistance);

            for (int i = 0; i < wheelColliders.Length; i++)
            {
                stream.SendNext(wheelColliders[i].camber);
            }

            stream.SendNext(carController.applyEngineTorqueToExtraRearWheelColliders);
            stream.SendNext(carController._wheelTypeChoise);
            stream.SendNext(carController.biasedWheelTorque);
            stream.SendNext(carController.canGoReverseNow);
            stream.SendNext(carController.engineTorque);
            stream.SendNext(carController.brakeTorque);
            stream.SendNext(carController.minEngineRPM);
            stream.SendNext(carController.maxEngineRPM);
            stream.SendNext(carController.engineInertia);
            stream.SendNext(carController.useRevLimiter);
            stream.SendNext(carController.useExhaustFlame);
            //stream.SendNext(carController.useClutchMarginAtFirstGear);
            stream.SendNext(carController.highspeedsteerAngle);
            stream.SendNext(carController.highspeedsteerAngleAtspeed);
            stream.SendNext(carController.antiRollFrontHorizontal);
            stream.SendNext(carController.antiRollRearHorizontal);
            stream.SendNext(carController.antiRollVertical);
            stream.SendNext(carController.maxspeed);
            //stream.SendNext(carController.engineHeat);
            //stream.SendNext(carController.engineHeatRate);
            stream.SendNext(carController.totalGears);
            stream.SendNext(carController.gearShiftingDelay);
            //stream.SendNext(carController.gearShiftingThreshold);
            //stream.SendNext(carController.clutchInertia);
            ///stream.SendNext(carController.NGear);
            stream.SendNext(carController.launched);
            stream.SendNext(carController.ABS);
            stream.SendNext(carController.ABSThreshold);
            stream.SendNext(carController.TCS);
            stream.SendNext(carController.TCSThreshold);
            stream.SendNext(carController.ESP);
            stream.SendNext(carController.ESPThreshold);
            stream.SendNext(carController.steeringHelper);
            stream.SendNext(carController.steerHelperLinearVelStrength);
            stream.SendNext(carController.steerHelperAngularVelStrength);
            stream.SendNext(carController.tractionHelper);
            stream.SendNext(carController.tractionHelperStrength);
            stream.SendNext(carController.applyCounterSteering);
            stream.SendNext(carController.useNOS);
            stream.SendNext(carController.useTurbo);

            stream.SendNext(transform.position);
            stream.SendNext(transform.rotation);
            stream.SendNext(rigid.velocity);
        }
        else
        {
            // Network player, receiving all inputs, position, rotation, and velocity from server.
            gasInput          = (float)stream.ReceiveNext();
            brakeInput        = (float)stream.ReceiveNext();
            steerInput        = (float)stream.ReceiveNext();
            handbrakeInput    = (float)stream.ReceiveNext();
            boostInput        = (float)stream.ReceiveNext();
            clutchInput       = (float)stream.ReceiveNext();
            idleInput         = (float)stream.ReceiveNext();
            gear              = (int)stream.ReceiveNext();
            direction         = (int)stream.ReceiveNext();
            changingGear      = (bool)stream.ReceiveNext();
            semiAutomaticGear = (bool)stream.ReceiveNext();

            //fuelInput = (float)stream.ReceiveNext();
            engineRunning        = (bool)stream.ReceiveNext();
            lowBeamHeadLightsOn  = (bool)stream.ReceiveNext();
            highBeamHeadLightsOn = (bool)stream.ReceiveNext();
            indicatorsOn         = (RCC_CarControllerV3.IndicatorsOn)stream.ReceiveNext();

            ///Customizations
            frontleftwheelSusp   = (float)stream.ReceiveNext();
            RearleftwheelSusp    = (float)stream.ReceiveNext();
            frontRighttwheelSusp = (float)stream.ReceiveNext();
            RearRightwheelSusp   = (float)stream.ReceiveNext();

            for (int i = 0; i < wheelColliders.Length; i++)
            {
                cambers[i] = (float)stream.ReceiveNext();
            }

            applyEngineTorqueToExtraRearWheelColliders = (bool)stream.ReceiveNext();
            _wheelTypeChoise  = (RCC_CarControllerV3.WheelType)stream.ReceiveNext();
            biasedWheelTorque = (float)stream.ReceiveNext();
            canGoReverseNow   = (bool)stream.ReceiveNext();
            engineTorque      = (float)stream.ReceiveNext();
            brakeTorque       = (float)stream.ReceiveNext();
            minEngineRPM      = (float)stream.ReceiveNext();
            maxEngineRPM      = (float)stream.ReceiveNext();
            engineInertia     = (float)stream.ReceiveNext();
            useRevLimiter     = (bool)stream.ReceiveNext();
            useExhaustFlame   = (bool)stream.ReceiveNext();
            //useClutchMarginAtFirstGear = (bool)stream.ReceiveNext();
            highspeedsteerAngle        = (float)stream.ReceiveNext();
            highspeedsteerAngleAtspeed = (float)stream.ReceiveNext();
            antiRollFrontHorizontal    = (float)stream.ReceiveNext();
            antiRollRearHorizontal     = (float)stream.ReceiveNext();
            antiRollVertical           = (float)stream.ReceiveNext();
            maxspeed = (float)stream.ReceiveNext();
            //engineHeat = (float)stream.ReceiveNext();
            //engineHeatMultiplier = (float)stream.ReceiveNext();
            totalGears        = (int)stream.ReceiveNext();
            gearShiftingDelay = (float)stream.ReceiveNext();
            //gearShiftingThreshold = (float)stream.ReceiveNext();
            //clutchInertia = (float)stream.ReceiveNext();
            //NGear = (bool)stream.ReceiveNext();
            launched       = (float)stream.ReceiveNext();
            ABS            = (bool)stream.ReceiveNext();
            ABSThreshold   = (float)stream.ReceiveNext();
            TCS            = (bool)stream.ReceiveNext();
            TCSThreshold   = (float)stream.ReceiveNext();
            ESP            = (bool)stream.ReceiveNext();
            ESPThreshold   = (float)stream.ReceiveNext();
            steeringHelper = (bool)stream.ReceiveNext();
            steerHelperLinearVelStrength  = (float)stream.ReceiveNext();
            steerHelperAngularVelStrength = (float)stream.ReceiveNext();
            tractionHelper         = (bool)stream.ReceiveNext();
            tractionHelperStrength = (float)stream.ReceiveNext();
            applyCounterSteering   = (bool)stream.ReceiveNext();
            useNOS   = (bool)stream.ReceiveNext();
            useTurbo = (bool)stream.ReceiveNext();

            correctPlayerPos = (Vector3)stream.ReceiveNext();
            correctPlayerRot = (Quaternion)stream.ReceiveNext();
            currentVelocity  = (Vector3)stream.ReceiveNext();

            updateTime = Time.time;
        }
    }
Пример #6
0
    void GetValues()
    {
        correctPlayerPos = transform.position;
        correctPlayerRot = transform.rotation;

        gasInput          = carController.gasInput;
        brakeInput        = carController.brakeInput;
        steerInput        = carController.steerInput;
        handbrakeInput    = carController.handbrakeInput;
        boostInput        = carController.boostInput;
        clutchInput       = carController.clutchInput;
        idleInput         = carController.idleInput;
        gear              = carController.currentGear;
        direction         = carController.direction;
        changingGear      = carController.changingGear;
        semiAutomaticGear = carController.semiAutomaticGear;

        //fuelInput = carController.fuelInput;
        engineRunning        = carController.engineRunning;
        lowBeamHeadLightsOn  = carController.lowBeamHeadLightsOn;
        highBeamHeadLightsOn = carController.highBeamHeadLightsOn;
        indicatorsOn         = carController.indicatorsOn;

        // Customization state
        frontleftwheelSusp   = carController.FrontLeftWheelCollider.wheelCollider.suspensionDistance;
        frontRighttwheelSusp = carController.FrontRightWheelCollider.wheelCollider.suspensionDistance;
        RearleftwheelSusp    = carController.RearLeftWheelCollider.wheelCollider.suspensionDistance;
        RearRightwheelSusp   = carController.RearRightWheelCollider.wheelCollider.suspensionDistance;

        for (int i = 0; i < wheelColliders.Length; i++)
        {
            cambers[i] = wheelColliders[i].camber;
        }

        applyEngineTorqueToExtraRearWheelColliders = carController.applyEngineTorqueToExtraRearWheelColliders;
        _wheelTypeChoise  = carController._wheelTypeChoise;
        biasedWheelTorque = carController.biasedWheelTorque;
        canGoReverseNow   = carController.canGoReverseNow;
        engineTorque      = carController.engineTorque;
        brakeTorque       = carController.brakeTorque;
        minEngineRPM      = carController.minEngineRPM;
        maxEngineRPM      = carController.maxEngineRPM;
        engineInertia     = carController.engineInertia;
        useRevLimiter     = carController.useRevLimiter;
        useExhaustFlame   = carController.useExhaustFlame;
        //useClutchMarginAtFirstGear = carController.useClutchMarginAtFirstGear;
        highspeedsteerAngle        = carController.highspeedsteerAngle;
        highspeedsteerAngleAtspeed = carController.highspeedsteerAngleAtspeed;
        antiRollFrontHorizontal    = carController.antiRollFrontHorizontal;
        antiRollRearHorizontal     = carController.antiRollRearHorizontal;
        antiRollVertical           = carController.antiRollVertical;
        maxspeed = carController.maxspeed;
        //engineHeat = carController.engineHeat;
        //engineHeatMultiplier = carController.engineHeatRate;
        totalGears        = carController.totalGears;
        gearShiftingDelay = carController.gearShiftingDelay;
        //gearShiftingThreshold = carController.gearShiftingThreshold;
        //clutchInertia = carController.clutchInertia;
        //NGear = carController.NGear;
        launched       = carController.launched;
        ABS            = carController.ABS;
        TCS            = carController.TCS;
        ESP            = carController.ESP;
        TCSThreshold   = carController.TCSThreshold;
        ESPThreshold   = carController.ESPThreshold;
        ABSThreshold   = carController.ABSThreshold;
        steeringHelper = carController.steeringHelper;
        steerHelperLinearVelStrength  = carController.steerHelperLinearVelStrength;
        steerHelperAngularVelStrength = carController.steerHelperAngularVelStrength;
        tractionHelper         = carController.tractionHelper;
        tractionHelperStrength = carController.tractionHelperStrength;
        applyCounterSteering   = carController.applyCounterSteering;
        useNOS   = carController.useNOS;
        useTurbo = carController.useTurbo;
    }
    void GetValues()
    {
        /*
         *      if(!currentCarController)
         *              return;
         *
         *      if(!currentCarController.canControl || currentCarController.AIController  )
         * {
         *              return;
         *      }
         */

        if (NOSGauge)
        {
            if (currentCarController.useNOS)
            {
                if (!NOSGauge.activeSelf)
                {
                    NOSGauge.SetActive(true);
                }
            }
            else
            {
                if (NOSGauge.activeSelf)
                {
                    NOSGauge.SetActive(false);
                }
            }
        }

        if (turboGauge)
        {
            if (currentCarController.useTurbo)
            {
                if (!turboGauge.activeSelf)
                {
                    turboGauge.SetActive(true);
                }
            }
            else
            {
                if (turboGauge.activeSelf)
                {
                    turboGauge.SetActive(false);
                }
            }
        }

        RPM       = currentCarController.engineRPM;
        KMH       = currentCarController.speed;
        direction = currentCarController.direction;
        Gear      = currentCarController.currentGear;

        NGear = currentCarController.changingGear;

        ABS        = currentCarController.ABSAct;
        ESP        = currentCarController.ESPAct;
        Park       = currentCarController.handbrakeInput > .1f ? true : false;
        Headlights = currentCarController.lowBeamHeadLightsOn || currentCarController.highBeamHeadLightsOn;
        indicators = currentCarController.indicatorsOn;

        if (RPMNeedle)
        {
            RPMNeedleRotation = (currentCarController.engineRPM / 50f);
            RPMNeedle.transform.eulerAngles = new Vector3(RPMNeedle.transform.eulerAngles.x, RPMNeedle.transform.eulerAngles.y, -RPMNeedleRotation);
        }
        if (KMHNeedle)
        {
            if (RCC_Settings.Instance.units == RCC_Settings.Units.KMH)
            {
                KMHNeedleRotation = (currentCarController.speed);
            }
            else
            {
                KMHNeedleRotation = (currentCarController.speed * 0.62f);
            }
            KMHNeedle.transform.eulerAngles = new Vector3(KMHNeedle.transform.eulerAngles.x, KMHNeedle.transform.eulerAngles.y, -KMHNeedleRotation);
        }
        if (BoostNeedle)
        {
            BoostNeedleRotation = (currentCarController.turboBoost / 30f) * 270f;
            BoostNeedle.transform.eulerAngles = new Vector3(BoostNeedle.transform.eulerAngles.x, BoostNeedle.transform.eulerAngles.y, -BoostNeedleRotation);
        }
        if (NoSNeedle)
        {
            NoSNeedleRotation = (currentCarController.NoS / 100f) * 270f;
            NoSNeedle.transform.eulerAngles = new Vector3(NoSNeedle.transform.eulerAngles.x, NoSNeedle.transform.eulerAngles.y, -NoSNeedleRotation);
        }

        //calculates the acceleration by dividing the change in speed by change in time
        acceleration_x = Car_rb.velocity.x;
        // lastVelocity = Car_rb.velocity.x;
        double acc_x = System.Math.Round(acceleration_x, 3);

        Accilera_x.text = acc_x.ToString();

        //acceleration_z = (Car_rb.velocity.z - lastVelocity) / Time.timeScale;
        acceleration_z = Car_rb.velocity.y;
        double acc_z = System.Math.Round(acceleration_z, 3);

        //lastVelocity = Car_rb.velocity.z;
        Accilera_z.text = acc_z.ToString();

        dis       = Vector3.Distance(Car_1.transform.position, Car_2.transform.position) - 5.3f;
        dist      = System.Math.Round(dis, 2);
        Dist.text = "Distance: " + dist.ToString();
    }
    void GetValues()
    {
        if (!RCC_SceneManager.Instance.activePlayerVehicle)
        {
            return;
        }

        if (!RCC_SceneManager.Instance.activePlayerVehicle.canControl || RCC_SceneManager.Instance.activePlayerVehicle.externalController)
        {
            return;
        }

        if (NOSGauge)
        {
            if (RCC_SceneManager.Instance.activePlayerVehicle.useNOS)
            {
                if (!NOSGauge.activeSelf)
                {
                    NOSGauge.SetActive(true);
                }
            }
            else
            {
                if (NOSGauge.activeSelf)
                {
                    NOSGauge.SetActive(false);
                }
            }
        }

        if (turboGauge)
        {
            if (RCC_SceneManager.Instance.activePlayerVehicle.useTurbo)
            {
                if (!turboGauge.activeSelf)
                {
                    turboGauge.SetActive(true);
                }
            }
            else
            {
                if (turboGauge.activeSelf)
                {
                    turboGauge.SetActive(false);
                }
            }
        }

        if (heatGauge)
        {
            if (RCC_SceneManager.Instance.activePlayerVehicle.useEngineHeat)
            {
                if (!heatGauge.activeSelf)
                {
                    heatGauge.SetActive(true);
                }
            }
            else
            {
                if (heatGauge.activeSelf)
                {
                    heatGauge.SetActive(false);
                }
            }
        }

        if (fuelGauge)
        {
            if (RCC_SceneManager.Instance.activePlayerVehicle.useFuelConsumption)
            {
                if (!fuelGauge.activeSelf)
                {
                    fuelGauge.SetActive(true);
                }
            }
            else
            {
                if (fuelGauge.activeSelf)
                {
                    fuelGauge.SetActive(false);
                }
            }
        }

        RPM          = RCC_SceneManager.Instance.activePlayerVehicle.engineRPM;
        KMH          = RCC_SceneManager.Instance.activePlayerVehicle.speed;
        direction    = RCC_SceneManager.Instance.activePlayerVehicle.direction;
        Gear         = RCC_SceneManager.Instance.activePlayerVehicle.currentGear;
        changingGear = RCC_SceneManager.Instance.activePlayerVehicle.changingGear;
        NGear        = RCC_SceneManager.Instance.activePlayerVehicle.NGear;

        ABS        = RCC_SceneManager.Instance.activePlayerVehicle.ABSAct;
        ESP        = RCC_SceneManager.Instance.activePlayerVehicle.ESPAct;
        Park       = RCC_SceneManager.Instance.activePlayerVehicle.handbrakeInput > .1f ? true : false;
        Headlights = RCC_SceneManager.Instance.activePlayerVehicle.lowBeamHeadLightsOn || RCC_SceneManager.Instance.activePlayerVehicle.highBeamHeadLightsOn;
        indicators = RCC_SceneManager.Instance.activePlayerVehicle.indicatorsOn;

        if (RPMNeedle)
        {
            RPMNeedleRotation = (RCC_SceneManager.Instance.activePlayerVehicle.engineRPM / 50f);
            RPMNeedle.transform.eulerAngles = new Vector3(RPMNeedle.transform.eulerAngles.x, RPMNeedle.transform.eulerAngles.y, -RPMNeedleRotation);
        }

        if (KMHNeedle)
        {
            if (RCCSettings.units == RCC_Settings.Units.KMH)
            {
                KMHNeedleRotation = (RCC_SceneManager.Instance.activePlayerVehicle.speed);
            }
            else
            {
                KMHNeedleRotation = (RCC_SceneManager.Instance.activePlayerVehicle.speed * 0.62f);
            }

            KMHNeedle.transform.eulerAngles = new Vector3(KMHNeedle.transform.eulerAngles.x, KMHNeedle.transform.eulerAngles.y, -KMHNeedleRotation);
        }

        if (turboNeedle)
        {
            BoostNeedleRotation = (RCC_SceneManager.Instance.activePlayerVehicle.turboBoost / 30f) * 270f;
            turboNeedle.transform.eulerAngles = new Vector3(turboNeedle.transform.eulerAngles.x, turboNeedle.transform.eulerAngles.y, -BoostNeedleRotation);
        }

        if (NoSNeedle)
        {
            NoSNeedleRotation = (RCC_SceneManager.Instance.activePlayerVehicle.NoS / 100f) * 270f;
            NoSNeedle.transform.eulerAngles = new Vector3(NoSNeedle.transform.eulerAngles.x, NoSNeedle.transform.eulerAngles.y, -NoSNeedleRotation);
        }

        if (heatNeedle)
        {
            heatNeedleRotation = (RCC_SceneManager.Instance.activePlayerVehicle.engineHeat / 110f) * 270f;
            heatNeedle.transform.eulerAngles = new Vector3(heatNeedle.transform.eulerAngles.x, heatNeedle.transform.eulerAngles.y, -heatNeedleRotation);
        }

        if (fuelNeedle)
        {
            fuelNeedleRotation = (RCC_SceneManager.Instance.activePlayerVehicle.fuelTank / RCC_SceneManager.Instance.activePlayerVehicle.fuelTankCapacity) * 270f;
            fuelNeedle.transform.eulerAngles = new Vector3(fuelNeedle.transform.eulerAngles.x, fuelNeedle.transform.eulerAngles.y, -fuelNeedleRotation);
        }
    }
Пример #9
0
    void GetValues()
    {
        if (!carController)
        {
            return;
        }

        if (!carController.canControl || carController.AIController)
        {
            return;
        }

        if (NOSGauge)
        {
            if (carController.useNOS)
            {
                if (!NOSGauge.activeSelf)
                {
                    NOSGauge.SetActive(true);
                }
            }
            else
            {
                if (NOSGauge.activeSelf)
                {
                    NOSGauge.SetActive(false);
                }
            }
        }

        if (turboGauge)
        {
            if (carController.useTurbo)
            {
                if (!turboGauge.activeSelf)
                {
                    turboGauge.SetActive(true);
                }
            }
            else
            {
                if (turboGauge.activeSelf)
                {
                    turboGauge.SetActive(false);
                }
            }
        }

        RPM       = carController.engineRPM;
        KMH       = carController.speed;
        direction = carController.direction;
        Gear      = carController.currentGear;

        changingGear = carController.changingGear;
        NGear        = carController.NGear;

        ABS        = carController.ABSAct;
        ESP        = carController.ESPAct;
        Park       = carController.handbrakeInput > .1f ? true : false;
        Headlights = carController.lowBeamHeadLightsOn || carController.highBeamHeadLightsOn;
        indicators = carController.indicatorsOn;

        if (RPMNeedle)
        {
            RPMNeedleRotation = (carController.engineRPM / 50f);
            RPMNeedle.transform.eulerAngles = new Vector3(RPMNeedle.transform.eulerAngles.x, RPMNeedle.transform.eulerAngles.y, -RPMNeedleRotation);
        }
        if (KMHNeedle)
        {
            if (RCCSettings.units == RCC_Settings.Units.KMH)
            {
                KMHNeedleRotation = (carController.speed);
            }
            else
            {
                KMHNeedleRotation = (carController.speed * 0.62f);
            }
            KMHNeedle.transform.eulerAngles = new Vector3(KMHNeedle.transform.eulerAngles.x, KMHNeedle.transform.eulerAngles.y, -KMHNeedleRotation);
        }
        if (BoostNeedle)
        {
            BoostNeedleRotation = (carController.turboBoost / 30f) * 270f;
            BoostNeedle.transform.eulerAngles = new Vector3(BoostNeedle.transform.eulerAngles.x, BoostNeedle.transform.eulerAngles.y, -BoostNeedleRotation);
        }
        if (NoSNeedle)
        {
            NoSNeedleRotation = (carController.NoS / 100f) * 270f;
            NoSNeedle.transform.eulerAngles = new Vector3(NoSNeedle.transform.eulerAngles.x, NoSNeedle.transform.eulerAngles.y, -NoSNeedleRotation);
        }
    }