# Class: Family

Represents a group of Components. It is used to describe what Entity objects an EntitySystem should process. Families can't be instantiated directly but must be accessed via a builder. This is to avoid duplicate families that describe the same components Start with Family.all, Family.one or Family.exclude.

# Table of contents

# Properties

# Methods

# Properties

# index

Readonly index: number

The unique identifier of this Family.

# Defined in

src/core/Family.ts:129 (opens new window)

# Methods

# matches

matches(entity): boolean

# Parameters

Name Type Description
entity Entity The entity to check.

# Returns

boolean

Whether the entity matches the family requirements or not.

# Defined in

src/core/Family.ts:150 (opens new window)


# all

Static all(...classes): FamilyBuilder

Entities of the family will have to contain all of the specified components.

# Parameters

Name Type Description
...classes ComponentConstructor<Component>[] All of these classes must be on an entity for it to belong to this family.

# Returns

FamilyBuilder

A builder singleton instance to get a Family.

# Defined in

src/core/Family.ts:168 (opens new window)


# exclude

Static exclude(...classes): FamilyBuilder

Entities of the family cannot contain any of the specified components.

# Parameters

Name Type Description
...classes ComponentConstructor<Component>[] If any one of these classes is on an entity, it will not belong to this family.

# Returns

FamilyBuilder

A builder singleton instance to get a Family.

# Defined in

src/core/Family.ts:188 (opens new window)


# one

Static one(...classes): FamilyBuilder

Entities of the family will have to contain at least one of the specified components.

# Parameters

Name Type Description
...classes ComponentConstructor<Component>[] One of these classes must be on an entity for it to belong to this family.

# Returns

FamilyBuilder

A builder singleton instance to get a Family.

# Defined in

src/core/Family.ts:178 (opens new window)