public void TakeDamage(int damage) { Patrol rdt = GetComponent <Patrol>(); rdt.resetDT(); health -= damage; Patrol PT = this.GetComponent <Patrol>(); if (PT.goingRight == true) { this.transform.Translate(Vector2.right * 15 * Time.deltaTime); } else { this.transform.Translate(Vector2.left * 15 * Time.deltaTime); } healthBar.fillAmount = health / 3; if (health <= 0) { ultBarscript.ultMeter += 0.5f; Instantiate(DeathEffect, transform.position, Quaternion.identity); Destroy(gameObject); // enemy explosion sound } }
// Use this for initialization void Start() { thisAnimator = GetComponent <Animator>(); thisPatrol = GetComponent <Patrol>(); thisNavMeshAgent = GetComponent <NavMeshAgent>(); thisCollider = GetComponent <BoxCollider>(); }
private void Awake() { hold = GetComponent <Hold>(); patrol = GetComponent <Patrol>(); nav = GetComponent <Navegation>(); anim = GetComponent <Animator>(); }
/// /// <param name="newIncidnet"></param> public void SearchPatrolLocation(Report report){ foundpatrols.Clear(); IObjectSet allpatrols =Complainant.db.QueryByExample(typeof(Patrol)); Patrol newPatrol = new Patrol(); for (int i = 0; i < allpatrols.Count; i++) { newPatrol = (Patrol)allpatrols[i]; if (newPatrol.patrolLocation.region.Equals(report.newIncident.incidentLocation.region)) { // if (0.00 <= report.time && report.time <= 12.00) //{ // if (newPatrol.newShift.shiftDescription.Equals("Morning")) // { foundpatrols.Add(newPatrol); // } } //else //{ // if (newPatrol.newShift.shiftDescription.Equals("Night")) //{ // foundpatrols.Add(newPatrol); //} //} } }
private void CheckPlayer() { Collider2D currentCollider = _colliders.Find(x => x.name.Equals("DetectionRange")); if (currentCollider) { if (!currentCollider.IsTouching(_playerCollider) || _playerManager.PlayerState == PlayerState.HIDING) { nextState = new Patrol(npc, anim, player, _rbody, goToPoints); stage = EVENT.EXIT; } } Collider2D biteCollider = _colliders.Find(x => x.name.Equals("BiteRange")); if (biteCollider) { if (biteCollider.IsTouching(_playerCollider) && _playerManager.PlayerState == PlayerState.RUNNING) { _playerManager.CallGameOver(); nextState = new Patrol(npc, anim, player, _rbody, goToPoints); stage = EVENT.EXIT; } } }
void Start () { patrol = GetComponent<Patrol> (); navAgent = GetComponent<NavMeshAgent> (); scout = GetComponent<ScoutMode> (); switchMode (); }
void Start() { rg = GetComponent <Rigidbody2D>(); perceptionComponent = GetComponentInChildren <Perception>(); patrol = GetComponent <Patrol>(); enemyFollow = GetComponent <EnemyFollow>(); }
private void Start() { prop = new MaterialPropertyBlock(); //coll2D = GetComponent<Collider2D>(); anim = GetComponent <Animator>(); patrol = GetComponent <Patrol>(); }
void Awake() { jump = GetComponent <Jump>(); patrol = GetComponent <Patrol>(); shape = GetComponent <ChipmunkShape>(); body = GetComponent <ChipmunkBody>(); }
void OnTriggerEnter2D(Collider2D coll) { string layer = LayerMask.LayerToName(coll.gameObject.layer); switch (layer) { case "Player": Patrol enemy = this.transform.parent.GetComponent <Patrol>(); enemy.enabled = false; i_see_you(); //see if icon has already been spawned if (enemy.icon != null) { break; } else { enemy.icon = enemy.spawn_icon(enemy.detected); enemy.icon.transform.parent = this.transform.parent; } break; default: break; } }
// Update is called once per frame void Update() { // update distance between player and enemy _playerEnemyDistance = _playerTransform.position.x - _transform.position.x; // update edge detection Vector2 detectOffset; detectOffset.x = edgeSafeDistance * _transform.localScale.x; detectOffset.y = 0; _reachEdge = checkGrounded(detectOffset) ? 0 : (_transform.localScale.x > 0 ? 1 : -1); // update state if (!_currentState.checkValid(this)) { if (_isChasing) { _currentState = new Patrol(); } else { _currentState = new Chase(); } _isChasing = !_isChasing; } if (_isMovable) { _currentState.Execute(this); } }
//生产一个新的巡逻兵 public Patrol getPatrol(int index) { Vector3 pos = new Vector3(initPos[index, 0], initPos[index, 1], initPos[index, 2]); Patrol patrol = new Patrol(index, pos); return(patrol); }
public void addPatrol(int id, List <Vector2> path, int spd, bool cycle) { Patrol temp = new Patrol(id, path, spd, cycle); patrols.Add(id, temp); entities[id].isPatrol = true; }
/// <summary> /// 状态机初始化 /// </summary> private void ConstructFSM() { //针对每一个行为进行初始化, 针对于每个行为进行状态到行为转变的添加 //巡逻 Patrol patrol = new Patrol(this); patrol.AddTransition(Transition.SawPlayer, FSMActionID.Chasing); patrol.AddTransition(Transition.NoHealth, FSMActionID.Dead); //追逐 Chase chase = new Chase(this); chase.AddTransition(Transition.ReachPalyer, FSMActionID.Attacking); chase.AddTransition(Transition.LostPlayer, FSMActionID.Patroling); chase.AddTransition(Transition.NoHealth, FSMActionID.Dead); //攻击 Attack attack = new Attack(this); attack.AddTransition(Transition.SawPlayer, FSMActionID.Chasing); attack.AddTransition(Transition.LostPlayer, FSMActionID.Patroling); attack.AddTransition(Transition.NoHealth, FSMActionID.Dead); //死亡 Dead dead = new Dead(this); dead.AddTransition(Transition.NoHealth, FSMActionID.Dead); //把状态列表进行初始化 AddFSMState(patrol); AddFSMState(chase); AddFSMState(attack); AddFSMState(dead); }
private void OnSceneGUI() { Patrol source = (Patrol)target; Handles.color = Color.blue; Handles.DrawLine(source.origin, source.destination); }
private IEnumerator MakeGame() { Camera.main.clearFlags = CameraClearFlags.Skybox; Camera.main.rect = new Rect(0f, 0f, 1f, 1f); maze = Instantiate(mazePrefab) as Maze; maze.gameController = this; yield return(StartCoroutine(maze.Generate())); player = Instantiate(playerPrefab) as Player; occupiedCoords.Add(maze.RandomCoord()); player.SetLocation(maze.GetCell(occupiedCoords[0])); patrolFactory = gameObject.GetComponent <PatrolFactory>(); patrols = new List <Patrol>(); for (int i = 0; i < 3; i++) { Patrol patrol = patrolFactory.Generate(maze); patrol.centerCoord = maze.RandomOtherCoord(occupiedCoords); //Debug.Log("patrol init coord: " + patrol.centerCoord); occupiedCoords.Add(patrol.centerCoord); patrol.SetLocation(maze.GetCell(patrol.centerCoord)); if (patrol.currentCell.room != player.currentCell.room) { patrol.gameObject.SetActive(false); } patrols.Add(patrol); } Camera.main.clearFlags = CameraClearFlags.Depth; Camera.main.rect = new Rect(0f, 0f, 0.5f, 0.5f); }
// Start is called before the first frame update void Start() { TimeBtwShots = StartTimeBtwShots; P = FindObjectOfType <Patrol>(); Rb = this.GetComponent <Rigidbody2D>(); Rb.bodyType = RigidbodyType2D.Dynamic; }
private void button1_Click_2(object sender, EventArgs e) { trackPatrol tp = new trackPatrol(); for (int i = 0; i < allpat.Count; i++) { pat1 = (Patrol)allpat[i]; String patrolFullName = pat1.name.Fname; if (patrolFullName == PatrolscomboBox1.SelectedItem.ToString()) { tp.Recieve(IncidentForm.newrep, pat1); if (pat1.patrolLocation.region == "Maadi") { RedP1pictureBox1.Visible = true; } else if (pat1.patrolLocation.region == "Mohandseen") { RedP2pictureBox2.Visible = true; } else if (pat1.patrolLocation.region == "Dokki") { RedP3pictureBox3.Visible = true; } } } }
private void CheckNewPathAttached(Patrol patrol, PATROL_TYPE type) { switch (type) { case (PATROL_TYPE.NEUTRAL): { if (old_neutral_path != patrol.path_attached) { rhandor.LoadNeutralPatrol(); old_neutral_path = patrol.path_attached; } break; } case (PATROL_TYPE.ALERT): { if (old_alert_path != patrol.path_attached) { rhandor.LoadAlertPatrol(); old_alert_path = patrol.path_attached; } break; } } }
private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("Person")) { people = other.GetComponentInParent <PatrolPeople>(); peopleInteract = other.GetComponentInParent <InteractBuy>(); people.stopPath(); if (peopleInteract.CanBuy) { isTalking = true; GameManager.instance.SetInteractText("Presiona 'E' para interactuar", true); } else { if (GameControl.instance.Charity) { GameManager.instance.SetInteractText("No tengo", true); } else { GameManager.instance.SetInteractText("No, gracias", true); } } } else if (other.gameObject.CompareTag("Enemy")) { enemy = other.GetComponentInParent <Patrol>(); if (enemy.canFollow) { enemyArrest = other.GetComponent <InteractArrest>(); openArrestDialog(); } } }
private void SubmitIncidentbutton1_Click(object sender, EventArgs e) { Complainant newcomp = new Complainant(); Name n1 = new Name((Lname.Text), (Fname.Text)); Address a1 = new Address(City.Text, Street.Text, int.Parse(ANumber.Text), int.Parse(BNumber.Text)); //db.Store(a1); Location L1 = new Location(int.Parse(Ycoordinate.Text), int.Parse(Xcoordinate.Text), Region.Text); ArrayList listOfPhoneNums = new ArrayList(); Shift s = new Shift(); listOfPhoneNums.Add(PhoneNumber1.Text); listOfPhoneNums.Add(PhoneNumber2.Text); if (comboBox4.SelectedItem.ToString().Equals("Morning shift - from 6:00 am to 6:00 pm")) { s = new Shift(1, "Morning", 6, 6, 12); } else { s = new Shift(2, "evening", 6, 6, 12); } Patrol patrol = new Patrol(L1, double.Parse(Salary.Text), int.Parse(BadgeNumber.Text), listOfPhoneNums, n1, int.Parse(ID.Text), a1, s); MessageBox.Show("Patrol Successfully Saved!"); Patrol Patrolinsert = new Patrol(); Patrolinsert.InsertPatrolData(patrol); }
// Use this for initialization void Start() { enemy = GetComponent<EnemyAttributes>(); player = GameObject.FindGameObjectWithTag("Player").transform; state = State.Patrol; patrol = GetComponent<Patrol>(); }
public static bool beginCollisionWithAny(ChipmunkArbiter arbiter) { ChipmunkShape shape1, shape2; // The order of the arguments matches the order in the function name. arbiter.GetShapes(out shape1, out shape2); // change direction of movement whenever hit something like a wall if (GameObjectTools.isWallHit(arbiter)) { Patrol p1 = shape1.GetComponent <Patrol>(); if (p1 != null && p1.enabled) { p1.toogleDir(); } Patrol p2 = shape2.GetComponent <Patrol>(); if (p2 != null && p2.enabled) { p2.toogleDir(); } } // Returning false from a begin callback means to ignore the collision response for these two colliding shapes // until they separate. Also for current frame. Ignore() does the same but next fixed step. return(true); }
private void Awake() { if (guardType == GuardType.PATROL_GUARD || guardType == GuardType.SCARED_PATROL_GUARD) { // Find the patrol script on this object patrol = GetComponent <Patrol>(); if (patrol == null) { Debug.Log("Patrol not found!"); } } // Find the AIDestinationSetter script on this object destination = GetComponent <AIDestinationSetter>(); if (destination == null) { Debug.Log("Destination not found!"); } // Find the player player = GameObject.FindGameObjectWithTag("Player").transform; if (player == null) { Debug.Log("Player not found!"); } }
void Start() { sprite = GetComponent <SpriteRenderer>(); animator = GetComponent <Animator>(); patrol = GetComponent <Patrol>(); takeDamage = GetComponent <TakeDamage>(); }
private void OnEnable() { list = new ReorderableList(serializedObject, serializedObject.FindProperty("waypoints"), true, true, true, true); patrolScript = (Patrol)target; //called for every element that has to be drawn in the ReorderableList list.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { SerializedProperty element = list.serializedProperty.GetArrayElementAtIndex(index); rect.y += 2; Rect r = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight); EditorGUI.PropertyField(r, element, GUIContent.none, false); }; list.onAddCallback = (ReorderableList l) => { var index = l.serializedProperty.arraySize; //make the array longer, and point the index at the new end l.serializedProperty.arraySize++; l.index = index; var element = l.serializedProperty.GetArrayElementAtIndex(index); int previousIndex = (index == 0) ? 0 : index - 1; //protection against a zero-length array element.vector2Value = l.serializedProperty.GetArrayElementAtIndex(previousIndex).vector2Value + Vector2.one; //create new point, slightly offset }; //draws the header of the ReorderableList list.drawHeaderCallback = (Rect rect) => { EditorGUI.LabelField(rect, "Stops"); }; }
private void Start() { p = father.GetComponent <Patrol>(); s = father.GetComponent <EnemyFollow>(); rb = father.GetComponent <Rigidbody2D>(); seeing = false; }
protected virtual void Start() { player = GameObject.Find("Hero"); rb2D = gameObject.GetComponent <Rigidbody2D>(); knockbackController = gameObject.GetComponent <KnockbackController>(); actualAttackCooldown = 0; // Debug.Log($"Start attacking distance {startAttackingStateDistance}, {endAttackingStateDistance}"); if (startAttackingStateDistance < 0) { startAttackingStateDistance = enemyConfig.defaultStartAttackingStateDistance; } if (endAttackingStateDistance < 0) { endAttackingStateDistance = enemyConfig.defaultEndAttackingStateDistance; } foreach (Transform child in transform) { if (child.GetComponent <Patrol>() != null) { patrol = child.GetComponent <Patrol>(); break; } } GetComponent <HealthController>().HealthUpdateEvent.AddListener(RecieveDamage); }
private void Awake() { attackList = GetComponent <AttackList>(); patrol = GetComponent <Patrol>(); hold = GetComponent <Hold>(); chase = GetComponent <Chase>(); }
// Use this for initialization public void Starta(GameObject plane, GameObject swamps, float nodeSize) { fixedDeadCollider = false; poi = Vector3.zero; health = 100.0f; seesPlayer = false; seesDeadPeople = false; hearsSomething = false; disturbed = false; reachGoal = GetComponent <ReachGoal> (); wander = GetComponent <Wander> (); standstill = GetComponent <StandStill> (); patrol = GetComponent <Patrol> (); gc = player.GetComponent <GoalControl> (); reachGoal.plane = plane; reachGoal.swamps = swamps; reachGoal.nodeSize = nodeSize; reachGoal.goalPos = poi; reachGoal.Starta(); wander.Starta(); patrol.Starta(); standstill.Starta(); anim = GetComponent <Animation> (); anim.CrossFade(idle); walkingSpeed = 10.0f; gunShot = this.GetComponents <AudioSource> ()[0]; lr = this.GetComponentInParent <LineRenderer> (); seenTime = 0f; // Debug.Log (transform.name); }
void Start() { takeDamage = GetComponent <TakeDamage>(); animator = GetComponent <Animator>(); patrol = GetComponent <Patrol>(); readyAttackTime = startReadyAttackTime; }
// Start is called before the first frame update void Start() { alertScript = GetComponent <Alert>(); patrolScript = GetComponent <Patrol>(); mover = GetComponent <CharacterMove>(); lgth = transform.Find("Point Light 2D"); }
public void DeleteCompetitionAndCascade() { using (var databaseSession = NHibernateHelper.OpenSession()) { var patrols = (from patrol in databaseSession.Query<Patrol>() where patrol.Competition == this.testCompetition select patrol).ToArray(); Assert.IsNotNull(patrols); Assert.AreEqual(0, patrols.Count()); var toAdd = new Patrol { Competition = this.testCompetition, PatrolId = 1, StartTime = DateTime.Now, StartTimeDisplay = DateTime.Now, PatrolClass = PatrolClassEnum.A }; using (var transaction = databaseSession.BeginTransaction()) { databaseSession.Save(toAdd); transaction.Commit(); } } using (var databaseSession = NHibernateHelper.OpenSession()) { var patrols = (from patrol in databaseSession.Query<Patrol>() where patrol.Competition == this.testCompetition select patrol).ToArray(); Assert.IsNotNull(patrols); Assert.AreEqual(1, patrols.Count()); using (var transaction = databaseSession.BeginTransaction()) { databaseSession.Delete(this.testCompetition); transaction.Commit(); } patrols = (from patrol in databaseSession.Query<Patrol>() where patrol.Competition == this.testCompetition select patrol).ToArray(); Assert.IsNotNull(patrols); Assert.AreEqual(0, patrols.Count()); } }
// Use this for initialization public void Starta(GameObject plane, float nodeSize, Vector3 sP) { fixedDeadCollider = false; poi = Vector3.zero; health = 100.0f; seesPlayer = false; lastSeen = Vector3.zero; lastSeenForward = Vector3.zero; seesDeadPeople = false; hearsSomething = false; disturbed = false; isDead = false; addToDeadSet = false; takingCover = false; coverSpot = Vector3.zero; reachedCover = false; sniperPosKnown = false; sniperPos = sP; isGoaling = false; isGoingToSeenPlayerPos = false; isGoingToCover = false; dirSearchCountDown = 0.0f; reachGoal = GetComponent<ReachGoal> (); wander = GetComponent<Wander> (); standstill = GetComponent<StandStill> (); patrol = GetComponent<Patrol> (); gc = player.GetComponent<GoalControl> (); reachGoal.plane = plane; reachGoal.nodeSize = nodeSize; reachGoal.goalPos = poi; reachGoal.sniperPos = sniperPos; reachGoal.Starta (); wander.Starta (); patrol.Starta (); standstill.Starta (); takeCover = new TakeCover (reachGoal.state.sGrid.hiddenSpaceCost, reachGoal.state.sGrid.grid, reachGoal.state.sGrid.spaceCostScalars); anim = GetComponent<Animation> (); anim.CrossFade (idle); walkingSpeed = 10.0f; gunShot = this.GetComponents<AudioSource> ()[0]; lr = this.GetComponentInParent<LineRenderer> (); seenTime = 0f; alertLevel = 0; maxAlertLevel = 3; needsToRaiseAlertLevel = false; isReloading = false; isShooting = false; ammoCount = 0; // Debug.Log (transform.name); }
void Start() { patrolScript = gameObject.GetComponent<Patrol>(); sound = GameObject.Find("SoundManager").GetComponent<SoundManager>(); }
// Use this for initialization public void Starta(GameObject plane, GameObject swamps, float nodeSize) { fixedDeadCollider = false; poi = Vector3.zero; health = 100.0f; seesPlayer = false; seesDeadPeople = false; hearsSomething = false; disturbed = false; reachGoal = GetComponent<ReachGoal> (); wander = GetComponent<Wander> (); standstill = GetComponent<StandStill> (); patrol = GetComponent<Patrol> (); gc = player.GetComponent<GoalControl> (); reachGoal.plane = plane; reachGoal.swamps = swamps; reachGoal.nodeSize = nodeSize; reachGoal.goalPos = poi; reachGoal.Starta (); wander.Starta (); patrol.Starta (); standstill.Starta (); anim = GetComponent<Animation> (); anim.CrossFade (idle); walkingSpeed = 10.0f; gunShot = this.GetComponents<AudioSource> ()[0]; lr = this.GetComponentInParent<LineRenderer> (); seenTime = 0f; // Debug.Log (transform.name); }
public virtual void Awake() { patrolScript = gameObject.GetComponent<Patrol>(); agent = gameObject.GetComponent<NavMeshAgent>(); if (agent == null) Debug.LogError("Add a nav mesh agent to " + gameObject.name); mySoliderScript = gameObject.GetComponent<Soldier>(); //healthScript = Target.GetComponent<Health>(); myHealth = gameObject.GetComponent<Health>(); }
void Awake() { areaOfAwareness = GetComponent<SphereCollider> (); patrolScript = GetComponent<Patrol> (); doctorMusic = GetComponent<AudioSource> (); }
public void Setup() { var sqlDatabaseMigrator = new SqlDatabaseMigrator(); sqlDatabaseMigrator.MigrateToLatest(ConfigurationManager.ConnectionStrings["WinShooterConnection"].ConnectionString); using (var databaseSession = NHibernateHelper.OpenSession()) { // Make sure there is a test competition this.testCompetition = (from competition in databaseSession.Query<Competition>() where competition.Name == CompetitionName select competition).FirstOrDefault(); if (this.testCompetition == null) { // No test competition found this.testCompetition = new Competition { CompetitionType = CompetitionType.Field, Name = CompetitionName, StartDate = DateTime.Now }; using (var transaction = databaseSession.BeginTransaction()) { databaseSession.Save(this.testCompetition); transaction.Commit(); } } // Make sure there is a test club this.testClub = (from club in databaseSession.Query<Club>() where club.Name == ClubName select club).FirstOrDefault(); if (this.testClub == null) { // No test club found this.testClub = new Club { ClubId = "1-123", Country = "SE", Name = ClubName }; using (var transaction = databaseSession.BeginTransaction()) { databaseSession.Save(this.testClub); transaction.Commit(); } } // Make sure there is a test station this.testStation = (from station in databaseSession.Query<Station>() where station.Competition == this.testCompetition select station).FirstOrDefault(); if (this.testStation == null) { // No test club found this.testStation = new Station { Competition = this.testCompetition, Distinguish = false, NumberOfShots = 6, NumberOfTargets = 6, Points = true, StationNumber = 1 }; using (var transaction = databaseSession.BeginTransaction()) { databaseSession.Save(this.testStation); transaction.Commit(); } } // Make sure there is a test weapon this.testWeapon = (from weapon in databaseSession.Query<Weapon>() where weapon.Manufacturer == WeaponManufacturer select weapon).FirstOrDefault(); if (this.testWeapon == null) { // No test weapon found this.testWeapon = new Weapon { Caliber = WeaponManufacturer, Class = WeaponClassEnum.A1, LastUpdated = DateTime.Now, Manufacturer = WeaponManufacturer, Model = WeaponManufacturer }; using (var transaction = databaseSession.BeginTransaction()) { databaseSession.Save(this.testWeapon); transaction.Commit(); } } // Make sure there is a test patrol this.testPatrol = (from patrol in databaseSession.Query<Patrol>() where patrol.Competition == this.testCompetition select patrol).FirstOrDefault(); if (this.testPatrol == null) { this.testPatrol = new Patrol { Competition = this.testCompetition, PatrolClass = PatrolClassEnum.A, PatrolId = 1, StartTime = DateTime.Now, StartTimeDisplay = DateTime.Now }; using (var transaction = databaseSession.BeginTransaction()) { databaseSession.Save(this.testPatrol); transaction.Commit(); } } // Make sure there is a test shooter this.testShooter = (from shooter in databaseSession.Query<Shooter>() where shooter.Competition == this.testCompetition && shooter.Surname == ShooterSurname && shooter.Givenname == ShooterGivenname select shooter).FirstOrDefault(); if (this.testShooter == null) { this.testShooter = new Shooter { Competition = this.testCompetition, CardNumber = "123", Class = ShootersClassEnum.Klass1, Club = this.testClub, Email = string.Empty, Givenname = ShooterGivenname, Surname = ShooterSurname, HasArrived = true, LastUpdated = DateTime.Now }; using (var transaction = databaseSession.BeginTransaction()) { databaseSession.Save(this.testShooter); transaction.Commit(); } } // Make sure there is a competitor this.testCompetitor = (from competitor in databaseSession.Query<Competitor>() where competitor.Competition == this.testCompetition select competitor).FirstOrDefault(); if (this.testCompetitor == null) { // No test competitor found this.testCompetitor = new Competitor { Competition = this.testCompetition, FinalShootingPlace = 100, Patrol = this.testPatrol, PatrolLane = 1, Shooter = this.testShooter, ShooterClass = ShootersClassEnum.Klass1, Weapon = this.testWeapon }; using (var transaction = databaseSession.BeginTransaction()) { databaseSession.Save(this.testCompetitor); transaction.Commit(); } } // Clear out the current competitor results var competitors = from competitor in databaseSession.Query<CompetitorResult>() where competitor.Competitor == this.testCompetitor select competitor; using (var transaction = databaseSession.BeginTransaction()) { foreach (var competitor in competitors) { databaseSession.Delete(competitor); } transaction.Commit(); } } }