Exemple #1
0
        private void populate()
        {
            //Add prisoners
            Prisoner p = new Prisoner(new Vector2D(10, 10), this);

            p.SB = new SeekBehaviour(p);
            entities.Add(p);

            //Add police
            Police p2 = new Police(new Vector2D(400, 400), this);

            p2.currentGoal = new Goal_SeekToEntity(p2);
            entities.Add(p2);

            //Add houses
            ElectricityHouse e1 = new ElectricityHouse(new Vector2D(800, 400), this);
            ElectricityHouse e2 = new ElectricityHouse(new Vector2D(200, 200), this);
            ElectricityHouse e3 = new ElectricityHouse(new Vector2D(500, 500), this);

            objects.Add(e1);
            objects.Add(e2);
            //objects.Add(e3);

            //Target
            Target        = new Vehicle(new Vector2D(100, 60), this);
            Target.VColor = Color.DarkRed;
            Target.Pos    = new Vector2D(100, 40);
        }
        public IActionResult PoliceUpdated(int sin, string position, int activation_code)
        {
            SessionCheck();
            var sin1 = sin;

            Police police = new Police();
            var    data   = obj_hrpdbcontext.Positions.ToList().Where(x => x.name == position);

            foreach (Position d in data)
            {
                police.position_id = d.id;
            }

            police.sin             = sin;
            police.activation_code = Convert.ToString(activation_code);
            try
            {
                obj_hrpdbcontext.Polices.Update(police);
                obj_hrpdbcontext.SaveChanges();
            }
            catch (DbUpdateException)
            {
                return(RedirectToAction("IdExist"));
            }
            return(RedirectToAction("PoliceList"));
        }
Exemple #3
0
    public void StartGame()
    {
        turnCount            = maxTurn;
        csTeamNameText.text  = csTeamName;
        scsTeamNameText.text = scsTeamName;

        isCSPolice = round % 2 == 0;

        string policeName = (isCSPolice ? csTeamName : scsTeamName) + ".PoliceAI";
        string thiefName  = (isCSPolice ? scsTeamName : csTeamName) + ".ThiefAI";

        Debug.Log(policeName);
        Debug.Log(thiefName);

        policeAI = Activator.CreateInstance(Type.GetType(policeName)) as Police;
        thiefAI  = Activator.CreateInstance(Type.GetType(thiefName)) as Thief;

        thiefCatchAlert.rectTransform.localPosition      = new Vector3(245 * (isCSPolice ? -1 : 1), 0);
        treasureCaptureAlert.rectTransform.localPosition = new Vector3(245 * (isCSPolice ? 1 : -1), 0);

        policeErrorAlert.rectTransform.localPosition = new Vector3(245 * (isCSPolice ? -1 : 1), 0);
        thiefErrorAlert.rectTransform.localPosition  = new Vector3(245 * (isCSPolice ? 1 : -1), 0);

        policeIcon.rectTransform.localPosition = new Vector3(780 * (isCSPolice ? -1 : 1), policeIcon.rectTransform.localPosition.y);
        thiefIcon.rectTransform.localPosition  = new Vector3(780 * (isCSPolice ? 1 : -1), thiefIcon.rectTransform.localPosition.y);

        mapManager.InitiateMap();
        StartCoroutine(InitiateAgents());
    }
Exemple #4
0
        public JsonResult EditPolicia(Police police)
        {
            if (police == null)
            {
                return(Json(new { responseCode = "-10" }));
            }


            //Solo actualizo el campo descripcion
            db.Police.Attach(police);
            db.Entry(police).Property(x => x.PoliceStationId).IsModified = true;
            db.Entry(police).Property(x => x.Nombre).IsModified          = true;
            db.Entry(police).Property(x => x.Apellido).IsModified        = true;
            db.Entry(police).Property(x => x.DNI).IsModified             = true;

            db.SaveChanges();

            //Audito
            AuditHelper.Auditar("Modificacion", police.Id.ToString(), "Police", ModuleDescription, WindowDescription);

            var responseObject = new
            {
                responseCode = 0
            };

            return(Json(responseObject));
        }
