Esempio n. 1
0
        /// <summary>
        /// Constructs a new CalloutData object.
        /// </summary>
        /// <param name="callName">The name of the callout.</param>
        /// <param name="shortName">A short name for the callout; this could be anything, such as a radio/penal code, or abbreviation.</param>
        /// <param name="location">The location of the call.</param>
        /// <param name="response">Whether the call requires a Code 2 or Code 3 response.</param>
        /// <param name="description">The description of the call, as received by 911.</param>
        /// <param name="status">The status of the call. Set this to Created or Dispatched, and then update it to UnitResponding when the player accepts the call.</param>
        /// <param name="callPeds">The list of peds to be added to the call. Can be null to not add any peds; peds can always be added later on (for example, you can add a victim ped now, and then add a suspect ped after the player meets him/her).</param>
        /// <param name="callVehicles">The list of vehicles to be added to the call. Can be null to not add any vehicles; vehicles can always be added later on, for example, after the player encounters a suspect vehicle).</param>
        public CalloutData(string callName, string shortName, Vector3 location,
                           EResponseType response, string description = "", ECallStatus status = ECallStatus.Created,
                           List <Ped> callPeds = null, List <Vehicle> callVehicles             = null)
        {
            ID             = Guid.NewGuid();
            Name           = callName;
            ShortName      = shortName;
            mDescription   = description;
            Location       = location;
            TimeReceived   = DateTime.UtcNow;
            mTimeConcluded = null;
            ResponseType   = response;
            mStatus        = status;
            mPeds          = new List <Ped>();
            mVehicles      = new List <Vehicle>();

            if (callPeds != null)
            {
                Peds.AddRange(callPeds);
            }

            if (callVehicles != null)
            {
                Vehicles.AddRange(callVehicles);
            }

            mLastUpdated = DateTime.UtcNow;
            mUpdates     = new List <CalloutUpdate>();

            mIsPlayerAssigned = true;
            mPrimaryUnit      = Configs.UnitNumber;
        }
Esempio n. 2
0
        public void Setup()
        {
            //var sampleDB = JsonConvert.DeserializeObject<Vehicles>(Sampledata.VehiclesJson);
            var sampleDB = new Vehicles();
            var tmp      = JsonConvert.DeserializeAnonymousType(Sampledata.VehiclesJson, new { planes = new List <Plane>(), cars = new List <Car>() });

            sampleDB.AddRange(tmp.cars);
            sampleDB.AddRange(tmp.planes);

            var sampleManufactures = JsonConvert.DeserializeObject <List <Manufacturer> >(Sampledata.Manufacturers);

            //var sampleDB = JsonConvert.DeserializeObject<Vehicles>(Sampledata.VehiclesJson);
            var sampleDB = new Vehicles();
            var tmp      = JsonConvert.DeserializeAnonymousType(Sampledata.VehiclesJson, new { planes = new List <Plane>(), cars = new List <Car>() });

            sampleDB.AddRange(tmp.cars);
            sampleDB.AddRange(tmp.planes);

            _manufacturerRepository = new ManufacturerRepository(sampleDB, sampleManufactures);
        }
Esempio n. 3
0
 public void Seed()
 {
     Vehicles.AddRange(CreateVehicles());
     // Following should throw
     //Add(new FuelTank
     //{
     //    Capacity = "Unknown",
     //    FuelType = "Unknown",
     //    VehicleName = "1984 California Car"
     //});
     SaveChanges();
 }
Esempio n. 4
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="models">The list of vehicle models in this row</param>
 /// <param name="offsetDistance">The offset distance (fudge factor)</param>
 /// <param name="pixelsPerSecond">Speed</param>
 /// <param name="ghost">Ghosting</param>
 /// <param name="direction">Direction of travel</param>
 /// <param name="cooldownPeriod">Cooldown period</param>
 public VehicleRowModel(IEnumerable <VehicleModel> models,
                        float offsetDistance       = 0f,
                        float pixelsPerSecond      = 32f,
                        VehicleGhost ghost         = VehicleGhost.Ghost,
                        VehicleDirection direction = VehicleDirection.LeftToRight,
                        float cooldownPeriod       = -1)
 {
     Vehicles.AddRange(models);
     OffsetRight    = Vector2.Zero;
     Speed          = pixelsPerSecond;
     OffsetLeft     = new Vector2(-(224 + offsetDistance), 0);
     Ghost          = ghost;
     OffsetDistance = offsetDistance;
     Direction      = direction;
     CooldownPeriod = cooldownPeriod;
 }
Esempio n. 5
0
 public void Seed()
 {
     Vehicles.AddRange(CreateVehicles());
     SaveChanges();
 }
        public void Setup()
        {
            //var sampleDB = JsonConvert.DeserializeObject<Vehicles>(Sampledata.VehiclesJson);
            var sampleDB = new Vehicles();
            var tmp = JsonConvert.DeserializeAnonymousType(Sampledata.VehiclesJson, new { planes = new List<Plane>(), cars = new List<Car>() });
            sampleDB.AddRange(tmp.cars);
            sampleDB.AddRange(tmp.planes);

            var sampleManufactures = JsonConvert.DeserializeObject<List<Manufacturer>>(Sampledata.Manufacturers);

            //var sampleDB = JsonConvert.DeserializeObject<Vehicles>(Sampledata.VehiclesJson);
            var sampleDB = new Vehicles();
            var tmp = JsonConvert.DeserializeAnonymousType(Sampledata.VehiclesJson, new { planes = new List<Plane>(), cars = new List<Car>() });
            sampleDB.AddRange(tmp.cars);
            sampleDB.AddRange(tmp.planes);

            _manufacturerRepository = new ManufacturerRepository(sampleDB, sampleManufactures);
        }
Esempio n. 7
0
 public void AddGroupContainer(GroupContainer gc)
 {
     Vehicles.AddRange(gc.Vehicles);
     Center = new Point(Vehicles.Select(v => v.X).Average(), Vehicles.Select(v => v.Y).Average());
 }