Class ProvinceCenterLookup
Utility for converting province IDs to world positions. Calculates center from province pixel data and converts to world space. Caches results for performance.
public class ProvinceCenterLookup
- Inheritance
-
objectProvinceCenterLookup
Properties
IsInitialized
public bool IsInitialized { get; }
Property Value
- bool
Methods
ClearCache()
Clear the cache (useful if map is reloaded)
public void ClearCache()
GetCacheSize()
Get number of cached province centers
public int GetCacheSize()
Returns
- int
GetProvincePixelCount(ushort)
Get province area in pixels (for dynamic text sizing)
public int GetProvincePixelCount(ushort provinceID)
Parameters
provinceIDushort
Returns
- int
Initialize(ProvinceMapping, Transform, int, int)
Initialize the lookup system with map references
public void Initialize(ProvinceMapping mapping, Transform meshTransform, int texWidth, int texHeight)
Parameters
mappingProvinceMappingmeshTransformTransformtexWidthinttexHeightint
TryGetProvinceCenter(ushort, out Vector3)
Get world position for province center. Returns cached value if available, otherwise calculates and caches.
public bool TryGetProvinceCenter(ushort provinceID, out Vector3 worldPosition)
Parameters
provinceIDushortworldPositionVector3
Returns
- bool