コード例 #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);
    }
コード例 #2
0
 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);
 }
コード例 #3
0
 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);
 }