public abstract class HierarchyOrganizer : MonoBehaviour
Provides a base implementation for Hierarchy Organizers, which are responsible for
organizing the chunks of
Worlds into manageable hierarchies.
If using multiple Worlds at the same time, each
World must use a different instance of the Hierarchy Organizer!
Name | Type | Description |
---|---|---|
MinChunksToAddPerFrame | int |
The minimum number of chunks that will be added to the hierarchy in a single frame. Once this number is reached, SAM will query the World's Execution Controller via ShouldContinueExecuting to see if another Add Chunk cycle should be run, or if the add chunk process should yield for a frame. |
MinChunksToRemovePerFrame | int |
The minimum number of chunks that will be removed from the hierarchy in a single frame. Once this number is reached, SAM will query the World's Execution Controller via ShouldContinueExecuting to see if another Remove Chunk cycle should be run, or if the remove chunk process should yield for a frame. |
TransformHandler | ISelfCreatingNewObjectHandler<Transform> |
Gets the transform handler associated with the Hierarchy Organizer. |
World | World |
Gets the world associated with the Hierarchy Organizer |
public abstract void AddChunkToHierarchy(GameObject chunk, WorldCell worldCellChunkBelongsTo)
Adds a chunk (game object) to the organized hierarchy.
Name | Type | Description |
---|---|---|
chunk | GameObject |
The chunk (game object) to add to the organized hierarchy. |
worldCellChunkBelongsTo | WorldCell |
The World Cell the chunk belongs to. You can use information from the World Cell to help organize the object into the hierarchy. |
public bool DoesLODChunkIsPartOfUtilizeChunking(WorldCell worldCellThatChunkBelongsTo)
Convenience method for determining whether the LOD that the chunk is associated with utilizes chunking.
Name | Type | Description |
---|---|---|
worldCellThatChunkBelongsTo | WorldCell |
The World Cell that the object belongs to. |
public string GetLODGroupName(WorldCell worldCellThatChunkBelongsTo)
Convenience method for getting the Group Name of a chunk. You could do the same thing yourself manually, but it is easier to just use this method.
Name | Type | Description |
---|---|---|
worldCellThatChunkBelongsTo | WorldCell |
The World Cell that the object belongs to. |
public abstract void Initialize(World world, ISelfCreatingNewObjectHandler<Transform> transformHandler)
Initializes the hierarchy organizer. Each world should have a separate organizer object. This method needs to be called before any other methods are called on the organizer. You can access the World and Transform Handler's passed into this method from your derived classes via the same named properties. Note that when used with a World, this method is called automatically by the World, so you don't need to call it yourself.
Name | Type | Description |
---|---|---|
world | World |
The world whose chunks will be organized. |
transformHandler | ISelfCreatingNewObjectHandler<Transform> |
A handler object which controls the retrieval of Transforms. These transforms are used as empty game object parents to children for organizational purposes. |
public virtual void InitializeAdditional()
Override in your derived class to perform additional initialization.
public bool IsWorldGroupingChunkIsOn3D(WorldCell worldCellThatChunkBelongsTo)
Convenience method for determining whether the World Grouping that a chunk is on is 3D.
Name | Type | Description |
---|---|---|
worldCellThatChunkBelongsTo | WorldCell |
The World Cell that the object belongs to. |
public abstract void RemoveChunkFromHierarchy(GameObject chunk, WorldCell worldCellChunkBelongsTo)
Removes a chunk (game object) from the organized hierarchy.
Name | Type | Description |
---|---|---|
chunk | GameObject |
The chunk (game object) to remove from the organized hierarchy. |
worldCellChunkBelongsTo | WorldCell |
The World Cell the chunk belongs to. |