示例#1
0
        public void CollisonNPCTest()
        {
            World world = World.Instance;

            List <WorldObject> objects = new List <WorldObject>();

            int W = 108;
            int H = 240;
            List <List <Point> > polyList = new List <List <Point> >();

            polyList.Add(new List <Point>(new Point[] { new Point(0, 0), new Point(0, 200), new Point(200, 0), new Point(200, 200) }));
            AutomatedCar controlledCar = new AutomatedCar(0, 0, "car_1_white", W, H, polyList);

            world.ControlledCar = controlledCar;

            AutomatedCar controlledCar2 = new AutomatedCar(0, 0, "car_1_white", W, H, polyList);

            controlledCar2.IsColliding = true;
            world.AddObject(controlledCar2);

            world.OnCollideWithNPC += delegate(WorldObject worldObject)
            {
                objects.Add(worldObject);
            };

            world.IsColisonWhitWorldObject();

            Assert.Equal(1, objects.Count);
        }
示例#2
0
        public void thereIsAnObjectInRadar()
        {
            aeb.controlledCar = new AutomatedCar(100 * 50, 0, "", 0, 0, new List <List <Avalonia.Point> >());
            WorldObject wo = new AutomatedCar(0, 0, "", 0, 0, new List <List <Avalonia.Point> >());

            aeb.controlledCar.Radar.LastSeenObject = wo;
            Assert.True(aeb.isThereAnObjectInRadar());
        }
示例#3
0
        public void getStoppingDistanceTo_carPosition_speed0_x0_y0_worldobjectPosition_speed0_x0_y0()
        {
            aeb.controlledCar = new AutomatedCar(0, 0, "", 0, 0, new List <List <Avalonia.Point> >());
            WorldObject wo = new AutomatedCar(0, 0, "", 0, 0, new List <List <Avalonia.Point> >());

            double distance = aeb.getStoppingDistanceTo_inPixels(wo);

            Assert.Equal(0, distance);
        }
 public DashboardViewModel(AutomatedCar controlledCar)
 {
     this.ControlledCar                     = controlledCar;
     this.RpmGaugeViewModel                 = new RpmGaugeViewModel();
     this.SpeedGaugeViewModel               = new SpeedGaugeViewModel();
     this.TransmissionViewModel             = new TransmissionViewModel();
     this.LeftTurnSignalViewModel           = new TurnSignalViewModelBase();
     this.RightTurnSignalViewModel          = new TurnSignalViewModelBase();
     this.RpmGaugeViewModel.Value           = 3000;
     this.RpmGaugeViewModel.Caption         = $"{this.RpmGaugeViewModel.Value} rpm";
     this.SpeedGaugeViewModel.Value         = 50;
     this.SpeedGaugeViewModel.Caption       = $"{this.SpeedGaugeViewModel.Value} km/h";
     this.BreakPedalViewModel               = new BreakPedalViewModel();
     this.BreakPedalViewModel.Value         = 75;
     this.GasPedalViewModel                 = new GasPedalViewModel();
     this.GasPedalViewModel.Value           = 50;
     this.TransmissionViewModel.CurrentGear = Gear.P;
     this.TransmissionViewModel.Caption     = $"Gear: {this.TransmissionViewModel.CurrentGear}";
 }
示例#5
0
 public DashboardViewModel(Models.AutomatedCar car)
 {
     controlledCar = car;
 }