<commit_before>using System.Collections.Generic;


namespace Nez
{
	/// <summary>
	/// helper class used by the Movers to manage trigger colliders interactions and calling ITriggerListeners.
	/// </summary>
	public class ColliderTriggerHelper
	{
		Entity _entity;

		/// <summary>
		/// stores all the active intersection pairs that occured in the current frame
		/// </summary>
		HashSet<Pair<Collider>> _activeTriggerIntersections = new HashSet<Pair<Collider>>();

		/// <summary>
		/// stores the previous frames intersection pairs so that we can detect exits after moving this frame
		/// </summary>
		HashSet<Pair<Collider>> _previousTriggerIntersections = new HashSet<Pair<Collider>>();

		List<ITriggerListener> _tempTriggerList = new List<ITriggerListener>();


		public ColliderTriggerHelper(Entity entity)
		{
			_entity = entity;
		}


		/// <summary>
		/// update should be called AFTER Entity is moved. It will take care of any ITriggerListeners that the Collider overlaps.
		/// </summary>
		public void Update()
		{
			// 3. do an overlap check of all entity.colliders that are triggers with all broadphase colliders, triggers or not.
			//    Any overlaps result in trigger events.
			var colliders = _entity.GetComponents<Collider>();
			for (var i = 0; i < colliders.Count; i++)
			{
				var collider = colliders[i];

				// fetch anything that we might collide with us at our new position
				var neighbors = Physics.BoxcastBroadphase(collider.Bounds, collider.CollidesWithLayers);
				foreach (var neighbor in neighbors)
				{
					// we need at least one of the colliders to be a trigger
					if (!collider.IsTrigger && !neighbor.IsTrigger)
						continue;

					if (collider.Overlaps(neighbor))
					{
						var pair = new Pair<Collider>(collider, neighbor);

						// if we already have this pair in one of our sets (the previous or current trigger intersections) dont call the enter event
						var shouldReportTriggerEvent = !_activeTriggerIntersections.Contains(pair) &&
						                               !_previousTriggerIntersections.Contains(pair);<commit_msg>Disabled colliders no longer check for triggers<commit_after>using System.Collections.Generic;


namespace Nez
{
	/// <summary>
	/// helper class used by the Movers to manage trigger colliders interactions and calling ITriggerListeners.
	/// </summary>
	public class ColliderTriggerHelper
	{
		Entity _entity;

		/// <summary>
		/// stores all the active intersection pairs that occured in the current frame
		/// </summary>
		HashSet<Pair<Collider>> _activeTriggerIntersections = new HashSet<Pair<Collider>>();

		/// <summary>
		/// stores the previous frames intersection pairs so that we can detect exits after moving this frame
		/// </summary>
		HashSet<Pair<Collider>> _previousTriggerIntersections = new HashSet<Pair<Collider>>();

		List<ITriggerListener> _tempTriggerList = new List<ITriggerListener>();


		public ColliderTriggerHelper(Entity entity)
		{
			_entity = entity;
		}


		/// <summary>
		/// update should be called AFTER Entity is moved. It will take care of any ITriggerListeners that the Collider overlaps.
		/// </summary>
		public void Update()
		{
			// 3. do an overlap check of all entity.colliders that are triggers with all broadphase colliders, triggers or not.
			//    Any overlaps result in trigger events.
			var colliders = _entity.GetComponents<Collider>();
			for (var i = 0; i < colliders.Count; i++)
			{
				var collider = colliders[i];
				if(!collider.Enabled)
					continue;

				// fetch anything that we might collide with us at our new position
				var neighbors = Physics.BoxcastBroadphase(collider.Bounds, collider.CollidesWithLayers);
				foreach (var neighbor in neighbors)
				{
					// we need at least one of the colliders to be a trigger
					if (!collider.IsTrigger && !neighbor.IsTrigger)
						continue;

					if (collider.Overlaps(neighbor))
					{
						var pair = new Pair<Collider>(collider, neighbor);

						// if we already have this pair in one of our sets (the previous or current trigger intersections) dont call the enter event
						var shouldReportTriggerEvent = !_activeTriggerIntersections.Contains(pair) &&
						                               !_previousTriggerIntersections.Contains(pair);
{'fraction_non_alphanumeric': 0.09133599436487438, 'fraction_numerical': 0.0009391876027236441, 'mean_word_length': 3.2986881937436934, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2549255', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1128, 'n_words': 417}