Пример #1
0
    void Flat()
    {
        diffFlat  = Mathf.Abs(x - sFlat);
        realSpeed = Mathf.Min(diffFlat, maxSpeedFlat * Time.deltaTime);
        realSpeed = realSpeed * ((x >= sFlat) ? (1) : (-1));
        sFlat    += realSpeed;

        flatGaugeScript.SetPosition(sFlat);
    }
 void AccelUI()
 {
     vt.text = "v: " + Mathf.Round(v);
     at.text = "a: " + Mathf.Round(accel);
     dt.text = "d: " + Mathf.Round(drag);
     vSliderScript.SetPosition((v / maxV) * 400);
     aSliderScript.SetPosition((accel / maxA) * 400);
     dSliderScript.SetPosition((drag / maxD) * 400);
 }
 void SteeringUI()
 {
     st.text  = "s: " + Mathf.Round(steering);
     ust.text = "u: " + Mathf.Round(understeering);
     understeeringSliderScript.SetPosition(-(understeering * (200 / maxSteeringAngle)));
     understeeringMagnitudeSliderScript.SetPosition((1 - understeerFrac) * 400);
     eulers = new Vector3(0f, 0f, steering);
     steeringArrow.transform.localEulerAngles = eulers;
     eulers = new Vector3(0f, 0f, understeering);
     understeeringArrow.transform.localEulerAngles = eulers;
 }
Пример #4
0
    void Smooth()
    {
        diffSmooth = Mathf.Abs(x - sSmooth);
        newS       = Mathf.Lerp(sSmooth, x, easeStrength);
        newS      -= sSmooth;
        if (Mathf.Abs(newS) >= 0.1f && Mathf.Abs(newS) <= minSpeedSmooth)
        {
            newS = ((newS > 0) ? (minSpeedSmooth) : (-minSpeedSmooth));
        }
        newS *= Time.deltaTime * smoothCoef;
        if (Mathf.Abs(newS) >= Mathf.Abs(diffSmooth))
        {
            sSmooth = x;
        }
        else
        {
            sSmooth += newS;
        }

        smoothGaugeScript.SetPosition(sSmooth);
    }
Пример #5
0
 void Raw()
 {
     rawGaugeScript.SetPosition(x * 200);
 }
Пример #6
0
 void NonLinear()
 {
     nonLinearGaugeScript.SetPosition(GetNonLinearX(x) * 200);
 }
Пример #7
0
 void Update()
 {
     b  = Input.GetAxis("Brake1");
     b *= 400;
     brakeGaugeScript.SetPosition(b);
 }
Пример #8
0
 void Update()
 {
     x  = Input.GetAxis("Gas1");
     x *= 400;
     gasGaugeScript.SetPosition(x);
 }