Search in sources :

Example 1 with DeathScreen

use of org.terasology.engine.rendering.nui.layers.ingame.DeathScreen in project Terasology by MovingBlocks.

the class MenuControlSystem method onPlayerDeath.

@ReceiveEvent(components = CharacterComponent.class)
public void onPlayerDeath(PlayerDeathEvent event, EntityRef character) {
    EntityRef client = character.getComponent(CharacterComponent.class).controller;
    if (client.getComponent(ClientComponent.class).local) {
        nuiManager.removeOverlay("engine:onlinePlayersOverlay");
        nuiManager.pushScreen("engine:deathScreen");
        if (event.damageTypeName != null) {
            ((DeathScreen) nuiManager.getScreen("engine:deathScreen")).setDeathDetails(event.instigatorName, event.damageTypeName);
        }
    }
}
Also used : DeathScreen(org.terasology.engine.rendering.nui.layers.ingame.DeathScreen) CharacterComponent(org.terasology.engine.logic.characters.CharacterComponent) EntityRef(org.terasology.engine.entitySystem.entity.EntityRef) ClientComponent(org.terasology.engine.network.ClientComponent) ReceiveEvent(org.terasology.engine.entitySystem.event.ReceiveEvent)

Aggregations

EntityRef (org.terasology.engine.entitySystem.entity.EntityRef)1 ReceiveEvent (org.terasology.engine.entitySystem.event.ReceiveEvent)1 CharacterComponent (org.terasology.engine.logic.characters.CharacterComponent)1 ClientComponent (org.terasology.engine.network.ClientComponent)1 DeathScreen (org.terasology.engine.rendering.nui.layers.ingame.DeathScreen)1