use of org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem in project Terasology by MovingBlocks.
the class AwaitCharacterSpawn method step.
@Override
public boolean step() {
ComponentSystemManager componentSystemManager = context.get(ComponentSystemManager.class);
for (UpdateSubscriberSystem updater : componentSystemManager.iterateUpdateSubscribers()) {
updater.update(0.0f);
}
LocalPlayer localPlayer = context.get(LocalPlayer.class);
ClientComponent client = localPlayer.getClientEntity().getComponent(ClientComponent.class);
if (client != null && client.character.exists()) {
client.character.send(new AwaitedLocalCharacterSpawnEvent());
return true;
} else {
chunkProvider.update();
}
return false;
}
use of org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem in project Terasology by MovingBlocks.
the class StateIngame method update.
@Override
public void update(float delta) {
eventSystem.process();
for (UpdateSubscriberSystem system : componentSystemManager.iterateUpdateSubscribers()) {
PerformanceMonitor.startActivity(system.getClass().getSimpleName());
system.update(delta);
PerformanceMonitor.endActivity();
}
if (worldRenderer != null && shouldUpdateWorld()) {
worldRenderer.update(delta);
}
if (storageManager != null) {
storageManager.update();
}
if (nuiManager != null) {
updateUserInterface(delta);
}
storageServiceWorker.flushNotificationsToConsole(console);
}
use of org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem in project Terasology by MovingBlocks.
the class ComponentSystemManagerTest method testRegisterUpdateSubscriberAddsSubscriber.
@Test
public void testRegisterUpdateSubscriberAddsSubscriber() {
UpdateSubscriberSystem system = mock(UpdateSubscriberSystem.class);
systemUnderTest.register(system);
assertEquals(Iterables.size(systemUnderTest.iterateUpdateSubscribers()), 1);
}
use of org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem in project Terasology by MovingBlocks.
the class ComponentSystemManagerTest method testShutdownRemovesUpdateSubscribers.
@Test
public void testShutdownRemovesUpdateSubscribers() {
UpdateSubscriberSystem system = mock(UpdateSubscriberSystem.class);
systemUnderTest.register(system);
systemUnderTest.shutdown();
assertEquals(Iterables.size(systemUnderTest.iterateUpdateSubscribers()), 0);
}
Aggregations