# Class: SortedSubIteratingSystem
Imagine a SortedIteratingSystem that you can add SubSystems to. For each entity being processed, all SubSystems that match the entities family will be called in the order they have been added. An example use-case would be to do multiple render steps for each entity, while entities are ordered by a z-index.
# Hierarchy
-
↳
SortedSubIteratingSystem
# Table of contents
# Constructors
# Properties
# Methods
- forceSort
- getEntities
- getPriority
- isEnabled
- onDisable
- onEnable
- processEntity
- setComparator
- setEnabled
- setPriority
- update
# Constructors
# constructor
• new SortedSubIteratingSystem(family
, comparator
)
# Parameters
Name | Type | Description |
---|---|---|
family | Family | The family of entities iterated over in this system. |
comparator | EntityComparator | The comparator to sort the entities. |
# Inherited from
SortedIteratingSystem.constructor
# Defined in
src/systems/SortedIteratingSystem.ts:37 (opens new window)
# Properties
# engine
• Readonly
engine: Engine
The engine of this system.
# Inherited from
# Defined in
src/core/AbstractSystem.ts:14 (opens new window)
# family
• Readonly
family: Family
The Family used when the system was created.
# Inherited from
# Defined in
src/systems/SortedIteratingSystem.ts:23 (opens new window)
# subSystems
• Readonly
subSystems: SubSystemManager
# Defined in
src/systems/SortedSubIteratingSystem.ts:15 (opens new window)
# Methods
# forceSort
▸ forceSort(): void
Call this if the sorting criteria have changed. The actual sorting will be delayed until the entities are processed.
# Returns
void
# Inherited from
SortedIteratingSystem.forceSort
# Defined in
src/systems/SortedIteratingSystem.ts:57 (opens new window)
# getEntities
▸ getEntities(): Entity
[]
# Returns
Entity
[]
The set of entities processed by the system.
# Inherited from
SortedIteratingSystem.getEntities
# Defined in
src/systems/SortedIteratingSystem.ts:104 (opens new window)
# getPriority
▸ getPriority(): number
# Returns
number
The priority of the system. Do not override this!
# Inherited from
SortedIteratingSystem.getPriority
# Defined in
src/core/AbstractSystem.ts:75 (opens new window)
# isEnabled
▸ isEnabled(): boolean
# Returns
boolean
True if the system is enabled.
# Inherited from
SortedIteratingSystem.isEnabled
# Defined in
src/core/AbstractSystem.ts:57 (opens new window)
# onDisable
▸ Protected
onDisable(): void
Called in two situations:
- When the system is enabled and currently being removed from the manager
- When the system is already added to the manager and is currently being disabled.
# Returns
void
# Inherited from
SortedIteratingSystem.onDisable
# Defined in
src/systems/SortedIteratingSystem.ts:88 (opens new window)
# onEnable
▸ Protected
onEnable(): void
Called in two situations:
- When the system is enabled and currently being added to the manager
- When the system is already added to the manager and is currently being enabled.
# Returns
void
# Inherited from
SortedIteratingSystem.onEnable
# Defined in
src/systems/SortedIteratingSystem.ts:82 (opens new window)
# processEntity
▸ processEntity(entity
, deltaTime
): void
This method is called on every entity on every update call of the EntitySystem. Override this to implement your system's specific processing.
# Parameters
Name | Type |
---|---|
entity | Entity |
deltaTime | number |
# Returns
void
# Overrides
SortedIteratingSystem.processEntity
# Defined in
src/systems/SortedSubIteratingSystem.ts:17 (opens new window)
# setComparator
▸ setComparator(comparator
): void
Update the comparator to sort the entities. Implicitly calls forceSort.
# Parameters
Name | Type | Description |
---|---|---|
comparator | EntityComparator | The comparator to sort the entities. |
# Returns
void
# Inherited from
SortedIteratingSystem.setComparator
# Defined in
src/systems/SortedIteratingSystem.ts:48 (opens new window)
# setEnabled
▸ setEnabled(enabled
): void
Enable or disable the system. A disabled system will not be processed during an update.
# Parameters
Name | Type | Description |
---|---|---|
enabled | boolean | The new state. |
# Returns
void
# Inherited from
SortedIteratingSystem.setEnabled
# Defined in
src/core/AbstractSystem.ts:43 (opens new window)
# setPriority
▸ setPriority(priority
): void
Set the system priority. You can set the priority with when adding the system as well.
# Parameters
Name | Type | Description |
---|---|---|
priority | number | The priority to execute this system with (lower means higher priority). |
# Returns
void
# Inherited from
SortedIteratingSystem.setPriority
# Defined in
src/core/AbstractSystem.ts:66 (opens new window)
# update
▸ update(deltaTime
): void
The update method called every tick.
# Parameters
Name | Type |
---|---|
deltaTime | number |
# Returns
void
# Overrides
# Defined in
src/systems/SortedSubIteratingSystem.ts:25 (opens new window)