mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-25 02:19:45 +01:00
added alienboat
This commit is contained in:
parent
1f75f7bf30
commit
d5450df77c
BIN
Projekte/Alienship.j3o
Normal file
BIN
Projekte/Alienship.j3o
Normal file
Binary file not shown.
@ -34,6 +34,8 @@ import static pp.util.FloatMath.PI;
|
||||
*/
|
||||
class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
private static final String UNSHADED = "Common/MatDefs/Misc/Unshaded.j3md"; //NON-NLS
|
||||
|
||||
private static final String ALIENSHIP = "Models/Alienship/Alienship.j3o";
|
||||
private static final String KING_GEORGE_V_MODEL = "Models/KingGeorgeV/KingGeorgeV.j3o"; //NON-NLS
|
||||
private static final String COLOR = "Color"; //NON-NLS
|
||||
private static final String SHIP = "ship"; //NON-NLS
|
||||
@ -141,8 +143,25 @@ class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
* @return the spatial representing the battleship
|
||||
*/
|
||||
private Spatial createShip(Battleship ship) {
|
||||
return ship.getLength() == 4 ? createBattleship(ship) : createBox(ship);
|
||||
switch (ship.getLength()) {
|
||||
case 4:
|
||||
return createBattleship(ship);
|
||||
case 5:
|
||||
return createAllienship(ship);
|
||||
|
||||
default:
|
||||
return createBox(ship);
|
||||
}
|
||||
}
|
||||
private Spatial createAllienship(Battleship ship) {
|
||||
final Spatial model = app.getAssetManager().loadModel(ALIENSHIP);
|
||||
|
||||
model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()), 0f);
|
||||
model.scale(0.0005f);
|
||||
model.setShadowMode(ShadowMode.CastAndReceive);
|
||||
|
||||
return model;}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a simple box to represent a battleship that is not of the "King George V" type.
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 78 KiB |
@ -41,7 +41,11 @@ public class ModelExporter extends SimpleApplication {
|
||||
*/
|
||||
@Override
|
||||
public void simpleInitApp() {
|
||||
export("Models/KingGeorgeV/King_George_V.obj", "KingGeorgeV.j3o"); //NON-NLS
|
||||
export("Models/KingGeorgeV/King_George_V.obj", "KingGeorgeV.j3o");//NON-NLS
|
||||
export("Models/Alienship/Alienship.obj", "Alienship.j3o");//NON-NLS
|
||||
export("Models/KingGeorgeV/King_George_V.obj", "KingGeorgeV.j3o");//NON-NLS
|
||||
export("Models/KingGeorgeV/King_George_V.obj", "KingGeorgeV.j3o");//NON-NLS
|
||||
export("Models/KingGeorgeV/King_George_V.obj", "KingGeorgeV.j3o");//NON-NLS
|
||||
|
||||
stop();
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
# Blender MTL File: 'water ship.blend'
|
||||
# Material Count: 1
|
||||
|
||||
newmtl Material
|
||||
Ns 96.078431
|
||||
Ka 0.000000 0.000000 0.000000
|
||||
Kd 0.640000 0.640000 0.640000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ni 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
File diff suppressed because it is too large
Load Diff
@ -7,16 +7,16 @@
|
||||
|
||||
package pp.battleship.model;
|
||||
|
||||
import pp.battleship.notification.GameEvent;
|
||||
import pp.battleship.notification.GameEventBroker;
|
||||
import pp.battleship.notification.ItemAddedEvent;
|
||||
import pp.battleship.notification.ItemRemovedEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import pp.battleship.notification.GameEvent;
|
||||
import pp.battleship.notification.GameEventBroker;
|
||||
import pp.battleship.notification.ItemAddedEvent;
|
||||
import pp.battleship.notification.ItemRemovedEvent;
|
||||
|
||||
/**
|
||||
* Represents a rectangular map that holds ships and registers shots fired.
|
||||
* It also supports event notification for game state changes such as item addition or removal.
|
||||
@ -66,7 +66,7 @@ public class ShipMap {
|
||||
*/
|
||||
private void addItem(Item item) {
|
||||
items.add(item);
|
||||
notifyListeners(new ItemRemovedEvent(item, this));
|
||||
notifyListeners(new ItemAddedEvent(item, this));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -98,7 +98,7 @@ public class ShipMap {
|
||||
*/
|
||||
public void remove(Item item) {
|
||||
items.remove(item);
|
||||
notifyListeners(new ItemAddedEvent(item, this));
|
||||
notifyListeners(new ItemRemovedEvent(item, this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,6 +54,8 @@ public class ShipMapTest {
|
||||
verify(mockBroker).notifyListeners(any(ItemAddedEvent.class));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testRemoveItem() {
|
||||
map.add(battleship);
|
||||
|
Loading…
Reference in New Issue
Block a user