MoveCar.Update C# (CSharp) Method

Update() public method

public Update ( ) : void
return void
    public void Update()
    {
        //This is expensive but we do it only once..
        if (!isFinished) {
            mySpeed = rb.velocity.magnitude * 3.6f;
            scaledSpeed = Map (0, maxSpeed, 0f, 1f, mySpeed);

            if (!isControlledByAI) {
                float moveVertical = Input.GetAxisRaw ("Vertical");
                float moveHorizontal = Input.GetAxisRaw ("Horizontal");
                //Converting input to output in game

                /*ACCELERATE/BRAKE DATA*/
                if (moveVertical == 1) {
                    isAccelerating = 1f;
                    if (!begunAccelerating) {
                        OnFirstAccelerate ();
                        begunAccelerating = true;
                    }
                } else if (moveVertical <= 0) {
                    isAccelerating = 0f;
                }

                /*TURNING DATA*/
                if (moveHorizontal == 1) {
                    isTurningLeft = 0f;
                    isTurningRight = 1f;
                    isNotTurning = 0f;
                } else if (moveHorizontal == 0) {
                    isTurningLeft = 0f;
                    isTurningRight = 0f;
                    isNotTurning = 1f;
                } else if (moveHorizontal == -1) {
                    isTurningLeft = 1f;
                    isTurningRight = 0f;
                    isNotTurning = 0f;
                }
                //Debug.Log("(user input) A: " + isAccelerating + " D: " + isDecelerating + " B: " + isBraking);
            }
            //Converting AI output to game output
            else {
                //Moving.. (back and forth)
                if (shouldAccelerate == 1) {
                    isAccelerating = 1f;
                    //isBraking = 0f;
                    //This is AI begunaccelerate
                    if (!begunAccelerating) {
                        OnFirstAccelerate ();
                        begunAccelerating = true;
                    }
                } else if (shouldAccelerate == 0) {
                    isAccelerating = 0f;
                }

                //Turning...
                if (shouldTurnLeft == 1) {
                    isTurningLeft = 1f;
                    isTurningRight = 0f;
                    isNotTurning = 0f;
                } else if (shouldTurnRight == 1) {
                    isTurningLeft = 0f;
                    isTurningRight = 1f;
                    isNotTurning = 0f;
                } else if (shouldNotTurn == 1) {
                    isTurningLeft = 0f;
                    isTurningRight = 0f;
                    isNotTurning = 1f;
                }
                //This will be changed when we have a neural network for turning
            }

            GetComponent<AudioSource> ().clip = movingCarSound;
            //If we are moving too fast then set acceleration to 0
            PlaySound ();
        }
    }