Skip to main content

BoundsPopulationItem

A class in Root.Township, Alta.Populations.

Population member that leaves its population once it moves outside its chunk's buffer bounds, then gets chunked normally and stops being saved.

Constructors​

MemberWhat it is
BoundsPopulationItem()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

MemberWhat it is
static readonly UpdateModule distanceCheckUpdateModuleBudgeted update module shared by all items of this type for the distance check.
4 private and internal fields
MemberWhat it is
private Bounds chunkBoundsThe buffer bounds of the population's chunk, set in Initialize.
private ChunkDetector detectorThe entity's chunk detector, off while this item is tracked.
private bool isInitializedTrue after Initialize; the check does nothing before.
private IUnityUpdateMethod updateHandle for the registered distance check.

Methods​

MemberWhat it is
override void Initialize()Server: marks the item ready and stores its chunk's buffer bounds.
3 private and internal methods
MemberWhat it is
private void CheckInsideBounds()If the item is outside the chunk bounds, 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.