Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TagComponent<TypeName, MaybeValueType>

Tag components are a way of tagging a component with label and a simple value

For example:

const isOffscreen = new TagComponent('offscreen');
entity.addComponent(isOffscreen);
entity.tags.includes

Type parameters

  • TypeName: string

  • MaybeValueType: string | symbol | number | boolean = never

Hierarchy

Index

Constructors

  • new TagComponent<TypeName, MaybeValueType>(type: TypeName, value?: MaybeValueType): TagComponent<TypeName, MaybeValueType>

Properties

dependencies?: ComponentCtor<Component<string>>[]

Optionally list any component types this component depends on If the owner entity does not have these components, new components will be added to the entity

Only components with zero-arg constructors are supported as automatic component dependencies

optional?: ComponentCtor<Component<string>>[]
owner?: Entity = null

Current owning Entity, if any, of this component. Null if not added to any Entity

type: TypeName

Type of this component, must be a unique type among component types in you game.

value?: MaybeValueType

Methods

  • onRemove(previousOwner: Entity): void