A class in Root.Township, Alta.Populations.
Population member that leaves its population once it moves past the definition's disconnect radius, then gets chunked normally and stops being saved.
Constructors
| Member | What it is |
|---|
RadialPopulationItem() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|
static readonly UpdateModule distanceCheckUpdateModule | Budgeted update module shared by all items of this type for the distance check. |
5 private and internal fields
| Member | What it is |
|---|
private Vector3 center | Position of the population's parent, set in Initialize. |
private ChunkDetector detector | The entity's chunk detector, off while this item is tracked. |
private bool isInitialized | True after Initialize; the check does nothing before. |
private float radiusSquared | The definition's disconnect radius, squared. |
private IUnityUpdateMethod update | Handle for the registered distance check. |
Methods
| Member | What it is |
|---|
override void Initialize() | Server: marks the item ready and stores the parent's position and the squared disconnect radius. |
3 private and internal methods
| Member | What it is |
|---|
private void CheckRadius() | If the item is past the disconnect radius, removes it from the population, moves it to the best chunk for its position and sets its save mode to Ignore. |
private void OnDisable() | Stops the check, turns the chunk detector back on and recalculates the entity's chunk. |
private void OnEnable() | Turns off the entity's ChunkDetector and registers the distance check with a budgeted update. |