ComponentSet

class ComponentSet : Collection<Component>

A set of stored components. The set represents all the components stored on an Entity. Each Entity can hold only one Component of any given type.

Properties

Link copied to clipboard
open override val size: Int

Functions

Link copied to clipboard
@MainThread
fun clear()

Clears all components in the component set.

Link copied to clipboard
@MainThread
open operator override fun contains(element: Component): Boolean
Link copied to clipboard
@MainThread
open override fun containsAll(elements: Collection<Component>): Boolean
Link copied to clipboard
inline fun <T : Component> get(): T?

Gets the component of the specific type.

@MainThread
operator fun <T : Component> get(componentType: Class<T>): T?

Gets the component of a specific type.

Link copied to clipboard
inline fun <T : Component> has(): Boolean

Check if the componentSet contains a component of a specific type.

@MainThread
fun <T : Component> has(componentType: Class<T>): Boolean

Checks if the component set contains the component of the specified type.

Link copied to clipboard
@MainThread
open override fun isEmpty(): Boolean
Link copied to clipboard
open operator override fun iterator(): Iterator<Component>
Link copied to clipboard
@MainThread
fun remove(componentType: Class<out Component>)

Removes the component of a specific type.

Link copied to clipboard
inline fun <T : Component> set(component: T)

Sets a component of the specified type. If a component of the same type already exists, it will be replaced.

@MainThread
fun set(components: List<Component>)

Sets multiple components. If the array contains components of the same type, the last one in the array will replace the previous ones.

@MainThread
operator fun <T : Component> set(componentType: Class<T>, component: T)

Sets a component as the specified type. If a component of the same type already exists, it will be replaced.