예제 #1
0
        public PlanningState(VehicleSimulationContext context)
        {
            Console.WriteLine("Planning:" + context.VehicleId);

            _context = context;
            _context.PlanNextRoute();
        }
예제 #2
0
        public StandStillState(VehicleSimulationContext context)
        {
            _context   = context;
            _pauseOver = DateTime.Now.AddSeconds(context.Random.Next(20));

            Console.WriteLine("StandStill:" + context.VehicleId + " (Wait until " + _pauseOver + ")");
            _context.PublishEvent(new VehicleStopped(context.VehicleId, _context.Name, context.Location.Name, context.Location.Position.Latitude, context.Location.Position.Longitude));
        }
예제 #3
0
        public DrivingState(VehicleSimulationContext context)
        {
            Console.WriteLine("Driving:" + context.VehicleId);

            _context = context;

            var route = _context.Route;

            _context.PublishEvent(new VehicleDriving(_context.VehicleId, _context.Name, route.Origin.Name, route.Destination.Name));
        }
예제 #4
0
        public VehicleSimulation(IBus bus, Guid vehicleId, string name, IRoutePlanner routePlanner)
        {
            _context = new VehicleSimulationContext(routePlanner, vehicleId, name, bus);

            StartInStillStand();
        }