net.mostlyoriginal.api.operation.flow.ParallelOperation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of contrib-plugin-operations Show documentation
Show all versions of contrib-plugin-operations Show documentation
Scheduled operations on entities and components.
package net.mostlyoriginal.api.operation.flow;
import com.artemis.Entity;
import net.mostlyoriginal.api.operation.common.Operation;
import net.mostlyoriginal.api.operation.common.OperationFlow;
/**
* Run operations in parallel.
*
* @author Daan van Yperen
*/
public class ParallelOperation extends OperationFlow {
@Override
public boolean process(float delta, Entity e) {
if ( isCompleted() ) return true;
boolean operationsRemain = false;
for (int i = 0; i < operations.size; i++) {
if (!e.isActive()) break;
final Operation operation = operations.get(i);
if (!operation.process(delta, e)) {
operationsRemain = true;
}
}
completed = !operationsRemain;
return completed;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy