public void CreateCar( CarsInserter startElement ) { // if ( this._carId > 2 ) // { // return; // } this._carId++; if ( startElement == null ) throw new ArgumentNullException( "startElement" ); var carAhead = startElement.Lane.Information.GetCarAheadDistance( null ); if ( carAhead.CarAhead != null && carAhead.CarDistance < carAhead.CarAhead.Lenght ) { return; } var car = this.GetRandomCarSpecifcation().Create( startElement ); car.Location = startElement.CarsInserterBuilder.Location; this._eventAggregator.Publish( new CarCreated( car ) ); }
private void SetRouteElement( IRoadElement element ) { var carInserter = element as CarsInserter; if ( carInserter == null ) { throw new ArgumentException( "Wrong road element" ); } this._carInserter = carInserter; }
public CarInserterRoadInformation( CarsInserter carInserter ) { Contract.Requires( carInserter != null ); this._carInserter = carInserter; }