Table of Contents

Class CastleTerritorySystem

Namespace
RisingV.Core.Systems
Assembly
RisingV.Core.CastleEngine.dll

System that maps world positions to castle territories and provides lookup utilities.

public class CastleTerritorySystem : System, ISystem, IManageableLifecycle<SystemManager>, IManageableLifecycle, IReloadable, IManageable<SystemManager>, IManageable
Inheritance
CastleTerritorySystem
Implements
Inherited Members
Extension Methods

Constructors

CastleTerritorySystem()

public CastleTerritorySystem()

Methods

ConvertPosToBlockCoord(float3)

Converts a world position to discrete block coordinates.

public static int2 ConvertPosToBlockCoord(float3 pos)

Parameters

pos float3

World-space position.

Returns

int2

Block coordinate as an Unity.Mathematics.int2.

ConvertPosToGrid(float3)

Transforms a world position into the grid system used by castle territories.

public static float3 ConvertPosToGrid(float3 pos)

Parameters

pos float3

World-space position.

Returns

float3

Position shifted and floored for grid alignment.

GetHeartForTerritory(int)

Finds the CastleHeart entity that corresponds to a given territory index.

public static Entity GetHeartForTerritory(int territoryIndex)

Parameters

territoryIndex int

Index of the territory.

Returns

Entity

The CastleHeart entity, or Unity.Entities.Entity.Null if not found.

GetTerritoryIndex(float3)

Retrieves the territory index for a world position.

public static int GetTerritoryIndex(float3 pos)

Parameters

pos float3

World-space position.

Returns

int

The territory index, or –1 if none.

Load(SystemManager, List<IPlugin>)

Loads all ProjectM.CastleBuilding.CastleTerritory entities, builds lookup dictionaries, and must be called during system initialization.

public override void Load(SystemManager manager, List<IPlugin> plugins)

Parameters

manager SystemManager

The system manager hosting this system.

plugins List<IPlugin>

List of loaded plugins.

TryGetCastleTerritory(Entity, out Entity)

Attempts to find the territory entity containing the given entity based on its position.

public bool TryGetCastleTerritory(Entity entity, out Entity territoryEntity)

Parameters

entity Entity

An entity which must have a Unity.Transforms.Translation component.

territoryEntity Entity

The found territory entity, or Unity.Entities.Entity.Null if none.

Returns

bool

True if a territory was found for the entity’s position.