// Update is called once per frame
    void Update()
    {
        Pothole pothole = CheckForPotholes();

        if (pothole != null)
        {
            carState.TransitionToState(stoppedByPotholeState, pothole, PotholeDone);
        }

        CharacterNavigationController otherCar = CheckForOtherCars();

        if (otherCar != null)
        {
            if (otherCar.carState.StoppedByPothole())
            {
                carState.TransitionToState(stoppedByPotholeState, otherCar.carState.GetPothole(), PotholeDone);
            }
            else
            {
                carState.TransitionToState(stoppedByCarState, otherCar);
            }
        }

        if (pothole == null && otherCar == null && !carState.IsMoving())
        {
            carState.TransitionToState(movingState);
        }

        if (carState.IsMoving())
        {
            MoveTowardsDestination();
        }
        else
        {
            carState.TimeGoesBy(Time.deltaTime);
            if (carState.NeedToKillCar())
            {
                Destroy(this.gameObject);
            }
        }
    }