Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: DoorComponent

[30:7] extends: Component

Wraps FXGL's DoorComponent (com.almasb.fxgl.scene3d.DoorComponent), a Component that adds a 3D door (frame, panel, and handle) to its Entity and animates the panel open / closed in response to the Entity's ActivatorComponent. DoorComponent is the panel half of the experimental door prefab built by Prefabs.newDoor; it also requires the ActivatorComponent to drive its open / close transitions. For ad-hoc setup, attach both an ActivatorComponent and a DoorComponent to your Entity; toggling the activator (activator.press) plays the open or close animation. Note: the DoorComponent constructor builds its open Animation through FXGL's DSL animationBuilder, which requires a running FXGL engine. Construct DoorComponent only after the game has launched (e.g. from inside onInitGame), or obtain one through Prefabs.newDoor.

Methods

  • DoorComponent ()

    Creates a new DoorComponent. The frame, panel, handle, and open animation are all built at construction time.

  • adopt (object Ajo)

    Wraps an existing DoorComponent AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a DoorComponent.
    • @r A new DoorComponent wrapper.
  • getFrame ()

    Returns the door frame as a Model3D AussomJavaObject (the left / right / top frame cuboids parented under one Model3D).

    • @r An AussomJavaObject around a Model3D.
  • getPanel ()

    Returns the door panel as a Model3D AussomJavaObject (the main door panel and handle that swing open).

    • @r An AussomJavaObject around a Model3D.
  • getHandle ()

    Returns the door handle as a Sphere AussomJavaObject.

    • @r An AussomJavaObject around a Sphere.
  • getOpenAnimation ()

    Returns the open / close Animation AussomJavaObject. Tied to the door's ActivatorComponent; the component starts it (or starts it in reverse) when the activator flips.

    • @r An AussomJavaObject around an Animation.
  • setOpenAnimation (object AnimationAjo)

    Sets the open / close Animation.

    • @p AnimationAjo is an Animation AussomJavaObject.
    • @r this object
  • onUpdate (double Tpf)

    Manually drives the component's per-tick animation update. FXGL calls this every frame while the Entity is active; Aussom code rarely needs to call it directly.

    • @p Tpf is the time per frame in seconds.
    • @r this object