Exemplo n.º 1
0
        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.Move(h, v, v, 0f);
#endif
        }
Exemplo n.º 2
0
        // Update is called once per frame
        void Update()
        {
            if (bumpBackoff == 0 && Input.GetKeyDown("space"))
            {
                bumpCounter = 10;
                bumpBackoff = 60;
            }
            if (Input.GetKeyDown("f"))
            {
                Debug.Log("f pressed");
                counter = 120;
            }
            if (counter > 0)
            {
                counter -= counter > 0 ? 1 : 0;
                m_Car.Move(0f, 100f, 100f, 0f);
            }
            else if (bumpCounter > 0 || bumpBackoff > 0)
            {
                bumpCounter -= bumpCounter > 0 ? 1 : 0;
                bumpBackoff -= bumpBackoff > 0 ? 1 : 0;
                if (bumpCounter > 0)
                {
                    m_Car.Bump();
                }
            }
            else
            {
                // 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.Move(h, v, v, 0f);
#endif
            }
        }
Exemplo n.º 3
0
        void Update()
        {
            // Speed Burst
            //
            if (counter > 0)
            {
                counter -= counter > 0 ? 1 : 0;
                m_Car.Move(0f, 100f, 100f, 0f);
            }

            // Car bump
            //
            if (bumpCounter > 0 || bumpBackoff > 0)
            {
                bumpCounter -= bumpCounter > 0 ? 1 : 0;
                bumpBackoff -= bumpBackoff > 0 ? 1 : 0;
                if (bumpCounter > 0)
                {
                    m_Car.Bump();
                }
            }
        }