private bool IsHigher( CarsInserter firstConnction, CarsInserter secondConnection ) { var fromStartPointDistance = Vector2.Distance( firstConnction.Edge.StartLocation, secondConnection.Location ); var fromEndPointDistance = Vector2.Distance( firstConnction.Edge.EndLocation, secondConnection.Location ); return fromStartPointDistance <= fromEndPointDistance; }
public CarsInserterCommand( IMouseInformation mouseInformation, Factories.Factories factories, IEventAggregator eventAggregator ) { Contract.Requires( mouseInformation != null ); Contract.Requires( factories != null ); Contract.Requires( eventAggregator != null ); this._mouseInformation = mouseInformation; this._mouseInformation.LeftButtonClicked.Subscribe( s => { var carInserter = new CarsInserter( factories, s.Location ); eventAggregator.Publish( new AddControlToRoadLayer( carInserter ) ); } ); }
private IEnumerable<IAction> Convert( CarsInserter control ) { yield return CreateNewCommand( control ); if ( control.Connector.OpositeEdge != null ) { yield return Actions.Call<CarsInserter>( control.Id, () => control.Connector.ConnectStartFrom( ( RoadLaneBlock ) Is.Control( control.Connector.ConnectedEdge.Parent ) ) ); } yield return Actions.Call<CarsInserter>( control.Id, () => control.SetCarInsertInterval( Is.Const( control.GetCarInsertInterval() ) ) ) ; yield return this.BuildRoutes( control ); }
private bool AreConnected( CarsInserter firstConnction, CarsInserter secondConnection ) { var firstConnector = firstConnction.Connector; return firstConnector.Top == secondConnection || firstConnector.Bottom == secondConnection; }
public void ConnectEndBottomWith( CarsInserter roadConnection ) { this.Bottom = roadConnection; this._connectEdgesHelper.ConnectEndBottomWith( roadConnection.Edge ); }
public void ConnectBeginTopWith( CarsInserter roadConnection ) { this.Top = roadConnection; this._connectEdgesHelper.ConnectBeginTopWith( roadConnection.Edge ); }
public CarsInsertedConnector( CarsInserter owner ) { Contract.Requires( owner != null ); this._owner = owner; this._connectEdgesHelper = new ConnectEdgesHelper(this._owner.Edge, owner ); }