Skip to content

Instantly share code, notes, and snippets.

@wallstop
Created June 13, 2025 16:08
Show Gist options
  • Save wallstop/fed0412a9488ac72fe9692f33d5a9b69 to your computer and use it in GitHub Desktop.
Save wallstop/fed0412a9488ac72fe9692f33d5a9b69 to your computer and use it in GitHub Desktop.
Hex - IGridManager
namespace World
{
using System.Collections.Generic;
using Core.DataStructure.Adapters;
using Core.Helper;
using Metadata;
using Tiles;
using Unity.Collections;
using UnityEngine;
using UnityEngine.Tilemaps;
public interface IGridManager
{
const string Tag = "GridManager";
List<Dictionary<TilemapType, Tilemap>> Tilemaps { get; }
bool useFixedWorldSize { get; set; }
Vector3Int worldSize { get; set; }
IReadOnlyCollection<int> IslandIds { get; }
NativeParallelHashSet<FastVector3Int> WorldBlockedPositionsCopy { get; }
NativeParallelHashMap<FastVector3Int, int> GameObjectBlockedPositions { get; }
IReadOnlyCollection<BoundsInt> Islands { get; }
List<Dictionary<TilemapType, Dictionary<FastVector3Int, List<GameObject>>>> tilemapGameObjects { get; set; }
bool IsPositionInGrid(FastVector3Int gridLocation);
bool IsPositionBlocked(FastVector3Int gridLocation);
bool TryPlaceTileIgnoreBoundsCheck(ITilemapTile tile, Vector3Int gridLocation);
bool TryGetBoundsForCell(Vector3Int start, out BoundsInt boundsInt, int elevation = 0);
bool TryPlacePrefab(GameObject tilePrefab, FastVector3Int position, out GameObject gameObject);
void RegisterSetPieceObjects(int i, List<GameObject> setPieceGameObjects);
bool TryPlaceTilemapTile(ITilemapTile tileTile, FastVector3Int worldPosition, bool force, bool ignoreBoundsCheck = false);
Vector3 GridToWorld(FastVector3Int setPieceOrigin);
bool TryGetIslandForCell(Vector3Int origin, out int i, int elevation = 0);
void SetNewTilemaps(List<Dictionary<TilemapType, Tilemap>> tilemaps);
Grid GetGrid();
List<GameObject> GetObjectsAtPosition(FastVector3Int position);
bool TryRemoveGameObject(GameObject kvpValue, FastVector3Int? kvpKey = null);
bool TryPlaceTile(Object tile, FastVector3Int position);
FastVector3Int WorldToGrid(Vector3 transformPosition, int getElevation);
bool TryPlaceGameObjectInstance(GameObject gameObject, FastVector3Int origin);
Vector2 GridToWorld2D(FastVector3Int key);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment