mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-18 19:33:40 +01:00
cleanup
This commit is contained in:
parent
5959f36a21
commit
34ecd2277b
@ -8,14 +8,12 @@ import com.jme3.effect.ParticleMesh;
|
||||
import com.jme3.effect.shapes.EmitterSphereShape;
|
||||
import com.jme3.light.AmbientLight;
|
||||
import com.jme3.light.DirectionalLight;
|
||||
import com.jme3.light.PointLight;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.material.RenderState.FaceCullMode;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.FastMath;
|
||||
import com.jme3.math.Quaternion;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.renderer.Camera;
|
||||
import com.jme3.renderer.queue.RenderQueue;
|
||||
import com.jme3.renderer.queue.RenderQueue.ShadowMode;
|
||||
import com.jme3.scene.Geometry;
|
||||
@ -23,11 +21,9 @@ import com.jme3.scene.Node;
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.jme3.scene.shape.Box;
|
||||
import com.jme3.scene.shape.Cylinder;
|
||||
import com.jme3.scene.shape.Sphere;
|
||||
import com.jme3.shadow.DirectionalLightShadowRenderer;
|
||||
import com.jme3.shadow.EdgeFilteringMode;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.jme3.util.SkyFactory;
|
||||
import com.jme3.util.TangentBinormalGenerator;
|
||||
|
||||
import pp.monopoly.client.gui.BobTheBuilder;
|
||||
@ -35,13 +31,7 @@ import pp.monopoly.client.gui.CameraController;
|
||||
import pp.monopoly.client.gui.CameraInputHandler;
|
||||
import pp.monopoly.client.gui.Toolbar;
|
||||
import pp.monopoly.model.Board;
|
||||
import pp.monopoly.client.gui.FigureControl;
|
||||
|
||||
import static java.lang.Math.divideExact;
|
||||
import static pp.util.FloatMath.TWO_PI;
|
||||
import static pp.util.FloatMath.cos;
|
||||
import static pp.util.FloatMath.sin;
|
||||
import static pp.util.FloatMath.sqrt;
|
||||
|
||||
/**
|
||||
* Manages the rendering and visual aspects of the sea and sky in the Battleship game.
|
||||
@ -77,15 +67,10 @@ public class BoardAppState extends MonopolyAppState {
|
||||
/**
|
||||
* The pop-up manager for displaying messages and notifications.
|
||||
*/
|
||||
private PopUpManager popUpManager;;
|
||||
private PopUpManager popUpManager;
|
||||
|
||||
private Vector3f currentTarget = new Vector3f(-10f,0,-10f);
|
||||
|
||||
private float modelHeight = -5f;
|
||||
private final float targetHeight = 0f;
|
||||
private final float animationSpeed = 0.01389f;
|
||||
private Node modelNode;
|
||||
private boolean startAnimation = false;
|
||||
private CameraController cameraController;
|
||||
private CameraInputHandler cameraInputHandler;
|
||||
|
||||
@ -275,8 +260,6 @@ private void addCylinderCaps() {
|
||||
|
||||
sceneNode.attachChild(createCardDeck());
|
||||
sceneNode.attachChild(seaGeo);
|
||||
|
||||
addModelToCenter(sceneNode);
|
||||
|
||||
// Schneefall hinzufügen
|
||||
addSnowEffect(sceneNode);
|
||||
@ -333,86 +316,4 @@ private void addCylinderCaps() {
|
||||
parentNode.attachChild(snowEmitter);
|
||||
}
|
||||
|
||||
private void addModelToCenter(Node parentNode) {
|
||||
AssetManager assetManager = getApp().getAssetManager();
|
||||
|
||||
Material material = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
|
||||
material.setColor("Diffuse", ColorRGBA.White);
|
||||
material.setBoolean("UseMaterialColors", true);
|
||||
|
||||
Sphere lowerSphereLeft = new Sphere(32, 32, 0.5f);
|
||||
Geometry lowerSphereLeftGeom = new Geometry("LowerSphereLeft", lowerSphereLeft);
|
||||
lowerSphereLeftGeom.setMaterial(material);
|
||||
lowerSphereLeftGeom.setLocalTranslation(-0.6f - 4f, 0.5f, 0.3f - 5f);
|
||||
|
||||
Sphere lowerSphereRight = new Sphere(32, 32, 0.5f);
|
||||
Geometry lowerSphereRightGeom = new Geometry("LowerSphereRight", lowerSphereRight);
|
||||
lowerSphereRightGeom.setMaterial(material);
|
||||
lowerSphereRightGeom.setLocalTranslation(0.6f - 4f, 0.5f, 0.3f - 5f);
|
||||
|
||||
Cylinder cylinder = new Cylinder(16, 16, 0.4f, 2f, true);
|
||||
Geometry cylinderGeom = new Geometry("Cylinder", cylinder);
|
||||
cylinderGeom.setMaterial(material);
|
||||
cylinderGeom.setLocalTranslation(0f - 4f, 1.5f, 0f - 5f);
|
||||
cylinderGeom.rotate(FastMath.HALF_PI, 0, 0);
|
||||
|
||||
Sphere upperSphere = new Sphere(32, 32, 0.4f);
|
||||
Geometry upperSphereGeom = new Geometry("UpperSphere", upperSphere);
|
||||
upperSphereGeom.setMaterial(material);
|
||||
upperSphereGeom.setLocalTranslation(0f - 4f, 2.5f, 0f - 5f);
|
||||
|
||||
this.modelNode = new Node("3DModel");
|
||||
this.modelNode.attachChild(lowerSphereLeftGeom);
|
||||
this.modelNode.attachChild(lowerSphereRightGeom);
|
||||
this.modelNode.attachChild(cylinderGeom);
|
||||
this.modelNode.attachChild(upperSphereGeom);
|
||||
|
||||
this.modelNode.setLocalTranslation(0, modelHeight, 0);
|
||||
parentNode.attachChild(this.modelNode);
|
||||
|
||||
PointLight lightLeft = new PointLight();
|
||||
lightLeft.setColor(ColorRGBA.Blue);
|
||||
lightLeft.setPosition(new Vector3f(-0.6f - 4f, 0f, 0.3f - 5f));
|
||||
lightLeft.setRadius(2f);
|
||||
parentNode.addLight(lightLeft);
|
||||
|
||||
PointLight lightRight = new PointLight();
|
||||
lightRight.setColor(ColorRGBA.Blue);
|
||||
lightRight.setPosition(new Vector3f(0.6f - 4f, 0f, 0.3f - 5f));
|
||||
lightRight.setRadius(2f);
|
||||
parentNode.addLight(lightRight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(float tpf) {
|
||||
super.update(tpf);
|
||||
if (startAnimation && modelHeight < targetHeight) {
|
||||
modelHeight += animationSpeed * tpf; // Geschwindigkeit basierend auf Zeit pro Frame
|
||||
if (modelHeight > targetHeight) {
|
||||
modelHeight = targetHeight; // Zielhöhe nicht überschreiten
|
||||
startAnimation = false; // Animation beenden
|
||||
}
|
||||
updateModelHeight(); // Aktualisiere die Position des Modells
|
||||
}
|
||||
}
|
||||
|
||||
private void updateModelHeight() {
|
||||
if (modelNode == null) {
|
||||
modelNode = (Node) sceneNode.getChild("3DModel");
|
||||
}
|
||||
if (modelNode != null) {
|
||||
modelNode.setLocalTranslation(0, modelHeight, 0); // Aktualisiere die Y-Position
|
||||
}
|
||||
}
|
||||
|
||||
public void onRollDicePressed() {
|
||||
System.out.println("onRollDicePressed called");
|
||||
if (!startAnimation) {
|
||||
startAnimation = true;
|
||||
modelHeight = -5f; // Reset der Höhe
|
||||
updateModelHeight(); // Stelle sicher, dass das Modell an der Startposition ist
|
||||
System.out.println("Animation started, startAnimation set to: " + startAnimation);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user