-
Notifications
You must be signed in to change notification settings - Fork 20
Operations Plugin
Daan van Yperen edited this page May 31, 2019
·
1 revision
All platforms
Per-entity operations DSL to transform components over time. Allows you to run actions in series or parallel. Similar to libGDX actions or artemis-orion. Actions are pooled.
<parent>
<groupId>net.mostlyoriginal.artemis-odb</groupId>
<artifactId>contrib-plugin-operations</artifactId>
<version>2.4.0</version>
</parent>
mSchedule.create(entiyId).set(
sequence(
delay(milliseconds(500)),
MyOperationFactory.tintBetween(Color.RED, Color.BLUE, milliseconds(500)),
deleteFromWorld()
));
// register the plugin on your world configuration builder.
worldConfigurationBuilder.dependsOn(OperationsPlugin.class)
See the BasicOperation
hierarchy for examples.
public class MyOperationsFactory {
public static RemoveOperation remove(Class<? extends Component> componentClass)
{
final RemoveOperation operation = Operation.prepare(RemoveOperation.class);
operation.componentClass = componentClass;
return operation;
}
}
public class RemoveOperation extends BasicOperation {
public Class<? extends Component> componentClass;
public RemoveOperation() {
}
@Override
public void process(Entity e) {
e.edit().remove(componentClass);
}
@Override
public void reset() {
super.reset();
componentClass = null;
}
}