Dart Documentationentity_stateComponentModifier<T>

ComponentModifier<T> class

class ComponentModifier<T> {
 final ComponentType type;
 final ModifyComponent<T> modifyComponent;

 //TODO use generic to define ctype and secure that ctype == T
 //(see https://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/tests/language/type_parameter_literal_test.dart)
 ComponentModifier(Type ctype, this.modifyComponent) : type = ComponentTypeManager.getTypeFor(ctype);

 void applyE(Entity e) {
   var c = e.getComponent(type);
   applyC(e.getComponent(type));
 }
 void applyC(T c) {
   if (c != null) modifyComponent(c);
 }
}

Constructors

new ComponentModifier(Type ctype, ModifyComponent modifyComponent) #

ComponentModifier(Type ctype, this.modifyComponent) : type = ComponentTypeManager.getTypeFor(ctype);

Properties

final ModifyComponent modifyComponent #

final ModifyComponent<T> modifyComponent

final ComponentType type #

final ComponentType type

Methods

void applyC(T c) #

void applyC(T c) {
 if (c != null) modifyComponent(c);
}

void applyE(Entity e) #

void applyE(Entity e) {
 var c = e.getComponent(type);
 applyC(e.getComponent(type));
}