Class UniformCostCalculator
Default cost calculator - all provinces cost 1. Use when no terrain or ownership modifiers needed.
public class UniformCostCalculator : IMovementCostCalculator
- Inheritance
-
objectUniformCostCalculator
- Implements
Fields
Instance
public static readonly UniformCostCalculator Instance
Field Value
Methods
CanTraverse(ushort, PathContext)
Check if a province can be traversed at all. Called before GetMovementCost - return false to skip entirely.
public bool CanTraverse(ushort provinceId, PathContext context)
Parameters
provinceIdushortcontextPathContext
Returns
- bool
GetHeuristic(ushort, ushort)
Get heuristic estimate from province to goal (for A*). Must be admissible (never overestimate actual cost). Default: return FixedPoint64.One (safe but slow). Better: return distance-based estimate if coordinates available.
public FixedPoint64 GetHeuristic(ushort fromProvinceId, ushort goalProvinceId)
Parameters
fromProvinceIdushortgoalProvinceIdushort
Returns
GetMovementCost(ushort, ushort, PathContext)
Get movement cost from one province to an adjacent province. Higher cost = less desirable path. Return FixedPoint64.MaxValue to indicate impassable.
public FixedPoint64 GetMovementCost(ushort fromProvinceId, ushort toProvinceId, PathContext context)
Parameters
fromProvinceIdushortSource province
toProvinceIdushortDestination province (adjacent to source)
contextPathContextOptional context (unit owner, unit type, etc.)