added TODOÃ's for presentation
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
* EffectHandler manages the creation and manipulation of particle effects in the Battleship application.
|
||||
*/
|
||||
public class EffectHandler {
|
||||
//TODO: Ex. 12 EffectHandler
|
||||
private final BattleshipApp app;
|
||||
private final Map<Battleship, List<ParticleEmitter>> effects;
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* An application state that plays sounds.
|
||||
*/
|
||||
public class GameMusic extends AbstractAppState {
|
||||
//TODO: Ex. 10 GameMusic
|
||||
private static final Preferences PREFERENCES = getPreferences(GameMusic.class);
|
||||
private static final String ENABLED_PREF = "enabled";
|
||||
private static final String VOLUME_PREF = "volume";
|
||||
|
||||
@@ -48,7 +48,7 @@ public Menu(BattleshipApp app) {
|
||||
addChild(new Label(lookup("battleship.name"), new ElementId("header"))); //NON-NLS
|
||||
addChild(new Checkbox(lookup("menu.sound-enabled"),
|
||||
new StateCheckboxModel(app, GameSound.class)));
|
||||
|
||||
//TODO: Ex. 10 VolumeSlider
|
||||
addChild(new Checkbox(lookup("menu.music-enabled"), new StateCheckboxModel(app, GameMusic.class)));
|
||||
addChild(volumeSlider);
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ class NetworkDialog extends SimpleDialog {
|
||||
input.addChild(host, 1);
|
||||
input.addChild(new Label(lookup("port.number") + ": "));
|
||||
input.addChild(port, 1);
|
||||
//TODO: Ex. 11 ClientHost Checkbox
|
||||
clientHostCheckbox = new Checkbox("Host Server");
|
||||
input.addChild(clientHostCheckbox);
|
||||
DialogBuilder.simple(app.getDialogManager())
|
||||
|
||||
@@ -126,6 +126,7 @@ public Spatial visit(Battleship ship) {
|
||||
*/
|
||||
@Override
|
||||
public Spatial visit(Shell shell) {
|
||||
//TODO: Ex. 13 2D Shell
|
||||
final ColorRGBA color = ColorRGBA.Black;
|
||||
Geometry ellipse = new Geometry("ellipse", new Sphere(50, 50, MapView.FIELD_SIZE / 2 * 0.8f));
|
||||
Material mat = new Material(view.getApp().getAssetManager(), UNSHADED); //NON-NLS
|
||||
|
||||
@@ -92,7 +92,7 @@ private Spatial handleMiss(Shot shot) {
|
||||
private Spatial handleHit(Shot shot) {
|
||||
final Battleship ship = requireNonNull(map.findShipAt(shot), "Missing ship");
|
||||
final Node shipNode = requireNonNull((Node) getSpatial(ship), "Missing ship node");
|
||||
|
||||
//TODO: Ex. 12 Hit
|
||||
shipNode.getControl(ShipControl.class).hit(shot);
|
||||
if (ship.isDestroyed()) {
|
||||
shipNode.getControl(ShipControl.class).destroyed();
|
||||
@@ -149,6 +149,7 @@ public Spatial visit(Battleship ship) {
|
||||
final float x = 0.5f * (ship.getMinY() + ship.getMaxY() + 1f);
|
||||
final float z = 0.5f * (ship.getMinX() + ship.getMaxX() + 1f);
|
||||
node.setLocalTranslation(x, 0f, z);
|
||||
//TODO: Ex. 12 ShipControl
|
||||
node.addControl(new ShipControl(ship, node, app.getEffectHandler()));
|
||||
return node;
|
||||
}
|
||||
@@ -162,6 +163,7 @@ public Spatial visit(Battleship ship) {
|
||||
*/
|
||||
@Override
|
||||
public Spatial visit(Shell shell) {
|
||||
//TODO: Ex. 13 3D Shell
|
||||
final Spatial model = app.getAssetManager().loadModel("Models/Shell/shell.j3o");
|
||||
model.setLocalScale(.05f);
|
||||
model.setShadowMode(ShadowMode.CastAndReceive);
|
||||
|
||||
Reference in New Issue
Block a user