public CloneBaseVehicle(BinaryReader br) : base(br) { VehicleSpecific = VehicleSpecific.Read(br); VehicleSpecific.Tricks = br.ReadStruct <VehicleTrick>(VehicleSpecific.NumberOfTricks); }
public Vehicle(VehicleSpecific vehicleSpecific, int tileX, int tileY, bool hasEmergencyLights, int debugNum) { vehicleState = VehicleState.Chilling; this.vehicleSpecific = vehicleSpecific; vehicleParameters = new VehicleParameters(hasEmergencyLights, this); actionList = new List <VAction>(); location = new Location(tileX, tileY, vehicleParameters, vehicleSpecific.sprite); selectedMovingLine = new SelectedMovingLine(location); vehicleParameters.debugNum = debugNum; }
public void AddVehicle() { Dictionary <AttachmentType, Attachment> attachmentList = new Dictionary <AttachmentType, Attachment>(); attachmentList.Add(AttachmentType.Headlight, new NormalBeams(111, 0.40f, LightType.HEADLIGHT)); attachmentList.Add(AttachmentType.TailLight, new NormalBeams(119, 5.90f, LightType.TAILLIGHT)); attachmentList.Add(AttachmentType.BrakeLight, new BrakeLights(119, 5.90f, LightType.BRAKELIGHT)); attachmentList.Add(AttachmentType.Indicator1, new IndicatorLights(100, 0.98f, LightType.INDICATORSIDELEFT, LightType.INDICATORSIDERIGHT)); attachmentList.Add(AttachmentType.Indicator2, new IndicatorLights(117, 5.97f, LightType.INDICATORBACKLEFT, LightType.INDICATORBACKRIGHT)); attachmentList.Add(AttachmentType.EmergencyLight1, new EmergencyLights(52, 0.45f, LightType.EMERGENCYROOFRED, LightType.EMERGENCYROOFBLUE, 0)); attachmentList.Add(AttachmentType.EmergencyLight2, new EmergencyLights(92, 5.35f, LightType.EMERGENCYSIDERED, LightType.EMERGENCYSIDEBLUE, 1)); attachmentList.Add(AttachmentType.EmergencyLight3, new EmergencyLights(43, 3.70f, LightType.EMERGENCYSIDERED, LightType.EMERGENCYSIDEBLUE, 2)); float scale = 0.75f; Sprite selectedSprite = new Sprite(new Rectangle(100, 0, 256, 128), TextureSheet.WorldUI); string name = "Standard Truck"; Sprite sprite = new Sprite(new Rectangle(0, 0, 273, 103), TextureSheet.Vehicles, Color.White); VehicleSpecific vehicleSpecific = new VehicleSpecific(attachmentList, scale, sprite, selectedSprite, name, 1.3f, 0.005f); List <Point> straightRoadList = WorldController.GetDebugListStraightRoadTiles(); // activeVehicleList.Add(new Vehicle(vehicleSpecific, 174, 182, true, 100)); //500 map offroad // int i = 0; int i = 0; while (i < 300) { int p = GameController.rnd.Next(0, straightRoadList.Count); Tile tile = WorldController.world.tileGrid[straightRoadList[p].X, straightRoadList[p].Y]; if (tile.vehicle == null) { // int x = GameController.rnd.Next(1, 999); // int y = GameController.rnd.Next(1, 999); // Vehicle vehicle = new Vehicle(vehicleSpecific, x, y, true, i); Vehicle vehicle = new Vehicle(vehicleSpecific, straightRoadList[p].X, straightRoadList[p].Y, true, i); idleVehicleList.Add(vehicle); AddVehicle(vehicle, true); i++; } } // i = 0; for (int c = 0; c < 1; c++) { foreach (Vehicle vehicle in activeVehicleList) { int p = GameController.rnd.Next(0, straightRoadList.Count); Point tile = new Point(straightRoadList[p].X, straightRoadList[p].Y); vehicle.NewMoveAction(tile, true); } } // Sprite sprite1 = new Sprite(new Rectangle(0, 0, 273, 103), TextureSheet.Vehicles, Color.Yellow); // VehicleSpecific vehicleSpecific1 = new VehicleSpecific(attachmentList, scale, sprite1, selectedSprite, name, 1.7f, 0.01f); /* while (i < 2) * { * int p = GameController.rnd.Next(0, straightRoadList.Count); * Tile tile = WorldController.world.tileGrid[straightRoadList[p].X, straightRoadList[p].Y]; * * if (tile.vehicle == null) * { * * Vehicle vehicle = new Vehicle(vehicleSpecific, straightRoadList[p].X, straightRoadList[p].Y, true, i); * AddVehicle(vehicle, true); * i++; * } * * }*/ // Sprite sprite1 = new Sprite(new Rectangle(0, 0, 273, 103), TextureSheet.Vehicles, Color.Yellow); // VehicleSpecific vehicleSpecific1 = new VehicleSpecific(attachmentList, scale, sprite1, selectedSprite, name, 1.7f, 0.01f); /* int c = 0; * * for (int y = 190; y < 210; y += 2) * { * if (GameController.rnd.Next(0, 2) == 0) * { * activeVehicleList.Add(new Vehicle(vehicleSpecific, 177, y, true, c)); //500 map offroad * c++; * } * else * { * activeVehicleList.Add(new Vehicle(vehicleSpecific1, 177, y, true, c)); //500 map offroad * c++; * } * } */ /* activeVehicleList.Add(new Vehicle(vehicleSpecific, 170, 175, true, 100)); //500 map offroad * activeVehicleList.Add(new Vehicle(vehicleSpecific, 171, 175, true, 0)); //500 map offroad * activeVehicleList.Add(new Vehicle(vehicleSpecific, 172, 175, true, 0)); //500 map offroad * activeVehicleList.Add(new Vehicle(vehicleSpecific, 173, 175, true, 0)); //500 map offroad * activeVehicleList.Add(new Vehicle(vehicleSpecific, 174, 175, true, 0)); //500 map offroad * activeVehicleList.Add(new Vehicle(vehicleSpecific, 175, 175, true, 0)); //500 map offroad * activeVehicleList.Add(new Vehicle(vehicleSpecific, 176, 175, true, 0)); //500 map offroad * activeVehicleList.Add(new Vehicle(vehicleSpecific, 177, 175, true, 0)); //500 map offroad * activeVehicleList.Add(new Vehicle(vehicleSpecific, 178, 175, true, 0)); //500 map offroad * activeVehicleList.Add(new Vehicle(vehicleSpecific, 179, 175, true, 0)); //500 map offroad */ }