/**
* 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.
*
* @author {@link https://github.com/Mugen87|Mugen87}
*/
class TriggerRegion {
/**
* Returns true if the bounding volume of the given game entity touches/intersects
* the trigger region. Must be implemented by all concrete trigger regions.
*
* @param {GameEntity} entity - The entity to test.
* @return {Boolean} Whether this trigger touches the given game entity or not.
*/
touching( /* entity */ ) {
return false;
}
/**
* Updates this trigger region. Must be implemented by all concrete trigger regions.
*
* @param {Trigger} trigger - The trigger that owns this region.
* @return {TriggerRegion} A reference to this trigger region.
*/
update( /* trigger */ ) {
return this;
}
/**
* Transforms this instance into a JSON object.
*
* @return {Object} The JSON object.
*/
toJSON() {
return {
type: this.constructor.name
};
}
/**
* Restores this instance from the given JSON object.
*
* @param {Object} json - The JSON object.
* @return {TriggerRegion} A reference to this trigger region.
*/
fromJSON( /* json */ ) {
return this;
}
}
export { TriggerRegion };