/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.jme3.animation.AnimControl
 *  com.jme3.bullet.collision.shapes.CapsuleCollisionShape
 *  com.jme3.bullet.collision.shapes.CollisionShape
 *  com.jme3.bullet.control.GhostControl
 *  com.jme3.effect.ParticleEmitter
 *  com.jme3.effect.ParticleMesh$Type
 *  com.jme3.material.Material
 *  com.jme3.math.ColorRGBA
 *  com.jme3.math.Quaternion
 *  com.jme3.math.Vector3f
 *  com.jme3.scene.Spatial
 *  com.jme3.scene.control.Control
 */
package mygame;

import com.jme3.animation.AnimControl;
import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;
import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.control.GhostControl;
import com.jme3.effect.ParticleEmitter;
import com.jme3.effect.ParticleMesh;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;
import com.jme3.scene.control.Control;
import mygame.Character;
import mygame.Exchange;

public class PowerUpShield
extends Character {
    public GhostControl collision;

    public PowerUpShield(String name) {
        super(name);
        this.setModel();
        this.setupControl();
    }

    public void setupModelControl() {
        this.modelAnimControl = (AnimControl)this.model.getControl(AnimControl.class);
        this.modelAnimChannel = this.modelAnimControl.createChannel();
        this.modelAnimChannel.setAnim("normal");
        this.modelAnimChannel.setSpeed(0.5f);
    }

    void setupModel() {
        this.wholeBody.attachChild(this.model);
    }

    public void setupControl() {
        this.collision = new GhostControl((CollisionShape)new CapsuleCollisionShape(1.0f, 0.5f));
        this.collision.addCollideWithGroup(2);
        this.addControl((Control)this.collision);
        Exchange.bulletAppState.getPhysicsSpace().add((Object)this.collision);
    }

    public void setModel() {
        this.model = Exchange.assetManager.loadModel("Models/shield/shield.mesh.j3o");
        this.model.setMaterial(Exchange.assetManager.loadMaterial("Materials/PowerUpShield.j3m"));
        this.model.rotate(new Quaternion().fromAngleAxis((float)Math.PI, new Vector3f(0.0f, 1.0f, 0.0f)));
        this.model.setLocalTranslation(0.0f, 1.0f, 0.0f);
        this.setLocalScale(0.5f);
        this.setupModel();
        this.setupModelControl();
        this.wholeBody.attachChild(this.model);
        ParticleEmitter bobble = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 1);
        Material mat_red = Exchange.assetManager.loadMaterial("Materials/bubble.j3m");
        bobble.setMaterial(mat_red);
        bobble.setImagesX(1);
        bobble.setImagesY(1);
        bobble.setEndColor(new ColorRGBA(1.0f, 1.0f, 0.0f, 0.75f));
        bobble.setStartColor(new ColorRGBA(1.0f, 1.0f, 0.0f, 1.0f));
        bobble.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f, 0.0f, 0.0f));
        bobble.setStartSize(1.0f);
        bobble.setEndSize(1.1f);
        bobble.setGravity(0.0f, 0.0f, 0.0f);
        bobble.setLowLife(1.0f);
        bobble.setHighLife(1.0f);
        bobble.getParticleInfluencer().setVelocityVariation(0.0f);
        this.attachChild((Spatial)bobble);
    }

    public void kill() {
        this.removeFromParent();
    }
}
