Examples of StaticSound


Examples of org.terasology.audio.StaticSound

    }

    @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.StaticSound

    public void onEnterBlock(OnEnterBlockEvent event, EntityRef entity, CharacterSoundComponent characterSounds) {
        // only play this sound if the feet hit the water
        if (event.getCharacterRelativePosition().y == 0 && characterSounds.lastSoundTime + MIN_TIME < time.getGameTimeInMs()) {
            boolean oldBlockIsLiquid = event.getOldBlock().isLiquid();
            boolean newBlockIsLiquid = event.getNewBlock().isLiquid();
            StaticSound sound = null;
            if (!oldBlockIsLiquid && newBlockIsLiquid) {
                sound = random.nextItem(characterSounds.enterWaterSounds);
            } else if (oldBlockIsLiquid && !newBlockIsLiquid) {
                sound = random.nextItem(characterSounds.leaveWaterSounds);
            }
View Full Code Here

Examples of org.terasology.audio.StaticSound

        @Override
        public void onInitialize() {
            AssetUri uri = getNode().sound;
            if (uri != null) {
                StaticSound snd = assetManager.loadAsset(uri, StaticSound.class);
                if (snd != null) {
                    if (actor().hasLocation()) {
                        Vector3f worldPosition = actor().location().getWorldPosition();
                        audioManager.playSound(snd, worldPosition, getNode().volume, AudioManager.PRIORITY_NORMAL, this);
                    } else {
View Full Code Here

Examples of org.terasology.audio.StaticSound

        BlockDamageModifierComponent blockDamageModifierComponent = event.getDamageType().getComponent(BlockDamageModifierComponent.class);
        // 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

Examples of org.terasology.audio.StaticSound

            dustBuilder.build();
        }

        BlockSounds sounds = family.getArchetypeBlock().getSounds();
        if (!sounds.getDigSounds().isEmpty()) {
            StaticSound sound = random.nextItem(sounds.getDigSounds());
            audioManager.playSound(sound, location);
        }
    }
View Full Code Here

Examples of org.terasology.audio.StaticSound

    private static List<StaticSound> resolveSounds(String sourceUri, List<String> soundAssets) {

        List<StaticSound> result = new ArrayList<>(soundAssets.size());

        for (String soundAsset : soundAssets) {
            StaticSound sound = Assets.getSound(soundAsset);
            if (sound == null) {
                logger.warn("Unable to find sound {} referenced by block sounds {}.",
                    soundAsset, sourceUri);
            } else {
                result.add(sound);
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.