Client work of the Week #4
@@ -17,8 +17,8 @@ public class AcousticHandler {
|
||||
|
||||
private boolean fading = false;
|
||||
private NanoTimer fadeTimer = new NanoTimer();
|
||||
private final float FADE_DURATION = 3.0f;
|
||||
private final float CROSSFADE_DURATION = 1.5f;
|
||||
private static final float FADE_DURATION = 3.0f;
|
||||
private static final float CROSSFADE_DURATION = 1.5f;
|
||||
|
||||
private float mainVolume = 1.0f;
|
||||
private float musicVolume = 1.0f;
|
||||
@@ -177,7 +177,8 @@ private void updateVolumeAndTrack() {
|
||||
|
||||
fading = false;
|
||||
}
|
||||
} else if (playing != null) {
|
||||
}
|
||||
else if (playing != null) {
|
||||
playing.update(getMusicVolumeTotal());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Enum representing the various sound effects used in the game.
|
||||
* Each sound corresponds to an event or action in the game and may consist of one or more
|
||||
* audio files, potentially with time delays between them.
|
||||
*
|
||||
* <p>
|
||||
* These sounds are used to play specific audio cues, such as when a dice is rolled,
|
||||
* a turn starts or ends, a piece is moved or lost, and various other events in the game.
|
||||
*/
|
||||
@@ -19,5 +19,5 @@ public enum MdgaSound {
|
||||
DESELECT,
|
||||
HURRY,
|
||||
VICTORY,
|
||||
LOST;
|
||||
LOST
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
abstract class Animation {
|
||||
abstract void play();
|
||||
|
||||
abstract void stop();
|
||||
|
||||
abstract boolean isOver();
|
||||
}
|
||||
|
||||
@@ -59,5 +59,4 @@ public String getDiffPath() {
|
||||
public float getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,7 +59,8 @@ private void initMap() {
|
||||
case heer -> addFigureToPlayerMap(assetToColor(BoardAsset.heer), assetOnMap);
|
||||
case cir -> addFigureToPlayerMap(assetToColor(BoardAsset.cir), assetOnMap);
|
||||
case marine -> addFigureToPlayerMap(assetToColor(BoardAsset.marine), assetOnMap);
|
||||
case node_normal, node_bonus, node_start -> infield.addLast(displayAndControl(assetOnMap, new NodeControl()));
|
||||
case node_normal, node_bonus, node_start ->
|
||||
infield.addLast(displayAndControl(assetOnMap, new NodeControl()));
|
||||
default -> displayAsset(assetOnMap);
|
||||
}
|
||||
}
|
||||
@@ -80,13 +81,12 @@ private void initCamera() {
|
||||
ambient.setColor(new ColorRGBA(0.3f, 0.3f, 0.3f, 1));
|
||||
app.getRootNode().addLight(ambient);
|
||||
|
||||
final int SHADOWMAP_SIZE= 1024 * 8;
|
||||
int SHADOWMAP_SIZE = 1024 * 8;
|
||||
DirectionalLightShadowRenderer dlsr = new DirectionalLightShadowRenderer(app.getAssetManager(), SHADOWMAP_SIZE, 4);
|
||||
dlsr.setLight(sun);
|
||||
app.getViewPort().addProcessor(dlsr);
|
||||
}
|
||||
|
||||
|
||||
private Color assetToColor(BoardAsset asset) {
|
||||
return switch (asset) {
|
||||
case lw -> Color.AIRFORCE;
|
||||
|
||||
@@ -7,15 +7,18 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MapLoader {
|
||||
class MapLoader {
|
||||
private MapLoader() {
|
||||
|
||||
}
|
||||
|
||||
public static List<AssetOnMap> loadMap(String mapName) {
|
||||
List<AssetOnMap> assetsOnMap = new ArrayList<>();
|
||||
|
||||
try (InputStream inputStream = MapLoader.class.getClassLoader().getResourceAsStream(mapName);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
|
||||
try (
|
||||
InputStream inputStream = MapLoader.class.getClassLoader().getResourceAsStream(mapName);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))
|
||||
) {
|
||||
|
||||
while (true) {
|
||||
String entry = reader.readLine();
|
||||
@@ -27,9 +30,7 @@ public static List<AssetOnMap> loadMap(String mapName) {
|
||||
if (entry.charAt(0) == '#') continue;
|
||||
|
||||
String[] parts = entry.trim().split(" ");
|
||||
if(parts.length != 3){
|
||||
parts = parts;
|
||||
}
|
||||
|
||||
assert (parts.length == 3) : "MapLoader: line has not 3 parts";
|
||||
|
||||
String assetName = parts[0];
|
||||
@@ -45,9 +46,11 @@ public static List<AssetOnMap> loadMap(String mapName) {
|
||||
BoardAsset asset = getLoadedAsset(assetName);
|
||||
assetsOnMap.add(new AssetOnMap(asset, x, y, rot));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,5 @@ public class StartDialog extends SimpleDialog {
|
||||
.setOkClose(false)
|
||||
.setNoClose(false)
|
||||
.build(this);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,8 @@ public void simpleUpdate(float tpf) {
|
||||
if (testState == MdgaState.MAIN) {
|
||||
testState = MdgaState.LOBBY;
|
||||
acousticHandler.playState(MdgaState.MAIN);
|
||||
} else if (testState == MdgaState.LOBBY) {
|
||||
}
|
||||
else if (testState == MdgaState.LOBBY) {
|
||||
testState = MdgaState.CEREMONY;
|
||||
acousticHandler.playState(MdgaState.LOBBY);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user