实体类 实体类只是单纯的父子节点逻辑，不含有其他逻辑

### Hierarchy

- HashObject
  - Entity
    - RootEntity

## Index

### Constructors

- constructor

### Properties

- _children
- _components
- _enabled
- _isFree
- _parent
- _uuid
- name

### Accessors

- children
- components
- enabled
- hashCode
- isActive
- isFree
- isParentActive
- parent
- root
- uuid

### Methods

- _free
- _invokeEnabledState
- _onChildAdded
- _onChildRemoved
- _restrict
- addChild
- addChildAt
- addComponent
- addComponentAt
- afterUpdate
- awakeComponent
- broadcast
- bubbling
- containsChild
- forEachComponent
- getChildByIndex
- getChildIndex
- getChildrenByName
- getComponent
- getComponentByName
- getComponents
- getComponentsByName
- invokeOnEntity
- onAddComponent
- onDisable
- onEnable
- onInteract
- onRemoveComponent
- onUpdate
- removeAllComponents
- removeChild
- removeChildAt
- removeChildren
- removeComponent
- sleepComponent

## Constructors

### constructor

- new Entity(name?: string, uuid?: string): Entity

- Overrides HashObject.constructor

  - Defined in core/Entity.ts:25

  #### Parameters

  - ##### Optional name: string

  - ##### Optional uuid: string

  #### Returns Entity

## Properties

### Protected _children

_children: Entity [] = []

- Defined in core/Entity.ts:24

### Protected _components

_components: Component [] = []

- Defined in core/Entity.ts:25

### Protected _enabled

_enabled: boolean = EngineConfig.entityEnabled

- Defined in core/Entity.ts:22

### Protected _isFree

_isFree: boolean = true

- Defined in core/Entity.ts:20

### Protected _parent

_parent: Entity = null

- Defined in core/Entity.ts:23

### Protected _uuid

_uuid: string

- Defined in core/Entity.ts:17

### name

name: string = "Entity"

- Defined in core/Entity.ts:16

## Accessors

### children

children:

- Defined in core/Entity.ts:280

获取所有子节点

### components

components:

- Defined in core/Entity.ts:373

获取所有组件

### enabled

enabled:

- Defined in core/Entity.ts:48
- Defined in core/Entity.ts:52

是否有效状态

### hashCode

hashCode:

Inherited from HashObject.hashCode

- Defined in core/HashObject.ts:21

### isActive

isActive:

- Defined in core/Entity.ts:75

### isFree

isFree:

- Defined in core/Entity.ts:82

是否游离状态

### isParentActive

isParentActive:

- Defined in core/Entity.ts:71

### parent

parent:

- Defined in core/Entity.ts:121

获取父节点

### root

root:

- Defined in core/Entity.ts:128

获取根节点

### uuid

uuid:

- Defined in core/Entity.ts:41

获取唯一ID

## Methods

### _free

- _free(): void

- - Defined in core/Entity.ts:89

  使游离

  #### Returns void

### _invokeEnabledState

- _invokeEnabledState(enabled: boolean): void

- - Defined in core/Entity.ts:63

  #### Parameters

  - ##### enabled: boolean

  #### Returns void

### Private _onChildAdded

- _onChildAdded(child: Entity ): void

- - Defined in core/Entity.ts:152

  添加子节点时

  #### Parameters

  - ##### child: Entity

  #### Returns void

### Private _onChildRemoved

- _onChildRemoved(child: Entity ): void

- - Defined in core/Entity.ts:168

  子节点被移除时

  #### Parameters

  - ##### child: Entity

  #### Returns void

### _restrict

- _restrict(): void

- - Defined in core/Entity.ts:104

  使约束

  #### Returns void

### addChild

- addChild(child: Entity ): void

- - Defined in core/Entity.ts:183

  添加子节点，重复添加则会加到最后

  #### Parameters

  - ##### child: Entity

  #### Returns void

### addChildAt

- addChildAt(child: Entity, index: any): void

- - Defined in core/Entity.ts:192

  添加子节点到指定索引，重复添加可作为顺序交换

  #### Parameters

  - ##### child: Entity

  - ##### index: any

  #### Returns void

### addComponent

- addComponent(component: Component ): void

- - Defined in core/Entity.ts:290

  增加组件

  #### Parameters

  - ##### component: Component

  #### Returns void

### addComponentAt

- addComponentAt(component: Component, index: number): void

- - Defined in core/Entity.ts:300

  在指定索引增加组件，重复添加可作为顺序交换

  #### Parameters

  - ##### component: Component

  - ##### index: number

  #### Returns void

### afterUpdate

- afterUpdate(): void

- - Defined in core/Entity.ts:432

  当子节点遍历结束后

  #### Returns void

### awakeComponent

- awakeComponent(component: any): void

- - Defined in core/Entity.ts:482

  唤醒组件

  #### Parameters

  - ##### component: any

  #### Returns void

### broadcast

- broadcast(method: string, level?: number, ...params: any[]): void

