private IConductor GetNextPoint( IRouteMark<IConductor> conductors )
        {
            var clone = conductors.Clone();
            while ( clone.Current.RouteElement.RoadElement != this._laneJunction )
            {
                clone.MoveNext();
            }

            return clone.GetNext();
        }
 public RoadInformation Process( Car car, IRouteMark<IConductor> route )
 {
     var carAheadInformation = this.Information.GetCarAheadDistance( car );
     return new RoadInformation
                {
                    CarAhead = carAheadInformation.CarAhead,
                    CarAheadDistance = carAheadInformation.CarDistance,
                    PrivilagesCarInformation = null,
                    CanStop = this._canStopOnIt,
                    CanDriver = true,
                };
 }
        public void GetLightInformation( IRouteMark routeMark, LightInfomration lightInformation )
        {
            if ( lightInformation.LightDistance > Constans.ToVirtualUnit( 70.0f ) ) { return; }

            var previousEdge = this.GetEdgeConnectedWith( routeMark.GetPrevious() );
            if ( this._laneJunction.Lights[ previousEdge.Item1 ] != null )
            {
                lightInformation.LightState = this._laneJunction.Lights[ previousEdge.Item1 ].LightState;
            }
            else
            {
                var nextEdge = this.GetEdgeConnectedWith( routeMark.GetNext() );
                lightInformation.LightDistance += Vector2.Distance( previousEdge.Item2.EdgeBuilder.Location, nextEdge.Item2.EdgeBuilder.Location );
                routeMark.MoveNext();
                routeMark.Current.Condutor.GetLightInformation( routeMark, lightInformation );
            }
        }
 public BelongToRouteItem( BuildRoute route, IRouteMark<RouteElement> position )
 {
     this.Route = route;
     this.Position = position;
 }
 public void AddRoadThatBelongToIt( BuildRoute convertedRoutes, IRouteMark<RouteElement> routeMark )
 {
     this._routesThatBelong.Add( new BelongToRouteItem( convertedRoutes, routeMark ) );
 }
Exemplo n.º 6
0
 public Car( IEnumerable<IConductor> route )
 {
     this._conductors = new RouteMark<IConductor>( new Route<IConductor>( route ) );
     this._stateMachine = new CarStateMachine( this );
 }
 private float GetLenght( IRouteMark<IConductor> road )
 {
     return road.Current.RouteElement.Length;
 }