GameEntity class

Base class for all game entities.

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

Implementers

Constructors

GameEntity()

Properties

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

Methods

add(GameEntity entity) → GameEntity
Adds a game entity as a child to this game entity.
entitiesToIds(dynamic array) → dynamic
fromJSON(Map<String, dynamic> json) → GameEntity
Restores this instance from the given JSON object.
getDirection(Vector3 result) → Vector3
Computes the current direction (forward) vector of this game entity and stores the result in the given vector.
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.
getWorldPosition(Vector3 result) → Vector3
Computes the current position of this game entity in world space and stores the result in the given vector.
handleMessage(Telegram telegram) → bool
Holds the implementation for the message handling of this game entity.
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.
lookAt(Vector3 target) → GameEntity
Directly rotates the entity so it faces the given target position.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(GameEntity entity) → GameEntity
Removes a game entity as a child from this game entity.
resolveReferences(Map<String, GameEntity> entities) → GameEntity
Restores UUIDs with references to GameEntity objects.
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.
sendMessage(GameEntity receiver, String message, [double delay = 0, Map<String, dynamic>? data]) → GameEntity
Sends a message with the given data to the specified receiver.
setRenderComponent([dynamic renderComponent, Function? callback]) → GameEntity
Sets a renderable component of a 3D engine with a sync callback for this game entity.
start() → GameEntity
Executed when this game entity is updated for the first time by its {@link EntityManager}.
toJSON() → Map<String, dynamic>
Transforms this instance into a JSON object.
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.
updateWorldMatrix() → GameEntity
worldMatrix() → Matrix4
A transformation matrix representing the world space of this game entity.

Operators

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