abstract class ComponentBase
ComponentBase
()
:
ComponentBase |
Signature
constructor() Returns |
cachable
:
Boolean
[Get] |
Signature
open val cachable: Boolean |
entID
:
Long
[Get][Set] |
Signature
var entID: Long |
isDirty
:
Boolean
[Get][Set] |
Signature
var isDirty: Boolean |
recycled
:
Boolean
[Get][Set] |
Signature
var recycled: Boolean |
timeStamp
:
Long
[Get][Set] |
Signature
var timeStamp: Long |
companion
()
:
ComponentCompanion |
Gets the companion object for this component.
The companion object provides metadata about the component.
Signature
open fun companion(): ComponentCompanion Throws
RuntimeException
|
getComponentDataAttributeType
(
key
)
:
AttributePrimitive? |
Gets the attribute type for the specified key.
Signature
fun getComponentDataAttributeType(key: Int): AttributePrimitive? Parameters
key:
Int
|
getComponentDataAttributeType
(
keyString
)
:
AttributePrimitive? |
Gets the attribute type for the specified string key.
Signature
fun getComponentDataAttributeType(keyString: String): AttributePrimitive? Parameters
keyString:
String
Throws
IllegalArgumentException
|
getComponentDataKey
(
key
)
:
Int?
|
Gets the integer key associated with the specified string key.
Signature
fun getComponentDataKey(key: String): Int? Parameters
key:
String
Returns
Int?
|
getComponentDataValue
(
key
)
:
Any?
|
Gets the value for the specified key.
Signature
fun getComponentDataValue(key: Int): Any? Parameters
key:
Int
Returns
Any?
|
getComponentDataValue
(
keyString
)
:
Any?
|
Gets the value for the specified string key.
Signature
fun getComponentDataValue(keyString: String): Any? Parameters
keyString:
String
Returns
Any?
Throws
IllegalArgumentException
|
getEnumClass
(
key
)
:
Class?
|
Gets the enum class associated with the specified string key.
Signature
fun getEnumClass(key: String): Class<out Enum<*>>? Parameters
key:
String
Returns
Class?
|
hasComponentData
(
key
)
:
Boolean
|
Checks if this component has data for the specified key.
Signature
fun hasComponentData(key: Int): Boolean Parameters
key:
Int
Returns
Boolean
|
hasComponentData
(
keyString
)
:
Boolean
|
Checks if this component has data for the specified string key.
Signature
fun hasComponentData(keyString: String): Boolean Parameters
keyString:
String
Returns
Boolean
|
read
(
e
,
cachable
)
|
Reads component data from the specified entity.
Signature
fun read(e: Entity, cachable: Boolean) Parameters
e:
Entity
cachable:
Boolean
|
recycle
()
|
Recycles this component by returning it to its pool.
If the component has a pool assigned, it will be returned to that pool for reuse.
Signature
fun recycle() |
reset
()
|
Resets the component to its default state.
This method is called when a component is recycled to clear any state. Subclasses should override this method to reset their specific state.
Signature
open fun reset() |
setComponentDataValue
(
key
,
value
)
:
Boolean
|
Sets the value for the specified key.
Signature
fun setComponentDataValue(key: Int, value: Any): Boolean Parameters
key:
Int
value:
Any
Returns
Boolean
|
setComponentDataValue
(
keyString
,
value
)
:
Boolean
|
Sets the value for the specified string key.
Signature
fun setComponentDataValue(keyString: String, value: Any): Boolean Parameters
keyString:
String
value:
Any
Returns
Boolean
|
setPool
(
pool
,
entID
)
|
Sets the component pool and entity ID for this component.
This is used for component recycling to track which pool the component belongs to and which entity it was associated with.
Signature
fun setPool(pool: ComponentPool<*>, entID: Long) Parameters
pool:
ComponentPool
entID:
Long
|
toString
()
:
String
|
Signature
open override fun toString(): String Returns
String
|
typeID
()
:
Int
|
Returns the unique type ID of this component.
Each component type must have a unique ID for identification in the entity-component system.
Signature
abstract fun typeID(): Int Returns
Int
|
write
(
e
)
|
Writes this component's data to the specified entity.
Signature
fun write(e: Entity) Parameters
e:
Entity |