operator - method
Removes component from the entity.
Implementation
Entity operator -(Type t) {
assert(isDestroyed.value, 'Tried removing component from destroyed entity: ${toJson()}');
var component = components.value[t];
if (component != null) {
// Call onRemoved.
component.onRemoved();
final copy = Map<Type, Component>.from(components.value);
// Created copy and removed this component.
copy.remove(t);
// Set value of the subject.
components.add(copy);
}
return this;
}