Exemple #5
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(tb_TypePolice.Text))
     {
         MessageBox.Show("Поле тип полицейского не задан !");
     }
     else
     {
         double d;
         if (double.TryParse(tb_Coefficient.Text, out d))
         {
             if (p == null)
             {
                 p = new Police(tb_TypePolice.Text, d);
             }
             else
             {
                 p.TypeName = tb_TypePolice.Text;
                 p.Coeff    = d;
             }
             if (addOrEdit)
             {
                 Add();
             }
             else
             {
                 Edit();
             }
         }
         else
         {
             MessageBox.Show("Не корректно задан коэффициент !");
         }
     }
 }
Exemple #6
0
        //------------------------------------------------------------------
        public Police CreatePolice(Game game)
        {
            var police = new Police(this, carsCounter, Settings.PoliceStartPosition);

            SetupCar(police);

            return(police);
        }
        public async Task Add(Police police)
        {
            var mappedPolice = AutoMapper.Mapper.Map <PoliceEntity>(police);
            var dbContext    = _dzuwenaliaDBContextFactory.Create();

            dbContext.Police.Add(mappedPolice);
            await dbContext.SaveChanges();
        }
Exemple #8
0
        public ActionResult DeleteConfirmed(int id)
        {
            Police police = db.Police.Find(id);

            db.Police.Remove(police);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #9
0
 /// <summary>
 /// Add an police
 /// </summary>
 /// <param name="entity">police to insert</param>
 /// <returns></returns>
 public Police Add(Police entity)
 {
     //Validate address
     entity.Address = GetAddressName(entity.IdDepartment, entity.IdDistrict, entity.IdProvince);
     //Add a year to start date to get the end date
     entity.EndDate = entity.StartDate.Value.AddYears(1);
     return(_policeRepository.Add(entity));
 }
Exemple #10
0
 public void Enter(Police police)
 {
     this.police = police;
     //Text txt = txt.GetComponent<Text>("Text");
     //txt = GameObject.GetComponent<UnityEngine.UI.Text>("Text");
     //txt = GameObject.GetComponent<Text>("Text");
     //txt.text=".";
 }
        public DetaljiPolicePage(Police polica)
        {
            InitializeComponent();

            NavigationPage.SetHasNavigationBar(this, true);
            Title = polica.Naziv;

            BindingContext = _model = new DetaljiPoliceViewModel(polica);
        }
Exemple #12
0
 public ActionResult Edit([Bind(Include = "Id,DNI,Nombre,Apellido,FechaAlta,Enable")] Police police)
 {
     if (ModelState.IsValid)
     {
         db.Entry(police).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(police));
 }
    public void DeployPoliceSquad(FactionLogic.Genre genre, House targetHouse)
    {
        Police deployedSquad = (Police)Instantiate(police,
                                                   policeSpawnPoint.position,
                                                   policeSpawnPoint.rotation);

        deployedSquad.transform.parent = gameObject.transform;
        deployedSquad.setTargetGenre(genre);
        deployedSquad.SetHouse(targetHouse);
    }
    public void TryInteractionMatch(InteractionType interactionType, Vector2 interactionPosition)
    {
        Police    police    = Interactor.GetFreeInteractor(FindObjectsOfType <Police>());
        Protester protester = Interactor.GetFreeInteractor(FindObjectsOfType <Protester>());

        if (police == null || protester == null)
        {
            return;
        }
        _interactions.Add(new InteractionProcess(interactionType, protester, police, interactionPosition));
    }
Exemple #15
0
        public ActionResult Create([Bind(Include = "Id,DNI,Nombre,Apellido,FechaAlta,Enable")] Police police)
        {
            if (ModelState.IsValid)
            {
                db.Police.Add(police);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(police));
        }
        public async Task Edit(Police police)
        {
            var dbContext    = _dzuwenaliaDBContextFactory.Create();
            var policeToEdit = await dbContext.Police.FirstAsync(x => x.Id == police.Id);

            policeToEdit.XCoordinate = police.XCoordinate;
            policeToEdit.YCoordinate = police.YCoordinate;
            policeToEdit.PatrolSize  = police.PatrolSize;
            policeToEdit.PatrolDate  = police.PatrolDate;
            await dbContext.SaveChanges();
        }
Exemple #17
0
        private SimDescription CreateNewCopFromPool()
        {
            List <SimDescription> randomList = new List <SimDescription>();
            Police instance = Police.Instance;

            if (instance != null)
            {
                foreach (SimDescription description in instance.Pool)
                {
                    if (!Police.Instance.IsServiceAssigned(description))
                    {
                        Sim sim = description.CreatedSim;
                        if (sim != null && sim.GetSituationOfType <ArrestSuspectSituation>() != null)
                        {
                            continue;
                        }
                        randomList.Add(description);
                    }
                }
            }
            if (randomList.Count == 0)
            {
                Household ActiceHousehold = Household.ActiveHousehold;
                Household ActiveHousehold = Nra.NFinalizeDeath.ActiveHousehold;
                foreach (var item in ListCollon.NiecSimDescriptions)
                {
                    if (item == null || !item.IsValidDescription)
                    {
                        continue;
                    }
                    if (item.ChildOrBelow || item.IsPet || item.Household == null)
                    {
                        continue;
                    }
                    if (item.Household == ActiceHousehold || item.Household == ActiveHousehold)
                    {
                        continue;
                    }
                    Sim sim = item.CreatedSim;
                    if (sim != null && sim.GetSituationOfType <ArrestSuspectSituation>() != null)
                    {
                        continue;
                    }
                    //if (item.CreatedSim.GetSituationOfType<ArrestSuspectSituation>() != null)
                    //    continue;
                    randomList.Add(item);
                }
            }
            if (randomList.Count > 0)
            {
                return(RandomUtil.GetRandomObjectFromList <SimDescription>(randomList));
            }
            return(null);
        }
Exemple #18
0
 private static void PoliceSupport(Police police, Troop troop, ref Citizen[] citizens)
 {
     for (int i = 0; i < citizens.Length; i++)
     {
         if (citizens[i].Id == troop.CitizenId)
         {
             citizens[i].X = police.X;
             citizens[i].Y = police.Y;
             break;
         }
     }
 }
Exemple #19
0
        protected override void LoadContent()
        {
            Police = Game.Content.Load <SpriteFont>("Fonts/" + NomPolice);
            Vector2 dimension = Police.MeasureString(Message);

            Position = new Vector2(Position.X - dimension.X / 2,
                                   Position.Y - dimension.Y / 2);
            GestionSprites         = Game.Services.GetService(typeof(SpriteBatch)) as SpriteBatch;
            GestionnaireDeTextures = Game.Services.GetService(typeof(RessourcesManager <Texture2D>)) as RessourcesManager <Texture2D>;
            Texture     = GestionnaireDeTextures.Find(NomTexture);
            Destination = new Rectangle((int)Position.X, (int)Position.Y, (int)dimension.X, (int)dimension.Y);
        }
Exemple #20
0
    private void SpawnPolice()
    {
        Police p = GameObject.Instantiate <Police>(Resources.Load <Police>("Police"));

        p.transform.SetParent(_policeSpawnRoot.transform, false);
        _policeSpawned.Add(p);
        Vector2 pos = new Vector2(_protestorsGatherArea.anchoredPosition.x - _gatherAreaSize.x * 50, _protestorsGatherArea.anchoredPosition.y - _gatherAreaSize.y * 50);

        pos.x += _gatherAreaSize.x * (100 * UnityEngine.Random.value);
        pos.y += _gatherAreaSize.y * (100 * UnityEngine.Random.value);
        p.WalkTo(pos, 15);
    }
Exemple #21
0
 // POST api/polices
 public HttpResponseMessage Post([FromBody] Police police)
 {
     if (ModelState.IsValid)
     {
         var policeInserted = _policeManager.Add(police);
         return(Request.CreateResponse(HttpStatusCode.OK, policeInserted));
     }
     else
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
     }
 }
        //------------------------------------------------------------------
        public Police CreatePolice(Game game)
        {
            var police = new Police(this, carsCounter, Settings.PoliceStartPosition, GetWeight(), "Police");

            police.Setup();

            Cars.Add(police);
            OwnCar(police);

            carsCounter++;

            return(police);
        }
