TriggerRegion()

Base class for representing trigger regions. It's a predefine region in 3D space, owned by one or more triggers. The shape of the trigger can be arbitrary.

new TriggerRegion()

Author:

Methods

fromJSON(json) → {TriggerRegion}

Restores this instance from the given JSON object.

Parameters:
Name Type Description
json Object

The JSON object.

Returns:
TriggerRegion -

A reference to this trigger region.

toJSON() → {Object}

Transforms this instance into a JSON object.

Returns:
Object -

The JSON object.

touching(entity) → {Boolean}

Returns true if the bounding volume of the given game entity touches/intersects the trigger region. Must be implemented by all concrete trigger regions.

Parameters:
Name Type Description
entity GameEntity

The entity to test.

Returns:
Boolean -

Whether this trigger touches the given game entity or not.

update(trigger) → {TriggerRegion}

Updates this trigger region. Must be implemented by all concrete trigger regions.

Parameters:
Name Type Description
trigger Trigger

The trigger that owns this region.

Returns:
TriggerRegion -

A reference to this trigger region.