All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.artemis.systems.IntervalEntityProcessingSystem Maven / Gradle / Ivy

package com.artemis.systems;

import com.artemis.Entity;
import com.artemis.Filter;
import com.badlogic.gdx.utils.Array;

/**
 * If you need to process entities at a certain interval then use this.
 * A typical usage would be to regenerate ammo or health at certain intervals,
 * no need to do that every game loop, but perhaps every 100 ms. or every second.
 * 
 * @author Arni Arent
 *
 */
public abstract class IntervalEntityProcessingSystem extends IntervalEntitySystem {

    public IntervalEntityProcessingSystem(Filter filter, float interval) {
        super(filter, interval);
    }

    /**
     * Process a entity this system is interested in.
     * @param e the entity to process.
     */
    protected abstract void process(Entity e);


    @Override
    protected void processEntities(Array entities) {
        for (int i = 0, s = entities.size; s > i; i++) {
            process(entities.get(i));
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy