Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PixiEntity

A special entity which automatically adds the components Position, Displayable, Rotation and Size, and has the ability to add an object to a Pixi container.

Hierarchy

Index

Constructors

constructor

Methods

add

addDisplayObject

  • addDisplayObject(obj: Container, container: Container): void
  • Makes this entity a renderable entity added to a pixi container. The Displayable component should not be mutated in a logic system. Instead, mutate Position, Rotatin and Size in logic systems and copy the values into the Displayable component in a render system.

    Parameters

    • obj: Container
    • container: Container

    Returns void

get

  • get<C>(component: {}): C
  • Returns the component instance for the specified component. Useful if you need to modify values on the component

    Type parameters

    Parameters

    • component: {}

      The constructor of a component

    Returns C

    Returns the component instance

has

  • has(component: {}): boolean
  • Parameters

    • component: {}

      The constructor of a component

    Returns boolean

    true | false depending on if this entity has the specified component

ifHas

  • ifHas<C>(component: {}, fn: (c: C) => void): void
  • Executes the provided function if this entity has the specified component

    Type parameters

    Parameters

    • component: {}

      The constructor of a component

    • fn: (c: C) => void

      A function to be executed if the entity has the component

        • (c: C): void
        • Parameters

          • c: C

          Returns void

    Returns void

remove

  • remove(component: {}): void

Generated using TypeDoc