当前位置: 首页>>代码示例>>Java>>正文


Java ParticleEmitter.addControl方法代码示例

本文整理汇总了Java中com.jme3.effect.ParticleEmitter.addControl方法的典型用法代码示例。如果您正苦于以下问题:Java ParticleEmitter.addControl方法的具体用法?Java ParticleEmitter.addControl怎么用?Java ParticleEmitter.addControl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.effect.ParticleEmitter的用法示例。


在下文中一共展示了ParticleEmitter.addControl方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(final Node root, Vector3f location,
        String p) {
    final ParticleEmitter fire = createFire(5f);
    root.attachChild(fire);

    final AudioNode sound = new AudioNode(Globals.assets,
            "Effects/Sound/Firewalk.wav");
    root.attachChild(sound);
    sound.setPositional(true);
    sound.setReverbEnabled(false);
    sound.setVolume(1f);
    sound.play();

    return () -> {
        sound.stop();
        sound.removeFromParent();
        fire.setParticlesPerSec(0f);

        CTimedExistence timedExistence = new CTimedExistence(1f);
        fire.addControl(timedExistence);
    };
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:24,代码来源:EtherealFlame.java

示例2: exec

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public void exec(World world, int reason) {
    if (reason != RemovalReasons.EXPIRED) {
        return;
    }

    Vector3f worldTranslation = cloud.getParent().getWorldTranslation();

    ParticleEmitter wave = createShockwave();
    world.getWorldRoot().attachChild(wave);
    wave.setLocalTranslation(worldTranslation);
    wave.emitAllParticles();
    wave.addControl(new CTimedExistence(4f));

    AudioNode sound = new AudioNode(Globals.assets,
            "Effects/Sound/IntoTheShadows.wav");
    sound.setPositional(true);
    sound.setReverbEnabled(false);
    sound.setVolume(1f);
    sound.setLocalTranslation(worldTranslation);
    sound.play();
    sound.addControl(new CTimedExistence(4f));
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:24,代码来源:IntoTheShadows.java

示例3: createSmallExplosion

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void createSmallExplosion(Node root, Vector3f location) {
    ParticleEmitter fire = new ParticleEmitter("shotgun-explosion",
            ParticleMesh.Type.Triangle, 20);

    Material material = new Material(assetManager,
            "Common/MatDefs/Misc/Particle.j3md");
    material.setTexture("Texture",
            assetManager.loadTexture("Effects/flame.png"));
    fire.setMaterial(material);
    fire.setImagesX(2);
    fire.setImagesY(2);
    fire.setSelectRandomImage(true);
    fire.setGravity(Vector3f.ZERO);

    fire.setRandomAngle(true);

    fire.setStartColor(new ColorRGBA(0.95f, 0.150f, 0.0f, 0.40f));
    fire.setEndColor(new ColorRGBA(1.0f, 1.0f, 0.0f, 0.0f));
    fire.setLowLife(0.1f);
    fire.setHighLife(0.3f);
    fire.setNumParticles(100);
    fire.setStartSize(0.50f);
    fire.setEndSize(1.0f);
    fire.getParticleInfluencer()
            .setInitialVelocity(Vector3f.UNIT_X.mult(1.0f));
    fire.getParticleInfluencer().setVelocityVariation(6f);

    fire.setShape(new EmitterSphereShape(Vector3f.ZERO, 0.2f));
    fire.setParticlesPerSec(0f);

    root.attachChild(fire);
    fire.setLocalTranslation(location);
    fire.emitAllParticles();
    fire.addControl(new CTimedExistence(1f));
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:36,代码来源:PelletBuilder.java

示例4: createSmokePuff

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void createSmokePuff(Node root, Vector3f location) {
    ParticleEmitter smokePuff = new ParticleEmitter("smoke-puff",
            ParticleMesh.Type.Triangle, 20);
    Material material = new Material(assetManager,
            "Common/MatDefs/Misc/Particle.j3md");
    material.setTexture("Texture",
            assetManager.loadTexture("Effects/flame_alpha.png"));
    material.getAdditionalRenderState()
            .setBlendMode(RenderState.BlendMode.Alpha);
    smokePuff.setMaterial(material);
    smokePuff.setImagesX(2);
    smokePuff.setImagesY(2);
    smokePuff.setSelectRandomImage(true);
    smokePuff.setStartColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.2f));
    smokePuff.setStartColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.1f));
    smokePuff.getParticleInfluencer()
            .setInitialVelocity(Vector3f.UNIT_X.mult(5f));
    smokePuff.getParticleInfluencer().setVelocityVariation(1f);
    smokePuff.setStartSize(2f);
    smokePuff.setEndSize(6f);
    smokePuff.setGravity(Vector3f.ZERO);
    smokePuff.setLowLife(0.75f);
    smokePuff.setHighLife(1f);
    smokePuff.setParticlesPerSec(0f);
    smokePuff.setRandomAngle(true);
    smokePuff.setShape(new EmitterSphereShape(Vector3f.ZERO, 4f));

    root.attachChild(smokePuff);
    smokePuff.setLocalTranslation(location);
    smokePuff.emitAllParticles();
    smokePuff.addControl(new CTimedExistence(1f));
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:33,代码来源:PelletBuilder.java

