# Class: FamilyBuilder

A builder pattern to create Family objects. Use Family.all, Family.one or Family.exclude to start.

example

let family = Family.all(ComponentA, ComponentB).one(ComponentC, ComponentD).exclude(ComponentE).get();

# Table of contents

# Methods

# Methods

# all

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

This for chaining.

# Defined in

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


# exclude

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

This for chaining.

# Defined in

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


# get

get(): Family

# Returns

Family

A Family for the configured component types.

# Defined in

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


# one

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

This for chaining.

# Defined in

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