Table of Contents

Class ProvinceCenterLookup

Namespace
Map.Utils
Assembly
MapAssembly.dll

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
object
ProvinceCenterLookup

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

provinceID ushort

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

mapping ProvinceMapping
meshTransform Transform
texWidth int
texHeight int

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

provinceID ushort
worldPosition Vector3

Returns

bool