@thejsngin/jsngin / Exports / GameObjectInstance
Interface: GameObjectInstance
An instance of a gameObject
.
Table of contents
Properties
- addChild
- addComponent
- children
- commonStore
- components
- dispose
- eventSystem
- getComponent
- name
- parent
- removeChild
- removeComponent
- store
- userData
Properties
addChild
• addChild: (gameObject
: any
, name?
: string
, userData?
: any
) => Promise
<GameObjectInstance
>
Type declaration
▸ (gameObject
, name?
, userData?
): Promise
<GameObjectInstance
>
Instanciate a child
Parameters
Name | Type |
---|---|
gameObject | any |
name? | string |
userData? | any |
Returns
Promise
<GameObjectInstance
>
Defined in
src/gameObject/interface.ts:25
addComponent
• addComponent: (component
: Component
, name?
: string
, userData?
: any
) => string
Type declaration
▸ (component
, name?
, userData?
): string
Add a component to this gameObjectInstance.
WARNING
This is used internaly. Externally creating components at runtime can lead to unexpected behaviour.
Parameters
Name | Type |
---|---|
component | Component |
name? | string |
userData? | any |
Returns
string
Defined in
src/gameObject/interface.ts:36
children
• children: Object
Index signature
▪ [childName: string
]: GameObjectInstance
Defined in
src/gameObject/interface.ts:19
commonStore
• commonStore: object
This store is shared among all the gameObjectInstance
s of a single gameObject
Defined in
src/gameObject/interface.ts:18
components
• components: Object
The value stored here for each component is the resource(s) returned during the resource event
Index signature
▪ [componentName: string
]: any
Defined in
src/gameObject/interface.ts:21
dispose
• dispose: () => Promise
<void
>
Type declaration
▸ (): Promise
<void
>
Removes the gameObjectInstace from the gameInstace / parentGameObject and disposes of the resources.
Returns
Promise
<void
>
Defined in
src/gameObject/interface.ts:51
eventSystem
• eventSystem: Object
All the gameObject level events are fired on this event system
Type declaration
Name | Type |
---|---|
addEventListener | AddEventListner <EventSystemConfigType > |
autoFire | AutoFire <EventSystemConfigType > |
fireEvent | FireEvent <EventSystemConfigType > |
removeEvent | RemoveEvent <EventSystemConfigType > |
removeEventListener | RemoveEventListner <EventSystemConfigType > |
Defined in
src/gameObject/interface.ts:23
getComponent
• getComponent: (name
: string
) => any
Type declaration
▸ (name
): any
Returns the resource for the given component
Parameters
Name | Type |
---|---|
name | string |
Returns
any
Defined in
src/gameObject/interface.ts:48
name
• Optional
name: string
name of this gameObjectInstace
within parent. Will be undefined if this is the root.
Defined in
src/gameObject/interface.ts:13
parent
• Optional
parent: GameObjectInstance
parent property will be undefined when this gameObjectInstace
is the root
Defined in
src/gameObject/interface.ts:11
removeChild
• removeChild: (name
: string
) => Promise
<void
>
Type declaration
▸ (name
): Promise
<void
>
Remove a child
Parameters
Name | Type |
---|---|
name | string |
Returns
Promise
<void
>
Defined in
src/gameObject/interface.ts:27
removeComponent
• removeComponent: (name
: string
) => Promise
<void
>
Type declaration
▸ (name
): Promise
<void
>
Remove a component from this gameObjectInstance
WARNING
This is used internaly. Externally removing components at runtime can lead to unexpected behaviour.
Parameters
Name | Type |
---|---|
name | string |
Returns
Promise
<void
>
Defined in
src/gameObject/interface.ts:45
store
• store: object
This store is local to the gameObjectInstance
and can be used to save gameObjectInstance
specific data.
Defined in
src/gameObject/interface.ts:16
userData
• Optional
userData: any