Trigger class

Base class for representing triggers. A trigger generates an action if a game entity touches its trigger region, a predefine area in 3D space.

@author {@link https://github.com/Mugen87|Mugen87}

Inheritance

Constructors

Trigger([TriggerRegion? region])
Constructs a new trigger with the given values.

Properties

active bool
getter/setter pairinherited
boundingRadius double
getter/setter pairinherited
canActivateTrigger bool
getter/setter pairinherited
children List<GameEntity>
finalinherited
forward Vector3
finalinherited
hashCode int
The hash code for this object.
no setterinherited
manager EntityManager?
getter/setter pairinherited
maxTurnRate double
getter/setter pairinherited
name String
getter/setter pairinherited
neighborhoodRadius double
getter/setter pairinherited
neighbors List<GameEntity>
finalinherited
parent GameEntity?
getter/setter pairinherited
position Vector3
finalinherited
positionWorld Vector3
finalinherited
quaternionWorld Quaternion
finalinherited
region TriggerRegion
getter/setter pair
renderComponent ↔ dynamic
getter/setter pairinherited
renderComponentCallback Function?
getter/setter pairinherited
rotation Quaternion
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scale Vector3
finalinherited
started bool
getter/setter pairinherited
targetDirection Vector3
finalinherited
targetRotation Quaternion
finalinherited
up Vector3
finalinherited
updateNeighborhood bool
getter/setter pairinherited
uuid String?
Unique ID, primarily used in context of serialization/deserialization.
no setterinherited
vision Vision?
getter/setter pairinherited

Methods

add(GameEntity entity) GameEntity
Adds a game entity as a child to this game entity.
inherited
check(GameEntity entity) Trigger
This method is called per simulation step for all game entities. If the game entity touches the region of the trigger, the respective action is executed.
entitiesToIds(dynamic array) → dynamic
inherited
execute(GameEntity entity) → void
This method is called when the trigger should execute its action. Must be implemented by all concrete triggers.
fromJSON(Map<String, dynamic> json) Trigger
Restores this instance from the given JSON object.
override
getDirection(Vector3 result) Vector3
Computes the current direction (forward) vector of this game entity and stores the result in the given vector.
inherited
getWorldDirection(Vector3 result) Vector3
Computes the current direction (forward) vector of this game entity in world space and stores the result in the given vector.
inherited
getWorldPosition(Vector3 result) Vector3
Computes the current position of this game entity in world space and stores the result in the given vector.
inherited
handleMessage(Telegram telegram) bool
Holds the implementation for the message handling of this game entity.
inherited
lineOfSightTest(Ray ray, Vector3 intersectionPoint) Vector3?
Holds the implementation for the line of sight test of this game entity. This method is used by {@link Vision#visible} in order to determine whether this game entity blocks the given line of sight or not. Implement this method when your game entity acts as an obstacle.
inherited
lookAt(Vector3 target) GameEntity
Directly rotates the entity so it faces the given target position.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerType(String type, dynamic constructor) Trigger
Registers a custom type for deserialization. When calling {@link Trigger#fromJSON} the trigger is able to pick the correct constructor in order to create custom trigger regions.
remove(GameEntity entity) GameEntity
Removes a game entity as a child from this game entity.
inherited
resolveReferences(Map<String, GameEntity> entities) GameEntity
Restores UUIDs with references to GameEntity objects.
inherited
rotateTo(Vector3 target, double delta, [double? tolerance]) bool
Given a target position, this method rotates the entity by an amount not greater than {@link GameEntity#maxTurnRate} until it directly faces the target.
inherited
sendMessage(GameEntity receiver, String message, [double delay = 0, Map<String, dynamic>? data]) GameEntity
Sends a message with the given data to the specified receiver.
inherited
setRenderComponent([dynamic renderComponent, Function? callback]) GameEntity
Sets a renderable component of a 3D engine with a sync callback for this game entity.
inherited
start() GameEntity
Executed when this game entity is updated for the first time by its {@link EntityManager}.
inherited
toJSON() Map<String, dynamic>
Transforms this instance into a JSON object.
override
toString() String
A string representation of this object.
inherited
update(double delta) GameEntity
Updates the internal state of this game entity. Normally called by {@link EntityManager#update} in each simulation step.
inherited
updateRegion() Trigger
Updates the region of this trigger. Called by the {@link EntityManager} per simulation step.
updateWorldMatrix() GameEntity
inherited
worldMatrix() Matrix4
A transformation matrix representing the world space of this game entity.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited