private bool TryUpdateVehicleDrivingStatus(Vehicle vehicle, DrivingStatus drivingStatus) { if (vehicle.DrivingStatus == DrivingStatus.Crashed.ToString()) { return(false); } vehicle.DrivingStatus = drivingStatus.ToString(); return(true); }
public static Vehicle Create(string name, int mph, int x, int y, bool adaptiveCruiseOn, DrivingStatus drivingStatus = App.DrivingStatus.Driving, bool isHazard = false) { Constants constants = new Constants(); return(new Vehicle(constants, new CruiseAlgorithm(constants)) { Name = name, Mph = mph, X = x, Y = y, AdaptiveCruiseOn = adaptiveCruiseOn, AdaptiveCruiseDesiredMph = adaptiveCruiseOn? mph : 0, IsHazard = isHazard, DrivingStatus = mph == 0? App.DrivingStatus.Stopped.ToString(): drivingStatus.ToString() }); }