Entity class

A container that holds components essentially.

Constructors

Entity(String guid, EntitySystem system)

Properties

components → BehaviorSubject<Map<Type, Component>>
final
guid String
final
hashCode int
The hash code for this object.
no setterinherited
isDestroyed → BehaviorSubject<bool>
Used internally for verifying Entity has not been destroyed before mutating any values.
final
props List<Object>
The list of properties that will be used to determine whether two instances are equal.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
system EntitySystem
The system where this entity is contained.
final

Methods

componentDiff(Entity e) Set<Type>
Compares the component list between entities and returns a list of types of components that "a" has that "b" does not.
destroy() → void
Destroy an entity which will lead to following steps:
get<T extends Component>() → T
Returns a matching component from type T.
has<T extends Component>() bool
If entity has a component of type T
hasComponent(Type type) bool
Checks if entity has a component of the type of the given object.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove<T extends Component>() → void
For cascade
set(Component component) → void
For cascade
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
inherited

Operators

operator +(Component component) Entity
Adds component to the entity.
operator -(Type t) Entity
Removes component from the entity.
operator ==(Object other) bool
The equality operator.
inherited

Static Methods

fromJson(Map<String, dynamic> json, EntitySystem system) Entity