// MIT License - Copyright (c) 2025 wallstop
// Full license text: https://github.com/wallstop/unity-helpers/blob/main/LICENSE
namespace WallstopStudios.UnityHelpers.Core.DataStructure
{
using System;
using System.Collections.Generic;
using UnityEngine;
///
/// Disposable abstraction for 2D spatial hashes so DI/factory consumers can enforce lease cleanup.
///
/// Stored element type.
public interface ISpatialHash2D : IDisposable
{
float CellSize { get; }
int CellCount { get; }
void Insert(Vector2 position, T item);
bool Remove(Vector2 position, T item);
List Query(
Vector2 position,
float radius,
List results,
bool distinct = true,
bool exactDistance = true
);
List QueryRect(Rect rect, List results, bool distinct = true);
void Clear();
}
}