- - Defined in core/Entity.ts:516

  向下广播 如果某组件调用后返回true，将结束整条链

  #### Parameters

  - ##### method: string

    方法名

  - ##### Default value level: number = -1

    深度，默认全部遍历

  - ##### Rest ...params: any[]

    参数

  #### Returns void

### bubbling

- bubbling(method: string, ...params: any[]): void

- - Defined in core/Entity.ts:526

  向上冒泡 如果某组件调用后返回true，将结束整条链

  #### Parameters

  - ##### method: string

    方法名

  - ##### Rest ...params: any[]

    参数

  #### Returns void

### containsChild

- containsChild(child: Entity ): boolean

- - Defined in core/Entity.ts:143

  是否含有子节点

  #### Parameters

  - ##### child: Entity

  #### Returns boolean

### forEachComponent

- forEachComponent(func: function): void

- - Defined in core/Entity.ts:383

  遍历所有组件

  #### Parameters

  - ##### func: function

    - - (component: any): boolean

      - #### Parameters

        - ##### component: any

        #### Returns boolean

  #### Returns void

### getChildByIndex

- getChildByIndex(index: any): Entity

- - Defined in core/Entity.ts:249

  获取指定索引的节点

  #### Parameters

  - ##### index: any

  #### Returns Entity

### getChildIndex

- getChildIndex(child: Entity ): number

- - Defined in core/Entity.ts:241

  根据节点获取索引

  #### Parameters

  - ##### child: Entity

  #### Returns number

### getChildrenByName

- getChildrenByName(name: any): Entity []

- - Defined in core/Entity.ts:257

  获取指定名字的节点

  #### Parameters

  - ##### name: any

  #### Returns Entity []

### getComponent

- getComponent<T>(clazz: object): T

- - Defined in core/Entity.ts:366

  获取指定类的组件

  #### Type parameters

  - #### T: Component

  #### Parameters

  - ##### clazz: object

  #### Returns T

### getComponentByName

- getComponentByName<T>(name: string): T

- - Defined in core/Entity.ts:358

  获取指定类的组件

  #### Type parameters

  - #### T: Component

  #### Parameters

  - ##### name: string

  #### Returns T

### getComponents

- getComponents<T>(clazz: object): T[]

- - Defined in core/Entity.ts:348

  获取指定类的组件列表

  #### Type parameters

  - #### T: Component

  #### Parameters

  - ##### clazz: object

  #### Returns T[]

### getComponentsByName

- getComponentsByName<T>(name: string): T[]

- - Defined in core/Entity.ts:338

  根据组件名称获取指定类的组件列表

  #### Type parameters

  - #### T: Component

  #### Parameters

  - ##### name: string

  #### Returns T[]

### Private invokeOnEntity

- invokeOnEntity(hitEntity: Entity, method: string, ...params: any[]): boolean

- - Defined in core/Entity.ts:536

  调用实体上的组件的方法

  #### Parameters

  - ##### hitEntity: Entity

    遇到的实体

  - ##### method: string

    方法名

  - ##### Rest ...params: any[]

    参数

  #### Returns boolean

### onAddComponent

- onAddComponent(component: Component ): void

- - Defined in core/Entity.ts:471

  当添加组件时

  #### Parameters

  - ##### component: Component

  #### Returns void

### onDisable

- onDisable(): void

- - Defined in core/Entity.ts:405

  当组件失效时

  #### Returns void

### onEnable

- onEnable(): void

- - Defined in core/Entity.ts:394

  当组件生效时

  #### Returns void

### onInteract

- onInteract(type: any, event: any): boolean

- - Defined in core/Entity.ts:449

  当交互时

  #### Parameters

  - ##### type: any

  - ##### event: any

  #### Returns boolean

### onRemoveComponent

- onRemoveComponent(component: Component ): void

- - Defined in core/Entity.ts:492

  当移除组件时

  #### Parameters

  - ##### component: Component

  #### Returns void

### onUpdate

- onUpdate(t: any): void

- - Defined in core/Entity.ts:417

  当时钟更新时

  #### Parameters

  - ##### t: any

  #### Returns void

### removeAllComponents

- removeAllComponents(): void

- - Defined in core/Entity.ts:328

  移除所有组件

  #### Returns void

### removeChild

- removeChild(child: Entity ): void

- - Defined in core/Entity.ts:219

  移除节点

  #### Parameters

  - ##### child: Entity

  #### Returns void

### removeChildAt

- removeChildAt(index: number): void

- - Defined in core/Entity.ts:230

  移除指定索引的节点

  #### Parameters

  - ##### index: number

  #### Returns void

### removeChildren

- removeChildren(): void

- - Defined in core/Entity.ts:271

  移除所有子节点

  #### Returns void

### removeComponent

- removeComponent(component: Component ): void

- - Defined in core/Entity.ts:317

  移除组件

  #### Parameters

  - ##### component: Component

  #### Returns void

### sleepComponent

- sleepComponent(component: Component ): void

- - Defined in core/Entity.ts:503

  睡眠组件

  #### Parameters

  - ##### component: Component

  #### Returns void

Generated using TypeDoc