Пример #1
0
    private void FixedUpdate()
    {
        // pass the input to the car!
        float h = ArduinoControl_2.IsButtonDown(ArduinoControl_2.ButtonCode.Right) ? -1.0f : 0.0f;

        h = ArduinoControl_2.IsButtonDown(ArduinoControl_2.ButtonCode.Left) ? 1.0f : h;

        float v = ArduinoControl_2.IsButtonDown(ArduinoControl_2.ButtonCode.Blue) ? 1.0f : 0.0f;;

        //v = ArduinoControl_2.IsButtonDown(ArduinoControl_2.ButtonCode.Black) ? -0.5f : 0.0f; ;
#if !MOBILE_INPUT
        float handbrake = ArduinoControl_2.IsButtonDown(ArduinoControl_2.ButtonCode.Yellow) ? 1.0f : 0.0f;;
        m_Car.Move(h, v, v, handbrake);
#else
        m_Car.Move(h, v, v, 0f);
#endif
    }
Пример #2
0
 // Update is called once per frame
 void Update()
 {
     if (ArduinoControl_2.IsButtonDown(ArduinoControl_2.ButtonCode.Yellow))
     {
         Debug.Log("Yellow");
     }
     if (ArduinoControl_2.IsButtonDown(ArduinoControl_2.ButtonCode.Blue))
     {
         Debug.Log("Blue");
     }
     if (ArduinoControl_2.IsButtonDown(ArduinoControl_2.ButtonCode.Black))
     {
         Debug.Log("Black");
     }
     if (ArduinoControl_2.IsButtonDown(ArduinoControl_2.ButtonCode.Left))
     {
         Debug.Log("Left");
     }
     if (ArduinoControl_2.IsButtonDown(ArduinoControl_2.ButtonCode.Right))
     {
         Debug.Log("Right");
     }
 }