Exemple #23
0
        // GET: Police/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Police police = db.Police.Find(id);

            if (police == null)
            {
                return(HttpNotFound());
            }
            return(View(police));
        }
Exemple #24
0
 private static void AddPolice(int policeCount)
 {
     for (int i = 0; i < policeCount; i++)
     {
         Police p = new Police();
         p.Name      = 'P';
         p.ID        = i + 1;
         p.XPos      = maximumLenghtX.GetRandomNumber();
         p.YPos      = maximumLenghtY.GetRandomNumber();
         p.Direction = (Direction)maximumDirection.GetRandomNumber();
         p.Inventory = new List <string>();
         Persons.Add(p);
     }
 }
        public InteractionProcess(InteractionType type, Protester protester, Police police, Vector2 interactionPosition)
        {
            InteractionType      = type;
            _protester           = protester;
            _police              = police;
            _interactionPosition = interactionPosition;

            _policePos    = _interactionPosition;
            _protesterPos = _interactionPosition;

            _policePos.x    += ((RectTransform)police.transform).rect.width / 2 + 5;
            _protesterPos.x -= ((RectTransform)protester.transform).rect.width / 2 + 5;

            FaceOneAnother();
        }
Exemple #26
0
        public NewTown(string name, int buildings, int days)
        {
            townName        = name;
            this.buildings  = buildings;
            this.days       = days;
            fireProbability = 1e-3;

            policeman    = new Police(this);
            ambulanceman = new Ambulance(this);
            fireman      = new FireDetect(this);

            policeman.On();
            ambulanceman.On();
            fireman.On();
        }
