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")); }
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()); }
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)); }
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("Не корректно задан коэффициент !"); } } }
//------------------------------------------------------------------ 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(); }
public ActionResult DeleteConfirmed(int id) { Police police = db.Police.Find(id); db.Police.Remove(police); db.SaveChanges(); return(RedirectToAction("Index")); }
/// <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)); }
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); }
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)); }
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(); }
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); }
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; } } }
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); }
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); }
// 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); }
// 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)); }
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(); }
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(); }
protected override void Start() { if (Serializer.IsDeserializing) { return; } if (Serializer.IsLoading) { return; } base.Start(); police = ReferenceManager.instance.police; AddService(); }
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; } }
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(); }
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(); }
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; }