43 lines
1.5 KiB
Java
43 lines
1.5 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.jme3.math.Vector3f
|
|
* com.jme3.renderer.RenderManager
|
|
* com.jme3.renderer.ViewPort
|
|
* com.jme3.scene.control.AbstractControl
|
|
*/
|
|
package mygame;
|
|
|
|
import com.jme3.math.Vector3f;
|
|
import com.jme3.renderer.RenderManager;
|
|
import com.jme3.renderer.ViewPort;
|
|
import com.jme3.scene.control.AbstractControl;
|
|
import mygame.WalkingEnemy;
|
|
|
|
public class WalkingEnemyControl
|
|
extends AbstractControl {
|
|
public WalkingEnemy walkingEnemy;
|
|
|
|
protected void controlUpdate(float tpf) {
|
|
this.walkingEnemy = (WalkingEnemy)this.spatial;
|
|
if (!this.walkingEnemy.dead) {
|
|
Vector3f walkdirection = new Vector3f(this.walkingEnemy.walkingEnemyControl.getViewDirection().x, 0.0f, this.walkingEnemy.walkingEnemyControl.getViewDirection().z).normalize().mult(6.0f);
|
|
if (this.walkingEnemy.reverseWalk > 0.0f) {
|
|
walkdirection.negateLocal();
|
|
this.walkingEnemy.reverseWalk -= tpf;
|
|
}
|
|
this.walkingEnemy.walkingEnemyControl.setViewDirection(this.spatial.getParent().getChild("Player").getLocalTranslation().subtract(this.spatial.getLocalTranslation()));
|
|
this.walkingEnemy.walkingEnemyControl.setWalkDirection(walkdirection);
|
|
} else {
|
|
this.walkingEnemy.deadtimer += tpf;
|
|
if (this.walkingEnemy.deadtimer > 10.0f) {
|
|
this.walkingEnemy.removeFromParent();
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void controlRender(RenderManager rm, ViewPort vp) {
|
|
}
|
|
}
|