This commit is contained in:
vis2k 2022-09-17 16:09:40 +08:00
parent dac82ed1e2
commit 34e6e8fbd3

View File

@ -16,10 +16,11 @@ public class Grid2D<T>
// => makes the code a lot easier too
// => this is FINE because in the worst case, every grid position in the
// game world is filled with a player anyway!
Dictionary<Vector2Int, HashSet<T>> grid = new Dictionary<Vector2Int, HashSet<T>>();
readonly Dictionary<Vector2Int, HashSet<T>> grid =
new Dictionary<Vector2Int, HashSet<T>>();
// cache a 9 neighbor grid of vector2 offsets so we can use them more easily
Vector2Int[] neighbourOffsets =
readonly Vector2Int[] neighbourOffsets =
{
Vector2Int.up,
Vector2Int.up + Vector2Int.left,