예제 #1
0
 private void CheckCarStart()
 {
     if (LogitechGSDK.LogiButtonIsPressed(0, 10)) //start button
     {
         isCarOn = true;
     }
 }
예제 #2
0
 void Update()
 {
     if (LogitechGSDK.LogiButtonIsPressed(0, 10)) //start button
     {
         if (StartPanel.activeSelf)
         {
             StartPanel.SetActive(false);
         }
     }
 }
예제 #3
0
        private int getMarchaEngatada()
        {
            int i = 0;

            while (i <= 6)
            {
                if (LogitechGSDK.LogiButtonIsPressed(0, 11 + i))
                {
                    return(i);
                }
                i++;
            }
            return(-1);
        }
예제 #4
0
    // Update is called once per frame
    private void Update()
    {
        if (LogitechGSDK.LogiButtonIsPressed(0, 10) && !engineStarted && !engineSoundStarted) //start button
        {
            engineStart        = gameObject.AddComponent <AudioSource>();
            engineStart.clip   = startEngineClip;
            engineStart.volume = 1;
            engineStart.loop   = false;
            engineStart.Play();
            engineSoundStarted = true;
        }

        if (engineSoundStarted && !engineStart.isPlaying) //terminou de tocar
        {
            m_HighAccel.Play();
            m_HighDecel.Play();
            m_LowAccel.Play();
            m_LowDecel.Play();
            m_HighAccel.volume = 1f;
            m_LowAccel.volume  = 1f;
            m_LowDecel.volume  = 1f;
            m_HighDecel.volume = 1f;
            engineStarted      = true;
            engineSoundStarted = false;
        }

        if (engineStarted && isManual)
        {
            //setar audio manual
            float pitch = manualCarController.currentRpm / 8000; //maxRPM
            m_HighAccel.pitch = pitch;
            m_LowAccel.pitch  = pitch;
            m_LowDecel.pitch  = pitch;
            m_HighDecel.pitch = pitch;
        }
        else if (engineStarted)
        {
            //setar o audio para automatico - com speed
            float pitch = automaticCarController.currentSpeed / automaticCarController.maxSpeed;
            m_HighAccel.pitch = pitch;
            m_LowAccel.pitch  = pitch;
            m_LowDecel.pitch  = pitch;
            m_HighDecel.pitch = pitch;
        }
    }
예제 #5
0
    public void Accelerate()
    {
        if (brakeInput > 0)//is braking
        {
            rearRightWC.brakeTorque = brakeInput * brakeForce;
            rearLeftWC.brakeTorque  = brakeInput * brakeForce;
        }
        else
        {
            int multiplier = 1;
            rearRightWC.brakeTorque = 0;
            rearLeftWC.brakeTorque  = 0;

            if (LogitechGSDK.LogiButtonIsPressed(0, 11))//ré
            {
                multiplier = -1;
            }

            frontRightWC.motorTorque = multiplier * accelInput * motorForce;
            frontLeftWC.motorTorque  = multiplier * accelInput * motorForce;
            rearRightWC.motorTorque  = multiplier * accelInput * motorForce;
            rearLeftWC.motorTorque   = multiplier * accelInput * motorForce;
        }
    }