Description

Binds scripts to Events and executes them when triggered. Any script can access the ScriptComponent executing them through the variable script. See also: Scripting Overview, Script Events Guide.

Example

// Bind a function to the MouthOpened event
function onMouthOpen(eventData)
{
print("mouth was opened");
}
var event = script.createEvent("MouthOpenedEvent");
event.bind(onMouthOpen);
interface ScriptComponent {
    enabled: boolean;
    uniqueIdentifier: string;
    createEvent<K>(eventType): EventNameMap[K];
    destroy(): void;
    getSceneObject(): SceneObject;
    getTransform(): Transform;
    getTypeName(): string;
    isOfType(type): boolean;
    isSame(other): boolean;
    removeEvent(event): void;
    [index: string]: any;
}

Hierarchy (view full)

Indexable

[index: string]: any

Properties

enabled: boolean

Description

If disabled, the Component will stop enacting its behavior.

uniqueIdentifier: string

Methods

  • Type Parameters

    Parameters

    • eventType: K

    Returns EventNameMap[K]

    Description

    Adds a new SceneEvent, triggered by eventType events, to the ScriptComponent.

  • Returns void

    Description

    Destroys the component.

  • Returns string

    Description

    Returns the name of this object's type.

  • Parameters

    • type: string

    Returns boolean

    Description

    Returns true if the object matches or derives from the passed in type.

  • Parameters

    Returns boolean

    Description

    Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

  • Parameters

    Returns void

    Description

    Removes a previously added SceneEvent from the ScriptComponent.

Generated using TypeDoc