示例5: execute

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f loc, String p) {
    float characterRadius = root.getUserData(UserData.RADIUS);
    ParticleEmitter e = FireballBuilder.createFireEmitter();
    e.setStartSize(e.getStartSize() * 0.5f);
    e.setEndSize(e.getEndSize() * 0.5f);
    e.setParticlesPerSec(e.getParticlesPerSec() * 0.5f);
    e.setLocalTranslation(0f, 10f, characterRadius / 1.2f);
    root.attachChild(e);        
    e.addControl(new CTimedExistence(Fireball.CAST_TIME));
    return null;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:13,代码来源:Fireball.java

示例6: execute

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f loc, String p) {
    Node weapon = (Node) root.getChild("weapon");
    float antiScale = 1f / weapon.getWorldScale().x;
    ParticleEmitter e = RocketBuilder.createFireEmitter();
    e.setStartSize(e.getStartSize() * 0.33f);
    e.setEndSize(e.getEndSize() * 0.33f);
    weapon.attachChild(e);
    e.setLocalTranslation(0f, 0.7f * antiScale, 4f * antiScale);
    e.addControl(new CTimedExistence(Plasmagun.CAST_TIME));
    return null;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:13,代码来源:RocketLauncher.java

示例7: exec

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public void exec(World world, int reason) {
    Vector3f worldTranslation = fire.getParent().getLocalTranslation();

    Node node = new Node("rocket-explosion");
    world.getWorldRoot().attachChild(node);
    node.setLocalTranslation(worldTranslation);

    leaveSmokeTrail(node);
    createSmokePuff(node);

    fire.removeFromParent();
    node.attachChild(fire);
    node.attachChild(sound);
    fire.setLocalTranslation(Vector3f.ZERO);
    node.addControl(new CTimedExistence(6f));

    fire.setStartColor(new ColorRGBA(0.95f, 0.150f, 0.0f, 0.40f));
    fire.setEndColor(new ColorRGBA(1.0f, 1.0f, 0.0f, 0.0f));
    fire.setLowLife(0.4f);
    fire.setHighLife(0.5f);
    fire.setNumParticles(120);
    fire.setStartSize(7.50f);
    fire.setEndSize(25f);
    fire.getParticleInfluencer()
            .setInitialVelocity(Vector3f.UNIT_X.mult(45.0f));
    fire.getParticleInfluencer().setVelocityVariation(1f);

    fire.emitAllParticles();
    fire.setParticlesPerSec(0.0f);

    ParticleEmitter wave = createShockwave();
    world.getWorldRoot().attachChild(wave);
    wave.setLocalTranslation(worldTranslation);
    wave.emitAllParticles();
    wave.addControl(new CTimedExistence(4f));

    sound.setVolume(5f);
    sound.play();
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:41,代码来源:RocketLauncher.java

示例8: execute

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f loc, String p) {
    Node weapon = (Node) root.getChild("weapon");
    float antiScale = 1f / weapon.getWorldScale().x;
    ParticleEmitter e = PlasmaBuilder.createPlasmaEmitter();
    e.setStartSize(e.getStartSize() * 0.33f);
    e.setEndSize(e.getEndSize() * 0.33f);
    weapon.attachChild(e);
    e.setLocalTranslation(0f, 0.7f * antiScale, 4f * antiScale);
    e.addControl(new CTimedExistence(Plasmagun.CAST_TIME));
    return null;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:13,代码来源:Plasmagun.java

示例9: execute

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f loc, String p) {
    Node weapon = (Node) root.getChild("weapon");
    float antiScale = 1f / weapon.getWorldScale().x;
    ParticleEmitter e = createEmitter();
    weapon.attachChild(e);
    e.setLocalTranslation(0f, 0.7f * antiScale, 4f * antiScale);
    e.emitAllParticles();
    e.addControl(new CTimedExistence(time));
    return null;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:12,代码来源:Railgun.java

示例10: execute

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f location,
        String parameter) {
    CCharacterPhysics phys = root.getControl(CCharacterPhysics.class);
    float height = phys.getCapsuleShape().getHeight();
    Vector3f startLocation = new Vector3f(root.getWorldTranslation())
            .setY(height);
    soundEffect.execute(null, startLocation, null);

    Vector3f vel = phys.getViewDirection().normalize()
            .multLocal(RANGE / 0.3f);

    final ParticleEmitter emitter = createWave(vel);
    emitter.setLocalTranslation(startLocation);
    root.getParent().attachChild(emitter);

    CActionQueue actionQueue = new CActionQueue();
    emitter.addControl(actionQueue);
    actionQueue.enqueueAction(new ADelay(0.2f));
    actionQueue.enqueueAction(new EntityAction() {

        @Override
        public boolean update(float tpf) {
            emitter.setParticlesPerSec(0f);
            float timeToExist = emitter.getLowLife();
            emitter.addControl(new CTimedExistence(timeToExist));

            return false;
        }
    });

    return null;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:34,代码来源:FeralScream.java

示例11: execute

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f location, String p) {
    SimpleSoundEffect earthQuake =
            new SimpleSoundEffect("Effects/Sound/EarthQuake.wav");
    earthQuake.setVolume(1.5f);
    earthQuake.execute(root, location, null);

    ParticleEmitter emitter = createParticleEffect();
    root.attachChild(emitter);
    emitter.setLocalTranslation(location);
    emitter.emitAllParticles();
    emitter.addControl(new CTimedExistence(14f));
    return null;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:15,代码来源:EarthQuakeEffect.java

示例12: execute

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f location, String p) {
    SimpleSoundEffect earthQuake =
            new SimpleSoundEffect("Effects/Sound/EarthQuake.wav");
    earthQuake.setVolume(1.5f);
    earthQuake.execute(root, location, null);

    ParticleEmitter emitter = createParticleEffect();
    root.attachChild(emitter);
    emitter.setLocalTranslation(location.add(0, 1f, 0));
    emitter.emitAllParticles();
    emitter.addControl(new CTimedExistence(1f));
    return null;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:15,代码来源:TossHitEffect.java

示例13: exec

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public void exec(World world, int reason) {
    if (reason != RemovalReasons.COLLISION) {
        return;
    }
    Vector3f worldTranslation = fireEmitter.getParent().getLocalTranslation();
    world.getWorldRoot().attachChild(sound);
    sound.setLocalTranslation(worldTranslation);
    sound.play();

    fireEmitter.removeFromParent();
    world.getWorldRoot().attachChild(fireEmitter);

    fireEmitter.setLocalTranslation(worldTranslation);
    fireEmitter.addControl(new CTimedExistence(4f));
    fireEmitter.getParticleInfluencer()
            .setInitialVelocity(new Vector3f(1f, 0.01f, 1f).mult(16.0f));
    fireEmitter.getParticleInfluencer().setVelocityVariation(1f);
    fireEmitter.setStartSize(6f);
    fireEmitter.setEndSize(40f);
    fireEmitter.setLowLife(2f);
    fireEmitter.setHighLife(2f);
    fireEmitter.setEndColor(new ColorRGBA(1f, 1f, 0f, 0.01f));
    fireEmitter.setShape(new EmitterSphereShape(Vector3f.ZERO, 6.0f));

    fireEmitter.setNumParticles(20);
    fireEmitter.emitAllParticles();
    fireEmitter.setParticlesPerSec(0f);
    fireEmitter.addControl(new CTimedExistence(4f));
    
    ParticleEmitter wave = createShockwave();
    world.getWorldRoot().attachChild(wave);
    
    wave.setLocalTranslation(worldTranslation);
    wave.emitAllParticles();
    wave.addControl(new CTimedExistence(4f));
    
    smokeEmitter.addControl(new CTimedExistence(4f));
    smokeEmitter.removeFromParent();
    world.getWorldRoot().attachChild(smokeEmitter);
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:42,代码来源:Meteor.java

示例14: build

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public Node build(BuildParameters params) {
    Sphere sphere = new Sphere(32, 32, 1);

    Geometry projectileGeom = new Geometry("projectile-geom", sphere);
    projectileGeom.setCullHint(Spatial.CullHint.Always);

    Node node = new Node("projectile");
    node.setLocalTranslation(params.location);
    node.attachChild(projectileGeom);

    // TODO: Give at least bit better material
    Material material = new Material(assets,
            "Common/MatDefs/Misc/Unshaded.j3md");
    material.setColor("Color", ColorRGBA.Yellow);
    node.setMaterial(material);

    node.setUserData(UserData.SPEED, 140f);
    node.setUserData(UserData.MASS, 0.30f);
    node.setUserData(UserData.DAMAGE, 210f);
    node.setUserData(UserData.IMPULSE_FACTOR, 23000f);

    if (world.isClient()) {
        ParticleEmitter fire = createFireEmitter();
        node.attachChild(fire);

        ParticleEmitter smokeTrail = createSmokeEmitter();
        node.attachChild(smokeTrail);

        ParticleEmitter smokePuff = createSmokePuff();
        world.getWorldRoot().attachChild(smokePuff);
        smokePuff.setLocalTranslation(params.location);
        smokePuff.addControl(new CTimedExistence(5f));
        smokePuff.emitAllParticles();

        node.addControl(new CEntityEvent());
        /**
         * Here we specify what happens on client side when fireball is
         * removed. In this case we want explosion effect.
         */
        ARocketRemoval removalAction = new ARocketRemoval(assets);
        removalAction.setFireEmitter(fire);
        removalAction.setSmokeTrail(smokeTrail);

        node.getControl(CEntityEvent.class)
                .setOnRemoval(removalAction);
    }

    SphereCollisionShape collisionShape = new SphereCollisionShape(6f);

    GhostControl characterCollision = new GhostControl(collisionShape);
    characterCollision.setCollideWithGroups(CollisionGroups.CHARACTERS);
    characterCollision.setCollisionGroup(CollisionGroups.PROJECTILES);
    node.addControl(characterCollision);
    
    RigidBodyControl physicsBody = new RigidBodyControl(collisionShape,
            (float) node.getUserData(UserData.MASS));
    /**
     * We don't want projectiles to collide with each other so we give them
     * their own collision group and prevent them from colliding with that
     * group.
     */
    physicsBody.setCollisionGroup(CollisionGroups.PROJECTILES);
    physicsBody.setCollideWithGroups(CollisionGroups.NONE);


    node.addControl(physicsBody);

    CProjectile projectileControl = new CProjectile();

    ASplash splash
            = new ASplash(25f, 120f, DistanceScaling.LINEAR, null);
    splash.setSpatial(node);
    projectileControl.setSplashAction(splash);

    node.addControl(projectileControl);
    final CSpellBuff buffControl = new CSpellBuff();
    node.addControl(buffControl);
    return node;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:81,代码来源:RocketLauncher.java


注:本文中的com.jme3.effect.ParticleEmitter.addControl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。