Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Component

Component is a functional unit that can be added to an Entity instance.

Hierarchy

Index

Constructors

  • The constructor of the Component class. When creating an Component, use the createComponent method of the ComponentRepository class instead of directly calling this constructor.

    Parameters

    • entityUid: number

      Unique ID of the corresponding entity

    • componentSid: number

      Scoped ID of the Component

    • entityRepository: EntityRepository

      The instance of the EntityRepository class (Dependency Injection)

    Returns Component

Properties

__byteOffsetOfThisComponent: number = -1
__currentProcessStage: ProcessStageEnum = ProcessStage.Create
__entityRepository: EntityRepository

the instance of EntityRepository

__entityUid: number

the entity unique Id which this component belongs to

__maxComponentNumber: number = Config.maxEntityNumber

the MaxComponent Number of entities

__memoryManager: MemoryManager

the instance of MemoryManager

_component_sid: number
_isAlive: boolean = true
InvalidObjectUID: -1 = -1
__accessors: Map<Function, Map<string, Accessor>> = ...
__bufferViews: Map<Function, Map<EnumIO, BufferView>> = ...
__byteLengthSumOfMembers: Map<Function, Map<EnumIO, number>> = ...
__componentsOfProcessStages: Map<ProcessStageEnum, Int32Array> = ...
__lengthOfArrayOfProcessStages: Map<ProcessStageEnum, number> = ...
__memberInfo: Map<Function, MemberInfo[]> = ...
__members: Map<Function, Map<EnumIO, MemberInfo[]>> = ...
_processStages: ProcessStageEnum[] = ...
currentMaxObjectCount: number = 0
invalidComponentSID: -1 = -1

Accessors

  • get componentSID(): number
  • get entityUID(): number
  • get maxNumberOfComponent(): number
  • get objectUID(): number
  • get uniqueName(): string
  • get componentTID(): number

