Add game source, converter pipeline, and web port
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.jme3.light.Light
|
||||
* com.jme3.math.Vector3f
|
||||
* com.jme3.post.SceneProcessor
|
||||
* com.jme3.renderer.RenderManager
|
||||
* com.jme3.renderer.ViewPort
|
||||
* com.jme3.scene.control.AbstractControl
|
||||
* com.jme3.scene.control.Control
|
||||
*/
|
||||
package mygame;
|
||||
|
||||
import com.jme3.light.Light;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.post.SceneProcessor;
|
||||
import com.jme3.renderer.RenderManager;
|
||||
import com.jme3.renderer.ViewPort;
|
||||
import com.jme3.scene.control.AbstractControl;
|
||||
import com.jme3.scene.control.Control;
|
||||
import mygame.Exchange;
|
||||
import mygame.Fireball;
|
||||
import mygame.WalkingEnemy;
|
||||
|
||||
public class FireballControl
|
||||
extends AbstractControl {
|
||||
protected void controlUpdate(float tpf) {
|
||||
WalkingEnemy enemy;
|
||||
Fireball fireball = (Fireball)this.spatial;
|
||||
if (!fireball.explode) {
|
||||
fireball.bodyControl.setWalkDirection(fireball.direction);
|
||||
} else {
|
||||
fireball.bodyControl.setWalkDirection(Vector3f.ZERO);
|
||||
}
|
||||
Vector3f lightpos = fireball.collisionGhost.getPhysicsLocation();
|
||||
lightpos.setY(0.5f);
|
||||
fireball.light.setPosition(lightpos);
|
||||
int i = 0;
|
||||
while (true) {
|
||||
Exchange cfr_ignored_0 = fireball.exchange;
|
||||
if (i >= Exchange.enemies.size()) break;
|
||||
Exchange cfr_ignored_1 = fireball.exchange;
|
||||
enemy = Exchange.enemies.get(i);
|
||||
if (fireball.collisionGhost.getOverlappingObjects().contains(enemy.ghost)) {
|
||||
fireball.explode = true;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
if (fireball.explode) {
|
||||
i = 0;
|
||||
while (true) {
|
||||
Exchange cfr_ignored_2 = fireball.exchange;
|
||||
if (i >= Exchange.enemies.size()) break;
|
||||
Exchange cfr_ignored_3 = fireball.exchange;
|
||||
enemy = Exchange.enemies.get(i);
|
||||
if (fireball.damageAreaGhost.getOverlappingObjects().contains(enemy.ghost)) {
|
||||
enemy.doDamage(100.0f);
|
||||
fireball.explode();
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
fireball.lifetime -= tpf;
|
||||
if (fireball.lifetime <= 0.0f && !fireball.explode) {
|
||||
fireball.explode();
|
||||
}
|
||||
if (fireball.timer > 0.0f) {
|
||||
fireball.timer += tpf;
|
||||
if ((double)fireball.timer > 0.2) {
|
||||
fireball.bodyControl.setEnabled(false);
|
||||
fireball.removeControl((Control)fireball.bodyControl);
|
||||
fireball.removeControl((Control)fireball.collisionGhost);
|
||||
fireball.collisionGhost.setEnabled(false);
|
||||
fireball.removeControl((Control)fireball.damageAreaGhost);
|
||||
fireball.damageAreaGhost.setEnabled(false);
|
||||
fireball.fire.setEnabled(false);
|
||||
}
|
||||
if (fireball.timer > 2.0f) {
|
||||
fireball.removeFromParent();
|
||||
Exchange.viewPort.removeProcessor((SceneProcessor)fireball.dlsr);
|
||||
Exchange.rootNode.removeLight((Light)fireball.light);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void controlRender(RenderManager rm, ViewPort vp) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user