Class CastleTerritoryService
Service for managing castle territory-related (plot) operations and queries.
public class CastleTerritoryService
- Inheritance
-
CastleTerritoryService
- Inherited Members
Constructors
CastleTerritoryService()
Initializes a new instance of the CastleTerritoryService class. Loads and maps all castle territories and their blocks.
public CastleTerritoryService()
Methods
ConvertPosToBlockCoord(float3)
Converts a world position to a block coordinate.
public static int2 ConvertPosToBlockCoord(float3 pos)
Parameters
pos
float3The world position to convert.
Returns
- int2
The block coordinate as an int2.
ConvertPosToGrid(float3)
Converts a world position to a grid position.
public static float3 ConvertPosToGrid(float3 pos)
Parameters
pos
float3The world position to convert.
Returns
- float3
The grid position.
GetHeartForTerritory(int)
Gets the castle heart entity for a given territory index.
public static Entity GetHeartForTerritory(int territoryIndex)
Parameters
territoryIndex
intThe territory index to search for.
Returns
- Entity
The castle heart entity if found, Entity.Null otherwise.
GetTerritoryIndex(float3)
Gets the territory index for a given position.
public static int GetTerritoryIndex(float3 pos)
Parameters
pos
float3The position to check.
Returns
- int
The territory index if found, -1 otherwise.
TryGetCastleTerritory(Entity, out Entity)
Attempts to get the castle territory entity for a given entity based on its position.
public static bool TryGetCastleTerritory(Entity entity, out Entity territoryEntity)
Parameters
entity
EntityThe entity to check.
territoryEntity
EntityThe output territory entity if found.
Returns
- bool
True if a territory was found for the entity, false otherwise.