Exemple #1
0
        void ProcessInput( )
        {
            // Controls //

            // Steer { Left / Right }

            // Left
            if (Input.GetAxis("Horizontal") < 0 && !Steering)
            {
                carMovement.TurnLeft();
                carAnimation.SetCarDirection(carMovement.direction);
                Steering = true;
                //print("LEFT!");
            }

            // Right
            else if (Input.GetAxis("Horizontal") > 0 && !Steering)
            {
                carMovement.TurnRight();
                carAnimation.SetCarDirection(carMovement.direction);
                Steering = true;
                //print("Right!");
            }

            else if ((Input.GetAxis("Horizontal") == 0))
            {
                Steering = false;
            }

            // Accel / Break
            if (Input.GetButton("Action Primary"))
            {
                carMovement.GoFoward();
            }

            if (Input.GetButton("Action Secondary"))
            {
                print("Go back!");
                carMovement.Break();
            }
        }