System_Animator class
class System_Animator extends EntityProcessingSystem {
 ComponentMapper<Animatable> _animatableMapper;
 double _tickTime = 0.0;
 System_Animator() : super(Aspect.getAspectForAllOf([Animatable]));
 void initialize(){
   _animatableMapper = new ComponentMapper<Animatable>(Animatable, world);
 }
 void begin() {
   _tickTime += world.delta;
   //if (_tickTime < 10000) print("_tickTime ${_tickTime}");
 }
 void processEntity(Entity entity) {
   var animatable = _animatableMapper.get(entity);
   animatable.l.iterateAndUpdate((anim) {
     if (anim._t0 < 0) {
       anim._t0 = _tickTime;
       anim.onBegin(entity, _tickTime, anim._t0);
     }
     var cont = (anim._t0 <= _tickTime)? anim.onTick(entity, _tickTime, anim._t0) : true;
     if (!cont) {
       anim.onEnd(entity, _tickTime, anim._t0);
     }
     return cont ? anim : anim.next;
   });
 }
}
Extends
EntitySystem > EntityProcessingSystem > System_Animator
Constructors
new System_Animator() #
Create a new EntityProcessingSystem. It requires at least one component.
System_Animator() : super(Aspect.getAspectForAllOf([Animatable]));
Properties
Methods
void begin() #
Called before processing of entities begins.
void begin() {
 _tickTime += world.delta;
 //if (_tickTime < 10000) print("_tickTime ${_tickTime}");
}
bool checkProcessing() #
Returns true if the system should be processed, false if not.
bool checkProcessing() => true;
void deleted(Entity e) #
void deleted(Entity e) {
 if (_contains(e)) {
   _removeFromSystem(e);
 }
}
void disabled(Entity e) #
void disabled(Entity e) {
 if (_contains(e)) {
   _removeFromSystem(e);
 }
}
void end() #
Called after the processing of entities ends.
void end() {}
void initialize() #
Override to implement code that gets executed when systems are initialized.
void initialize(){
 _animatableMapper = new ComponentMapper<Animatable>(Animatable, world);
}
void inserted(Entity entity) #
Called if the system has received an entity it is interested in, e.g. created or a component was added to it.
void inserted(Entity entity) {}
void process() #
This is the only method that is supposed to be called from outside the library,
void process() {
 if(checkProcessing()) {
   begin();
   processEntities(_actives.readOnly);
   end();
 }
}
void processEntities(ReadOnlyBag<Entity> entities) #
Any implementing entity system must implement this method and the logic to process the given entities of the system.
void processEntities(ReadOnlyBag<Entity> entities) => entities.forEach((entity) => processEntity(entity));
void processEntity(Entity entity) #
Process a entity this system is interested in.
void processEntity(Entity entity) {
 var animatable = _animatableMapper.get(entity);
 animatable.l.iterateAndUpdate((anim) {
   if (anim._t0 < 0) {
     anim._t0 = _tickTime;
     anim.onBegin(entity, _tickTime, anim._t0);
   }
   var cont = (anim._t0 <= _tickTime)? anim.onTick(entity, _tickTime, anim._t0) : true;
   if (!cont) {
     anim.onEnd(entity, _tickTime, anim._t0);
   }
   return cont ? anim : anim.next;
 });
}
void removed(Entity entity) #
Called if an entity was removed from this system, e.g. deleted or had one of it's components removed.
void removed(Entity entity) {}