com.artemis.systems.event.EventVoidSystem2 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 EventVoidSystem2 extends VoidEntitySystem {
Array events;
Class eventType;
Array events2;
Class eventType2;
/**
* Constructs an event system
* @param eventType Class of the first event this system will process.
* @param eventType2 Class of the second event this system will process.
*/
public EventVoidSystem2(Class eventType, Class eventType2) {
this.eventType = eventType;
this.events = new Array();
this.eventType2 = eventType2;
this.events2 = new Array();
}
@Override
public final void processSystem() {
world.getEvents(this, eventType, events);
for (T event : events) {
processEvent(event);
}
world.getEvents(this, eventType2, events2);
for (U event : events2) {
processEvent2(event);
}
}
/**
* Processes the first event.
*
* @param event Event to process
*/
protected abstract void processEvent(T event);
/**
* Processes the second event.
*
* @param event Event to process
*/
protected abstract void processEvent2(U event);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy