SingletonTagDelegate

class SingletonTagDelegate<T : Component>(mapper: ComponentMapper<T>, componentClass: Class<T>, defaultValue: T) : TagDelegate<T>

Property delegate for an Entity wrapping around a ComponentMapper. Allows checking the presence of a Component of an Entity. Automatically assigns a singleton instance of the T if its value is set to true. This property delegate should be used only for stateless components without any mutable properties.

Constructors

Link copied to clipboard
constructor(mapper: ComponentMapper<T>, componentClass: Class<T>, defaultValue: T)

Functions

Link copied to clipboard
open operator override fun getValue(thisRef: Entity, property: KProperty<*>): Boolean
Link copied to clipboard
open operator override fun setValue(thisRef: Entity, property: KProperty<*>, value: Boolean)