Esempio n. 1
0
        /// <summary>
        /// Возвращает информацию об машинах полиции
        /// </summary>
        private static IEnumerable <CommonVehicle> GetVehiclesInfo()
        {
            var infos = PoliceDataGetter.GetVehiclePositions();

            return(infos.Select(info => new CommonVehicle {
                Hash = info.Hash,
                VehicleType = POLICE_VEHICLE_KEY,
                SpawnPosition = info.Position,
                SpawnRotation = info.Rotation,
                Fuel = MAX_FUEL,
                MaxFuel = MAX_FUEL,
                MainColor = 111
            }).ToList());
        }
Esempio n. 2
0
 /// <summary>
 /// Запускает таймер, генерящий события патрулирования
 /// </summary>
 public void RunAlertsGenerator()
 {
     ActionHelper.StartTimer(120000, () => {
         var expiredAlerts = _policeAlerts.Where(e => (DateTime.Now - e.Date).TotalMinutes >= 30).ToList();
         foreach (var alert in expiredAlerts)
         {
             FinishAlert(alert.Id);
         }
         if (_policeAlerts.Count < MAX_FAKE_ALERTS)
         {
             var position = PoliceDataGetter.GetAlertPosition();
             CreateAlert(position, PATROL_ALERT);
         }
     });
 }