This commit is contained in:
Luca Puderbach 2024-12-09 20:22:17 +01:00
parent 698937e77c
commit 7b82b20736
4 changed files with 41 additions and 5 deletions

View File

@ -3,6 +3,9 @@ package pp.monopoly.client;
import com.jme3.app.Application; import com.jme3.app.Application;
import com.jme3.app.state.AppStateManager; import com.jme3.app.state.AppStateManager;
import com.jme3.asset.AssetManager; import com.jme3.asset.AssetManager;
import com.jme3.effect.ParticleEmitter;
import com.jme3.effect.ParticleMesh;
import com.jme3.effect.shapes.EmitterSphereShape;
import com.jme3.light.AmbientLight; import com.jme3.light.AmbientLight;
import com.jme3.light.DirectionalLight; import com.jme3.light.DirectionalLight;
import com.jme3.material.Material; import com.jme3.material.Material;
@ -203,10 +206,10 @@ public class BoardAppState extends MonopolyAppState {
final float x = board.getWidth(); final float x = board.getWidth();
final float y = board.getHeight(); final float y = board.getHeight();
final Box seaMesh = new Box(y, 0.1f, x); final Box seaMesh = new Box(y, 0.1f, x);
final Geometry seaGeo = new Geometry("sea", seaMesh); //NONs-NLS final Geometry seaGeo = new Geometry("sea", seaMesh); //NON-NLS
seaGeo.setLocalTranslation(new Vector3f(0, -0.1f, 0)); seaGeo.setLocalTranslation(new Vector3f(0, -0.1f, 0));
Quaternion rotation = new com.jme3.math.Quaternion(); Quaternion rotation = new Quaternion();
rotation.fromAngleAxis(FastMath.HALF_PI, com.jme3.math.Vector3f.UNIT_Y); rotation.fromAngleAxis(FastMath.HALF_PI, Vector3f.UNIT_Y);
seaGeo.setLocalRotation(rotation); seaGeo.setLocalRotation(rotation);
final Material seaMat = new Material(getApp().getAssetManager(), "Common/MatDefs/Light/Lighting.j3md"); final Material seaMat = new Material(getApp().getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
Texture texture = getApp().getAssetManager().loadTexture("Pictures/board2.png"); Texture texture = getApp().getAssetManager().loadTexture("Pictures/board2.png");
@ -214,8 +217,12 @@ public class BoardAppState extends MonopolyAppState {
seaGeo.setMaterial(seaMat); seaGeo.setMaterial(seaMat);
seaGeo.setShadowMode(ShadowMode.CastAndReceive); seaGeo.setShadowMode(ShadowMode.CastAndReceive);
TangentBinormalGenerator.generate(seaGeo); TangentBinormalGenerator.generate(seaGeo);
sceneNode.attachChild(createCardDeck()); sceneNode.attachChild(createCardDeck());
sceneNode.attachChild(seaGeo); sceneNode.attachChild(seaGeo);
// Schneefall hinzufügen
addSnowEffect(sceneNode);
} }
private Node createCardDeck() { private Node createCardDeck() {
@ -237,5 +244,34 @@ public class BoardAppState extends MonopolyAppState {
public Vector3f getCurrentTarget(){ public Vector3f getCurrentTarget(){
return currentTarget; return currentTarget;
} }
private void addSnowEffect(Node parentNode) {
// ParticleEmitter für Schnee
ParticleEmitter snowEmitter = new ParticleEmitter("Snow", ParticleMesh.Type.Triangle, 5000);
Material snowMat = new Material(getApp().getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
snowMat.setTexture("Texture", getApp().getAssetManager().loadTexture("Textures/snowflake.png")); // Schneeflocken-Textur
snowEmitter.setMaterial(snowMat);
// Eigenschaften für Schneepartikel
snowEmitter.setImagesX(1);
snowEmitter.setImagesY(1);
snowEmitter.setEndColor(new ColorRGBA(1f, 1f, 1f, 0.5f)); // Weiß, halbtransparent
snowEmitter.setStartColor(new ColorRGBA(1f, 1f, 1f, 1f)); // Vollweiß
snowEmitter.setStartSize(0.1f);
snowEmitter.setEndSize(0.2f);
snowEmitter.setGravity(0, 0.5f, 0); // Langsames Fallen
snowEmitter.setLowLife(3f);
snowEmitter.setHighLife(15f);
snowEmitter.getParticleInfluencer().setInitialVelocity(new Vector3f(0, -1, 0));
snowEmitter.getParticleInfluencer().setVelocityVariation(0.3f);
// Spawn-Bereich für Schneeflocken definieren
snowEmitter.setParticlesPerSec(200);
snowEmitter.setLocalTranslation(0, 10, 0);
snowEmitter.setShape(new EmitterSphereShape(new Vector3f(0, 0, 0), 15)); // Bereich von -15 bis 15
// Emitter zur Szene hinzufügen
parentNode.attachChild(snowEmitter);
}
} }

View File

@ -65,7 +65,7 @@ public class StartMenu extends Dialog {
app.getGuiNode().attachChild(centerMenu); app.getGuiNode().attachChild(centerMenu);
// Load the Monopoly logo as a texture // Load the Monopoly logo as a texture
Texture logoTexture = app.getAssetManager().loadTexture("Pictures/logo-monopoly.png"); Texture logoTexture = app.getAssetManager().loadTexture("Pictures/logo-monopolyw.png");
// Create a container for the logo // Create a container for the logo
Container logoContainer = new Container(); Container logoContainer = new Container();

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB