addAllToWorld

final Unit addAllToWorld(Set<GameEntity> entities, Function0<Unit> preStartAction)

Adds several entities to game world at once.

Unlike tryAddToWorld, if some of the entities can't be added, this method throws an IllegalStateException.

After all entities were successfully added to all engines, all entities receive a LifeStarted message and their coroutines are started.

This method also allows to execute some action after all entities have been added to engines, but before any of them received a LifeStarted message.

Parameters

entities

The entities to add to game world.

preStartAction

The action to perform in between adding entities to engines and sending them a LifeStarted message.