com.artemis.systems.event.EventVoidSystem Maven / Gradle / Ivy
package com.artemis.systems.event;
import com.artemis.systems.VoidEntitySystem;
import com.badlogic.gdx.utils.Array;
/**
* Void Entity System for processing a single event. Reduces boiler plate for event
* processing systems.
*
* @author apotapov
*
* @param Event that this system processes.
*/
public abstract class EventVoidSystem extends VoidEntitySystem {
Array events;
Class eventType;
/**
* Constructs an event system
* @param eventType Class of event this system will process.
*/
public EventVoidSystem(Class eventType) {
this.eventType = eventType;
this.events = new Array();
}
@Override
public final void processSystem() {
world.getEvents(this, eventType, events);
for (T event : events) {
processEvent(event);
}
}
/**
* Processes the event.
*
* @param event Event to process
*/
protected abstract void processEvent(T event);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy