die

final Unit die(GameEntity entity)

Removes entity from game world. This method is basically an inverse of tryAddToWorld method.

To ensure thread-safety, this method does not perform almost any action at call-time. Instead, it creates a special self-destruct LifeEnded message and sends it to entity, and therefore entity only gets removed when it processes that message itself. Consequently, entity might still exist in game world for some time even after this method returns.

Before receiving the LifeEnded, entity will also receive Dying message.

Also, the hero will receive the experience from this entity as defined by GameEntity.ExperienceEntity.

Parameters

entity

The entity to be removed from game world.