Exemple #1
0
        private CarController m_Car; // the car controller we want to use


        /*  private void FixedUpdate()
         * {
         *    // pass the input to the car!
         *    float h = CrossPlatformInputManager.GetAxis("Horizontal");
         *    float v = CrossPlatformInputManager.GetAxis("Vertical");
         #if !MOBILE_INPUT
         *    float handbrake = CrossPlatformInputManager.GetAxis("Jump");
         *    m_Car.Move(h, v, v, handbrake);
         #else
         *    m_Car.Moved(h, v, v, 0f);
         #endif
         * }*/


        private void FixedUpdate()
        {
            int v = 0;

            if (btn1 == 1)
            {
                //Debug.Log("Presionado - 1");
                v = 1;
            }

            /*else if (btn1 == 0)
             * {
             *  v= 0;
             * }
             */
            if (btn2 == 1)
            {
                //Debug.Log("Presionado - 1");
                v = -1;
            }/*
              * else if (btn2 == 0)
              * {
              * v = 0;
              * }*/



            int h = 0;

            if (dir1 <= 499)
            {
                //Debug.Log("Menor");
                h = -1;
            }

            if (dir1 >= 500)
            {
                //Debug.Log("Punto Medio");
                h = 0;
            }



            if (dir1 >= 601)
            {
                // Debug.Log("Mayor");
                h = 1;
            }

            // pass the input to the car!


#if !MOBILE_INPUT
            float handbrake = CrossPlatformInputManager.GetAxis("Jump");
            m_Car.Move(h, v, v, handbrake);
#else
            m_Car.Moved(h, v, v, 0f);
#endif
        }