public virtual CarState Update(Car car)
 {
     if (!CarStateUtility.carIsMoving(car))
     {
         IdleMoveState newState = new IdleMoveState();
         return(newState.Init(car));
     }
     else
     {
         return(this);
     }
 }
 public CarState HandleInput(Car car)
 {
     mag = (dir * Input.GetAxis("HorizontalA") / 2) + 0.5f;
     if (boostEvaluate(car, Car.driftBoostTimeB * timeWeight, 2.333333f, ref playedB, car.driftBoomB) || boostEvaluate(car, Car.driftBoostTimeA * timeWeight, 1.666666f, ref playedA, car.driftBoomA))
     {
         DrivingMoveState newState = new DrivingMoveState();
         return(newState.Init(car));
     }
     else if (!Input.GetButton("Drift") || !CarStateUtility.carIsMoving(car, true))
     {
         DrivingMoveState newState = new DrivingMoveState();
         return(newState.Init(car));
     }
     return(this);
 }
 bool boostEvaluate(Car car, float maxTime, float boostAmount, ref bool particleTriggered, ParticleSystem driftBoom)
 {
     if (time >= maxTime)
     {
         if (!particleTriggered)
         {
             driftBoom.Play(true);
             particleTriggered = true;
         }
         if (!Input.GetButton("Drift") && CarStateUtility.carIsMoving(car, true))
         {
             car.statsManager.BoostSpeed(car, boostAmount);
             return(true);
         }
     }
     return(false);
 }
    public virtual CarState HandleInput(Car car)
    {
        if (Input.GetButtonDown("DebugBoost1"))
        {
            car.statsManager.BoostSpeed(car, 1.666666f);
        }
        else if (Input.GetButtonDown("DebugBoost2"))
        {
            car.statsManager.BoostSpeed(car, 2.333333f);
        }

        if (Input.GetButton("Drift") && Input.GetAxis("HorizontalA") != 0 && CarStateUtility.carIsMoving(car, true))
        {
            DriftMoveState newState = new DriftMoveState();
            return(newState.Init(car));
        }
        accelDir = Input.GetAxisRaw("Move");
        turnDir  = Input.GetAxis("HorizontalA");
        return(this);
    }