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

            return clone.GetNext();
        }
コード例 #2
0
 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 );
            }
        }
コード例 #4
0
 public BelongToRouteItem( BuildRoute route, IRouteMark<RouteElement> position )
 {
     this.Route = route;
     this.Position = position;
 }
コード例 #5
0
 public void AddRoadThatBelongToIt( BuildRoute convertedRoutes, IRouteMark<RouteElement> routeMark )
 {
     this._routesThatBelong.Add( new BelongToRouteItem( convertedRoutes, routeMark ) );
 }
コード例 #6
0
 public Car( IEnumerable<IConductor> route )
 {
     this._conductors = new RouteMark<IConductor>( new Route<IConductor>( route ) );
     this._stateMachine = new CarStateMachine( this );
 }
コード例 #7
0
 private float GetLenght( IRouteMark<IConductor> road )
 {
     return road.Current.RouteElement.Length;
 }