Files
Wackelpeter/decompiled/mygame/Staff.java
T

77 lines
2.3 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.animation.LoopMode
* com.jme3.asset.AssetManager
* com.jme3.audio.AudioNode
* com.jme3.bullet.control.GhostControl
* com.jme3.math.Ray
* com.jme3.math.Vector3f
* com.jme3.scene.Spatial
*/
package mygame;
import com.jme3.animation.LoopMode;
import com.jme3.asset.AssetManager;
import com.jme3.audio.AudioNode;
import com.jme3.bullet.control.GhostControl;
import com.jme3.math.Ray;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;
import mygame.Exchange;
import mygame.Fireball;
import mygame.Player;
import mygame.Weapon;
public class Staff
extends Weapon {
GhostControl ghost;
AssetManager assetManager;
public Staff(String name) {
super(name);
}
public Staff(String name, AssetManager am, Exchange ex) {
super(name);
this.assetManager = am;
this.exchange = ex;
this.COOLDOWN1_TIME = 5.0f;
this.COOLDOWN2_TIME = 50.0f;
}
protected void setupControl() {
}
public void skill1() {
if (this.cooldown1 <= 0.0f) {
this.cooldown1 = this.COOLDOWN1_TIME;
this.modelAnimChannel.setAnim("skill1");
Player player = (Player)this.getParent().getParent();
Ray ray = new Ray(this.getWorldTranslation(), player.pt);
Vector3f direction = player.pt.subtract(this.getWorldTranslation()).normalize().mult(25.0f);
direction.setY(0.0f);
this.modelAnimChannel.setLoopMode(LoopMode.DontLoop);
Fireball fireball = new Fireball(this.assetManager, direction, player.getLocalTranslation(), this.exchange);
}
}
public void skill2() {
if (this.cooldown2 <= 0.0f) {
this.cooldown2 = this.COOLDOWN2_TIME;
AudioNode hit = new AudioNode(this.assetManager, "Sounds/Effects/teleport.ogg", false);
hit.setLooping(false);
hit.setPositional(true);
hit.setLocalTranslation(this.getLocalTranslation());
hit.setVolume(5.0f);
this.attachChild((Spatial)hit);
hit.play();
Player player = (Player)Exchange.getRootNode().getChild("Player");
Vector3f place = player.pt;
place.setY(1.0f);
player.playerControl.warp(place);
}
}
}