Exemple #27
0
    protected override void Start()
    {
        if (Serializer.IsDeserializing)
        {
            return;
        }
        if (Serializer.IsLoading)
        {
            return;
        }
        base.Start();

        police = ReferenceManager.instance.police;
        AddService();
    }
Exemple #28
0
        public JsonResult GetPolicia(int id)
        {
            Police police = new Police();

            try
            {
                police = db.Police.Find(id);
                var json = JsonConvert.SerializeObject(police);

                return(Json(police, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #29
0
        static void Main(string[] args)
        {
            // Welcoming user with basic instructions
            WelcomeUser();
            string location = "Invalid Location";

            do
            {
                Console.Write("Type in the desired location: ");
                location = Console.ReadLine();
            } while (IOHelper.IsLocationValid(location) == false);

            Police police = new Police(location);

            police.ChooseDevice();

            Console.ReadKey();
        }
Exemple #30
0
    public static void Main()
    {
        // instantiate listeners
        Police    police    = new Police();
        Fire      fire      = new Fire();
        Ambulance ambulance = new Ambulance();

        // instantiate broadcaster
        Call911 c911 = new Call911();

        // attach broadcaster (call911) to listners (police, ambulance, fire)
        c911.CallForHelp += police.OnCallTo911;
        c911.CallForHelp += fire.OnCallTo911;
        c911.CallForHelp += ambulance.OnCallTo911;

        //call to 911
        c911.createNotification("250 Humber Blvd.  - John Hinz - HELP - Crazy Students!!!!! ");

        Console.ReadLine();
    }
Exemple #31
0
    private void startSeekPolice(Police p)
    {
        this.changeState(TOWNSF_BEHAVIOR_SEEKPOLICE);
        this.setPathfindingEnabled(true);
        this.spriteAnimation.play(ANIM_WALK, true);

        this.policeToSeek = p;
        this.setDestination(p.transform.position);
        this.speed = this.aghastSpeed;
    }