Examples of PlaySoundEvent


Examples of org.terasology.audio.events.PlaySoundEvent

    @ReceiveEvent
    public void onRespawn(OnPlayerSpawnedEvent event, EntityRef character, CharacterSoundComponent characterSounds) {
        if (characterSounds.respawnSounds.size() > 0) {
            StaticSound sound = random.nextItem(characterSounds.respawnSounds);
            character.send(new PlaySoundEvent(character, sound, characterSounds.respawnVolume));
        }
    }
View Full Code Here

Examples of org.terasology.audio.events.PlaySoundEvent

    @ReceiveEvent
    public void onSwimStroke(SwimStrokeEvent event, EntityRef entity, CharacterSoundComponent characterSounds) {
        if (characterSounds.swimSounds.size() > 0 && characterSounds.lastSoundTime + MIN_TIME < time.getGameTimeInMs()) {
            StaticSound sound = random.nextItem(characterSounds.swimSounds);
            entity.send(new PlaySoundEvent(entity, sound, characterSounds.swimmingVolume));
            characterSounds.lastSoundTime = time.getGameTimeInMs();
            entity.saveComponent(characterSounds);
        }
    }
View Full Code Here

Examples of org.terasology.audio.events.PlaySoundEvent

                sound = random.nextItem(characterSounds.enterWaterSounds);
            } else if (oldBlockIsLiquid && !newBlockIsLiquid) {
                sound = random.nextItem(characterSounds.leaveWaterSounds);
            }
            if (sound != null) {
                entity.send(new PlaySoundEvent(entity, sound, characterSounds.diveVolume));
                characterSounds.lastSoundTime = time.getGameTimeInMs();
                entity.saveComponent(characterSounds);
            }
        }
    }
View Full Code Here

Examples of org.terasology.audio.events.PlaySoundEvent

            footstepSounds = block.getSounds().getStepSounds();
        }

        if (footstepSounds.size() > 0 && characterSounds.lastSoundTime + MIN_TIME < time.getGameTimeInMs()) {
            StaticSound sound = random.nextItem(footstepSounds);
            entity.send(new PlaySoundEvent(entity, sound, characterSounds.footstepVolume));
            characterSounds.lastSoundTime = time.getGameTimeInMs();
            entity.saveComponent(characterSounds);
        }
    }
View Full Code Here

Examples of org.terasology.audio.events.PlaySoundEvent

                sound = random.nextItem(characterSounds.jumpSounds);
            } else if (characterSounds.footstepSounds.size() > 0) {
                sound = random.nextItem(characterSounds.footstepSounds);
            }
            if (sound != null) {
                entity.send(new PlaySoundEvent(entity, sound, characterSounds.jumpVolume));
                characterSounds.lastSoundTime = time.getGameTimeInMs();
                entity.saveComponent(characterSounds);
            }
        }
    }
View Full Code Here

Examples of org.terasology.audio.events.PlaySoundEvent

                sound = random.nextItem(characterSounds.landingSounds);
            } else if (characterSounds.footstepSounds.size() > 0) {
                sound = random.nextItem(characterSounds.footstepSounds);
            }
            if (sound != null) {
                entity.send(new PlaySoundEvent(entity, sound, characterSounds.landingVolume));
                characterSounds.lastSoundTime = time.getGameTimeInMs();
                entity.saveComponent(characterSounds);
            }
        }
    }
View Full Code Here

Examples of org.terasology.audio.events.PlaySoundEvent

        if (velocity > healthComponent.horizontalDamageSpeedThreshold) {
            if (characterSounds.lastSoundTime + MIN_TIME < time.getGameTimeInMs()) {
                StaticSound sound = random.nextItem(characterSounds.landingSounds);
                if (sound != null) {
                    entity.send(new PlaySoundEvent(entity, sound, characterSounds.landingVolume));
                    characterSounds.lastSoundTime = time.getGameTimeInMs();
                    entity.saveComponent(characterSounds);
                }
            }
        }
View Full Code Here

Examples of org.terasology.audio.events.PlaySoundEvent

            } else if (!characterSounds.damageSounds.isEmpty()) {
                sound = random.nextItem(characterSounds.damageSounds);
            }

            if (sound != null) {
                entity.send(new PlaySoundEvent(entity, sound, characterSounds.damageVolume));
                characterSounds.lastSoundTime = time.getGameTimeInMs();
                entity.saveComponent(characterSounds);
            }
        }
    }
View Full Code Here

Examples of org.terasology.audio.events.PlaySoundEvent

    @ReceiveEvent
    public void onDeath(DestroyEvent event, EntityRef entity, CharacterSoundComponent characterSounds) {
        if (characterSounds.deathSounds.size() > 0) {
            StaticSound sound = random.nextItem(characterSounds.deathSounds);
            entity.send(new PlaySoundEvent(entity, sound, characterSounds.deathVolume));
        }
    }
View Full Code Here

Examples of org.terasology.audio.events.PlaySoundEvent

        // TODO: Configurable via block definition
        if (blockDamageModifierComponent == null || !blockDamageModifierComponent.skipPerBlockEffects) {
            BlockSounds sounds = block.getSounds();
            if (!sounds.getDestroySounds().isEmpty()) {
                StaticSound sound = random.nextItem(sounds.getDestroySounds());
                entity.send(new PlaySoundEvent(sound, 0.6f));
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.