/// <summary> /// Initializes a new instance of the <see cref="OddityCore"/> class. /// </summary> public OddityCore() { _httpClient = new HttpClient(); _httpClient.BaseAddress = new Uri(ApiConfiguration.ApiEndpoint); _httpClient.DefaultRequestHeaders.UserAgent.ParseAdd($"{ApiConfiguration.LibraryName}/{GetLibraryVersion()} ({ApiConfiguration.GitHubLink})"); SetTimeout(ApiConfiguration.DefaultTimeoutSeconds); var builderDelegatesContainer = new BuilderDelegatesContainer { DeserializationError = DeserializationError, RequestSend = RequestSend, ResponseReceived = ResponseReceived }; Api = new Api(_httpClient, builderDelegatesContainer); Company = new Company(_httpClient, builderDelegatesContainer); Rockets = new Rockets(_httpClient, builderDelegatesContainer); Capsules = new Capsules(_httpClient, builderDelegatesContainer); DetailedCapsules = new DetailedCapsules(_httpClient, builderDelegatesContainer); DetailedCores = new DetailedCores(_httpClient, builderDelegatesContainer); Launchpads = new Launchpads(_httpClient, builderDelegatesContainer); Launches = new Launches(_httpClient, builderDelegatesContainer); Roadster = new Roadster(_httpClient, builderDelegatesContainer); }
public static void ArrayCovariance() { Sedan[] sedans = new Sedan[1]; sedans[0] = new Sedan(); Auto[] autos = sedans; autos[0] = new Roadster(); }
static void Main() { Vehicle vehicle = new Vehicle(); vehicle.VehicleInfo(); Roadster roadster = new Roadster(); roadster.RoadsterInfo(); FClassCar fClassCar = new FClassCar(); fClassCar.FClassCarInfo(); Console.ReadLine(); }
public override _Car ManufactureCar(CarModels carModel, List <CarExtras> carExtras) { _Car car = null; if (carModel == CarModels.ModelS) { car = new ModelS(); } else if (carModel == CarModels.Roadster) { car = new Roadster(); } //Notice that the Cybertruck is missing here, so we cant manufacture it! if (car == null) { Debug.Log("Sorry but this factory cant manufacture this model :("); return(car); } //Add the extras foreach (CarExtras carExtra in carExtras) { if (carExtra == CarExtras.DracoThruster) { car = new DracoThruster(car, 1); } else if (carExtra == CarExtras.EjectionSeat) { car = new EjectionSeat(car, 1); } else { Debug.Log("Sorry but this factory cant add this car extra :("); } } return(car); }
public override _Car ManufactureCar(CarModels carModel, List <CarExtras> carExtras) { _Car car = null; if (carModel == CarModels.Cybertruck) { car = new Cybertruck(); } else if (carModel == CarModels.ModelS) { car = new ModelS(); } else if (carModel == CarModels.Roadster) { car = new Roadster(); } if (car == null) { Debug.Log("Sorry but this factory cant manufacture this model :("); return(car); } //Add the extras foreach (CarExtras carExtra in carExtras) { if (carExtra == CarExtras.DracoThruster) { car = new DracoThruster(car, 1); } //Ejection seats are not legal in US so cant manufacture it (but we will still manufacture the rest of the car) else { Debug.Log("Sorry but this factory cant add this car extra :("); } } return(car); }