Methods

  • _destroy(): void
  • _setMaxNumberOfComponent(value: number): void
  • internal

    set the Max number of components this method is called by the ***Component classes only

    Parameters

    • value: number

    Returns void

  • addThisComponentToEntity<EntityBase, SomeComponentClass>(base: EntityBase, _componentClass: SomeComponentClass): EntityBase & IsThisSparkGear<SomeComponentClass, IsThisEffekseer<SomeComponentClass, IsThisPhysics<SomeComponentClass, IsThisBlendShape<SomeComponentClass, IsThisSkeletal<SomeComponentClass, IsThisLight<SomeComponentClass, IsThisCamera<SomeComponentClass, IsThisCameraController<SomeComponentClass, IsThisMeshRenderer<SomeComponentClass, IsThisMesh<SomeComponentClass, IsThisSceneGraph<SomeComponentClass, IsThisTransform<SomeComponentClass, IsThisAnimation<SomeComponentClass, AllWellKnownComponentMethodsTypes>>>>>>>>>>>>>
  • virtual

    Add this component to the entity

    Type Parameters

    Parameters

    • base: EntityBase

      the target entity

    • _componentClass: SomeComponentClass

      the component class to add

    Returns EntityBase & IsThisSparkGear<SomeComponentClass, IsThisEffekseer<SomeComponentClass, IsThisPhysics<SomeComponentClass, IsThisBlendShape<SomeComponentClass, IsThisSkeletal<SomeComponentClass, IsThisLight<SomeComponentClass, IsThisCamera<SomeComponentClass, IsThisCameraController<SomeComponentClass, IsThisMeshRenderer<SomeComponentClass, IsThisMesh<SomeComponentClass, IsThisSceneGraph<SomeComponentClass, IsThisTransform<SomeComponentClass, IsThisAnimation<SomeComponentClass, AllWellKnownComponentMethodsTypes>>>>>>>>>>>>>

  • getDataByteInfo(memberName: string): { byteLength: number; byteOffsetInBuffer: number; byteOffsetInThisComponent: any; componentNumber: number; locationOffsetInBuffer: number; locationOffsetInThisComponent: any; thisComponentByteOffsetInBuffer: number; thisComponentLocationOffsetInBuffer: number }
  • get the bytes Information of the member

    Parameters

    • memberName: string

      the member of component in string

    Returns { byteLength: number; byteOffsetInBuffer: number; byteOffsetInThisComponent: any; componentNumber: number; locationOffsetInBuffer: number; locationOffsetInThisComponent: any; thisComponentByteOffsetInBuffer: number; thisComponentLocationOffsetInBuffer: number }

    bytes information

    • byteLength: number
    • byteOffsetInBuffer: number
    • byteOffsetInThisComponent: any
    • componentNumber: number
    • locationOffsetInBuffer: number
    • locationOffsetInThisComponent: any
    • thisComponentByteOffsetInBuffer: number
    • thisComponentLocationOffsetInBuffer: number
  • getTag(tagName: string): Tag
  • getTagValue(tagName: string): any
  • hasTag(tagName: string): boolean
  • matchTag(tagName: string, tagValue: string): boolean
  • matchTags(tags: RnTags): boolean
  • matchTagsAsFreeStrings(stringArray: string[]): boolean
  • registerDependency(component: Component, isMust: boolean): void
  • registerMember(bufferUse: EnumIO, memberName: string, dataClassType: unknown, componentType: ComponentTypeEnum, initValues: number[]): void
  • Register a member field of component class for memory allocation.

    Parameters

    • bufferUse: EnumIO

      purpose type of buffer use

    • memberName: string

      the name of member field

    • dataClassType: unknown

      a class of data

    • componentType: ComponentTypeEnum

      a type of number

    • initValues: number[]

      a initial value

    Returns void

  • removeTag(tagName: string): void
  • submitToAllocation(count: number): void
  • takeOne(memberName: string, dataClassType: any, initValues: number[]): any
  • take one memory area for the specified member for all same type of the component instances.

    Parameters

    • memberName: string
    • dataClassType: any
    • initValues: number[]

    Returns any

  • tryToSetTag(tag: Tag): boolean
  • tryToSetUniqueName(name: string, toAddNameIfConflict: boolean): boolean
  • Try to set a unique name of the entity.

    Parameters

    • name: string
    • toAddNameIfConflict: boolean

      If true, force to add name string to the current unique name string. If false, give up to change name.

    Returns boolean

  • validateTagString(val: string): boolean
  • _reset(): void
  • getAccessor(memberName: string, componentClass: Function): Accessor
  • getByteLengthSumOfMembers(bufferUse: EnumIO, componentClass: Function): number
  • getByteOffsetOfFirstOfThisMemberInBuffer(memberName: string, componentClass: Function): number
  • getByteOffsetOfFirstOfThisMemberInBufferView(memberName: string, componentClass: Function): number
  • getByteOffsetOfThisComponentTypeInBuffer(bufferUse: EnumIO, componentClass: Function): number
  • getComponentTypeOfMember(memberName: string, componentClass: Function): undefined | ComponentTypeEnum
  • getCompositionTypeOfMember(memberName: string, componentClass: Function): undefined | CompositionTypeEnum
  • getDataByteInfoByComponentSID(componentType: typeof Component, componentSID: number, memberName: string): undefined | { byteLength: number; byteOffsetInBuffer: number; byteOffsetInThisComponent: any; componentNumber: number; locationOffsetInBuffer: number; locationOffsetInThisComponent: any; thisComponentByteOffsetInBuffer: number; thisComponentLocationOffsetInBuffer: number }
  • get the bytes Information of the member (static version) by ComponentSID

    Parameters

    • componentType: typeof Component

      the Component type

    • componentSID: number

      the ComponentSID of the component

    • memberName: string

      the member of component in string

    Returns undefined | { byteLength: number; byteOffsetInBuffer: number; byteOffsetInThisComponent: any; componentNumber: number; locationOffsetInBuffer: number; locationOffsetInThisComponent: any; thisComponentByteOffsetInBuffer: number; thisComponentLocationOffsetInBuffer: number }

    bytes information

  • getDataByteInfoByEntityUID(componentType: typeof Component, entityUID: number, memberName: string): undefined | { byteLength: number; byteOffsetInBuffer: number; byteOffsetInThisComponent: any; componentNumber: number; locationOffsetInBuffer: number; locationOffsetInThisComponent: any; thisComponentByteOffsetInBuffer: number; thisComponentLocationOffsetInBuffer: number }
  • get the bytes Information of the member (static version) by EntityUID

    Parameters

    • componentType: typeof Component

      the component type

    • entityUID: number

      the EntityUID

    • memberName: string

      the member of component in string

    Returns undefined | { byteLength: number; byteOffsetInBuffer: number; byteOffsetInThisComponent: any; componentNumber: number; locationOffsetInBuffer: number; locationOffsetInThisComponent: any; thisComponentByteOffsetInBuffer: number; thisComponentLocationOffsetInBuffer: number }

    bytes information

  • getDataByteInfoInner(component: Component, memberName: string): { byteLength: number; byteOffsetInBuffer: number; byteOffsetInThisComponent: any; componentNumber: number; locationOffsetInBuffer: number; locationOffsetInThisComponent: any; thisComponentByteOffsetInBuffer: number; thisComponentLocationOffsetInBuffer: number }
  • get the bytes Information of the member

    Parameters

    • component: Component

      a instance of the component

    • memberName: string

      the member of component in string

    Returns { byteLength: number; byteOffsetInBuffer: number; byteOffsetInThisComponent: any; componentNumber: number; locationOffsetInBuffer: number; locationOffsetInThisComponent: any; thisComponentByteOffsetInBuffer: number; thisComponentLocationOffsetInBuffer: number }

    bytes information

    • byteLength: number
    • byteOffsetInBuffer: number
    • byteOffsetInThisComponent: any
    • componentNumber: number
    • locationOffsetInBuffer: number
    • locationOffsetInThisComponent: any
    • thisComponentByteOffsetInBuffer: number
    • thisComponentLocationOffsetInBuffer: number
  • getLocationOffsetOfMemberOfComponent(componentType: typeof Component, memberName: string): number
  • get the Pixel Location Offset in the Buffer of the Member

    Parameters

    • componentType: typeof Component

      the component type (e.g. TransformComponent )

    • memberName: string

      the member name in string

    Returns number

    the pixel offsets

  • getRnObject(objectUid: number): RnObject
  • getRnObjectByName(uniqueName: string): undefined | RnObject
  • searchByTag(tag: string, value: string): undefined | RnObject

Generated using TypeDoc