Options
All
  • Public
  • Public/Protected
  • All
Menu

RuntimeBehavior represents a behavior being used by a RuntimeObject.

Hierarchy

Index

Methods

  • activate(enable: boolean): void
  • activated(): boolean
  • enableSynchronization(enable: boolean): void
  • getName(): string
  • getNameId(): number
  • getNetworkSyncData(): BehaviorNetworkSyncData
  • isSyncedOverNetwork(): boolean
  • onActivate(): void
  • Reimplement this method to do extra work when the behavior is activated (after it has been deactivated, see onDeActivate).

    Returns void

  • onCreated(): void
  • Reimplement this to do extra work when the behavior is created (i.e: an object using it was created), after the object is fully initialized (so you can use this.owner without risk).

    Returns void

  • onDeActivate(): void
  • onDestroy(): void
  • This method is called when the owner of the behavior is being removed from the scene and is about to be destroyed/reused later or when the behavior is removed from an object (can happen in case of hot-reloading only. Otherwise, behaviors are just de-activated, not removed. See onDeActivate).

    Returns void

  • onObjectHotReloaded(): void
  • This method is called when the owner of the behavior was hot reloaded, so its position, angle, size can have been changed outside of events.

    Returns void

  • Called at each frame after events. Call doStepPostEvents.
    Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead.

    Parameters

    Returns void

  • Called at each frame before events. Call doStepPreEvents.
    Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead.

    Parameters

    Returns void

  • updateFromBehaviorData(oldBehaviorData: BehaviorData, newBehaviorData: BehaviorData): boolean
  • Called when the behavior must be updated using the specified behaviorData. This is the case during hot-reload, and is only called if the behavior was modified.

    see

    gdjs.RuntimeBehavior#onObjectHotReloaded

    Parameters

    • oldBehaviorData: BehaviorData

      The previous data for the behavior.

    • newBehaviorData: BehaviorData

      The new data for the behavior.

    Returns boolean

    true if the behavior was updated, false if it could not (i.e: hot-reload is not supported).

  • updateFromNetworkSyncData(networkSyncData: BehaviorNetworkSyncData): void
  • Update the behavior properties using the provided data.

    Parameters

    • networkSyncData: BehaviorNetworkSyncData

      The new properties of the behavior.

    Returns void

  • usesLifecycleFunction(): boolean
  • Should return false if the behavior does not need any lifecycle function to be called. Default, hidden, "capability" behaviors set it to false. This avoids useless calls to empty lifecycle functions, which would waste CPU time (and have a sizeable impact for example when lots of static instances are living in the scene).

    Returns boolean

Constructors

Properties

name: string
type: string

Generated using TypeDoc