From 88b594b6661cebfa17cdfef314315c6892af8851 Mon Sep 17 00:00:00 2001 From: ericnerdo Date: Mon, 28 Mar 2016 00:27:24 +0200 Subject: [PATCH] Initial commit Base files for the project were added. Update ONeill.java Update Box.java fixed everything, code now compiles correctly --- cicaprojekt/Box.java | 14 +++++++++ cicaprojekt/Destroyable.java | 5 ++++ cicaprojekt/Direction.java | 5 ++++ cicaprojekt/Dungeon.java | 7 +++++ cicaprojekt/Field.java | 14 +++++++++ cicaprojekt/FlowOfTime.java | 11 +++++++ cicaprojekt/Game.java | 16 ++++++++++ cicaprojekt/Gap.java | 13 ++++++++ cicaprojekt/Gate.java | 26 ++++++++++++++++ cicaprojekt/ONeill.java | 58 ++++++++++++++++++++++++++++++++++++ cicaprojekt/Pickable.java | 5 ++++ cicaprojekt/Scale.java | 17 +++++++++++ cicaprojekt/Stargate.java | 28 +++++++++++++++++ cicaprojekt/Tile.java | 32 ++++++++++++++++++++ cicaprojekt/Wall.java | 21 +++++++++++++ cicaprojekt/ZPM.java | 8 +++++ 16 files changed, 280 insertions(+) create mode 100644 cicaprojekt/Box.java create mode 100644 cicaprojekt/Destroyable.java create mode 100644 cicaprojekt/Direction.java create mode 100644 cicaprojekt/Dungeon.java create mode 100644 cicaprojekt/Field.java create mode 100644 cicaprojekt/FlowOfTime.java create mode 100644 cicaprojekt/Game.java create mode 100644 cicaprojekt/Gap.java create mode 100644 cicaprojekt/Gate.java create mode 100644 cicaprojekt/ONeill.java create mode 100644 cicaprojekt/Pickable.java create mode 100644 cicaprojekt/Scale.java create mode 100644 cicaprojekt/Stargate.java create mode 100644 cicaprojekt/Tile.java create mode 100644 cicaprojekt/Wall.java create mode 100644 cicaprojekt/ZPM.java diff --git a/cicaprojekt/Box.java b/cicaprojekt/Box.java new file mode 100644 index 0000000..541c864 --- /dev/null +++ b/cicaprojekt/Box.java @@ -0,0 +1,14 @@ +package cicaprojekt; + +public class Box implements cicaprojekt.Pickable, cicaprojekt.Destroyable +{ + + public void destroy() { + System.out.println("Box.destroy() hivodott."); + } + + public void pick() { + System.out.println("Box.pick() hivodott."); + } + +} diff --git a/cicaprojekt/Destroyable.java b/cicaprojekt/Destroyable.java new file mode 100644 index 0000000..b07dbbd --- /dev/null +++ b/cicaprojekt/Destroyable.java @@ -0,0 +1,5 @@ +package cicaprojekt; + +public interface Destroyable { + public void destroy(); +} diff --git a/cicaprojekt/Direction.java b/cicaprojekt/Direction.java new file mode 100644 index 0000000..43e2841 --- /dev/null +++ b/cicaprojekt/Direction.java @@ -0,0 +1,5 @@ +package cicaprojekt; + +public enum Direction { + NORTH, SOUTH, EAST, WEST; +} diff --git a/cicaprojekt/Dungeon.java b/cicaprojekt/Dungeon.java new file mode 100644 index 0000000..ac392df --- /dev/null +++ b/cicaprojekt/Dungeon.java @@ -0,0 +1,7 @@ +package cicaprojekt; + +import java.io.File; + +public class Dungeon { + cicaprojekt.Tile buildDungeon(File input){ return new cicaprojekt.Field(); /*csak hogy ne sírjon*/ } +} diff --git a/cicaprojekt/Field.java b/cicaprojekt/Field.java new file mode 100644 index 0000000..d0712a2 --- /dev/null +++ b/cicaprojekt/Field.java @@ -0,0 +1,14 @@ +package cicaprojekt; + +public class Field extends cicaprojekt.Tile +{ + @Override + public void spawnStargate(cicaprojekt.Stargate stargate, Direction direction) { + adjacentTile.get(direction).spawnStargate(stargate, direction); + } + + public void onEntry() {} + + public void onExit() {} + +} diff --git a/cicaprojekt/FlowOfTime.java b/cicaprojekt/FlowOfTime.java new file mode 100644 index 0000000..dbf0531 --- /dev/null +++ b/cicaprojekt/FlowOfTime.java @@ -0,0 +1,11 @@ +package cicaprojekt; + +import java.util.Timer; +import java.util.TimerTask; + +public class FlowOfTime extends Timer{ + private TimerTask timeup; + private long gametime; + + public void start() {} +} diff --git a/cicaprojekt/Game.java b/cicaprojekt/Game.java new file mode 100644 index 0000000..889f128 --- /dev/null +++ b/cicaprojekt/Game.java @@ -0,0 +1,16 @@ +package cicaprojekt; + +public class Game { + private cicaprojekt.ONeill oneill; + private Dungeon dungeon; + private FlowOfTime flowoftime; + + public void allZPMsCollected() {} + + public void startGame() {} + + public void stopGame() {} + + + public static void main(String[] args) {} +} diff --git a/cicaprojekt/Gap.java b/cicaprojekt/Gap.java new file mode 100644 index 0000000..bf2c1de --- /dev/null +++ b/cicaprojekt/Gap.java @@ -0,0 +1,13 @@ +package cicaprojekt; + +public class Gap extends cicaprojekt.Tile +{ + @Override + public void spawnStargate(cicaprojekt.Stargate stargate, Direction direction) { + adjacentTile.get(direction).spawnStargate(stargate, direction); + } + + public void onEntry() {} + + public void onExit() {} +} diff --git a/cicaprojekt/Gate.java b/cicaprojekt/Gate.java new file mode 100644 index 0000000..e19f59e --- /dev/null +++ b/cicaprojekt/Gate.java @@ -0,0 +1,26 @@ +package cicaprojekt; + +public class Gate extends cicaprojekt.Tile +{ + + private boolean open; + + public void spawnStargate(cicaprojekt.Stargate stargate, Direction direction) { + if(open) + adjacentTile.get(direction).spawnStargate(stargate, direction); + else return; + } + + public void onEntry() {} + + public void onExit() {} + + public boolean isOpen() { + return open; + } + + public void setOpen(boolean gateState) { + open = gateState; + } + +} diff --git a/cicaprojekt/ONeill.java b/cicaprojekt/ONeill.java new file mode 100644 index 0000000..f73406b --- /dev/null +++ b/cicaprojekt/ONeill.java @@ -0,0 +1,58 @@ +package cicaprojekt; + +import java.util.List; + +public class ONeill implements Destroyable{ + private Game game; + private List zpmContainer; + private cicaprojekt.Tile currentTile; + private Direction facingDirection; + private Box boxLifted; + + + public void destroy() { + System.out.println("ONeill.destroy() hivodott."); + } + + public cicaprojekt.Tile getCurrentTile() { + System.out.println("ONeill.getCurrentTile() hivodott."); + return currentTile; + } + + public void setCurrentTile(cicaprojekt.Tile newCurrentTile) { + System.out.println("ONeill.setCurrentTile(Tile) hivodott."); + currentTile = newCurrentTile; + } + + public void move(Direction direction) { + System.out.println("ONeill.move(Direction) hivodott."); + setCurrentTile(currentTile.getAdjacentTile(direction)); + } + + public void boxLift() { + System.out.println("ONeill.boxLift() hivodott."); + boxLifted = (Box) currentTile.getAdjacentTile(facingDirection).removeItemFromTile(); + + } + + public void boxDrop() { + System.out.println("ONeill.boxDrop() hivodott."); + currentTile.getAdjacentTile(facingDirection).setItemOnTile(boxLifted); + boxLifted = null; + } + + public Direction getFacingDirection() { + System.out.println("ONeill.getFacingDirection() hivodott."); + return facingDirection; + } + + public void setFacingDirection(Direction direction) { + System.out.println("ONeill.setFacingDirection() hivodott."); + facingDirection = direction; + } + + public void shootStargate(cicaprojekt.Stargate stargate) { + System.out.println("ONeill.shootStargate(Stargate) hivodott."); + currentTile.getAdjacentTile(facingDirection).spawnStargate(stargate, facingDirection); + } +} diff --git a/cicaprojekt/Pickable.java b/cicaprojekt/Pickable.java new file mode 100644 index 0000000..a3a55c4 --- /dev/null +++ b/cicaprojekt/Pickable.java @@ -0,0 +1,5 @@ +package cicaprojekt; + +public interface Pickable { + public void pick(); +} diff --git a/cicaprojekt/Scale.java b/cicaprojekt/Scale.java new file mode 100644 index 0000000..a7890b9 --- /dev/null +++ b/cicaprojekt/Scale.java @@ -0,0 +1,17 @@ +package cicaprojekt; + +public class Scale extends Field { + private Gate gateConnected; + + public void onEntry() { + gateConnected.setOpen(true); + } + + public void onExit() { + gateConnected.setOpen(false); + } + + public void spawnStargate(cicaprojekt.Stargate stargate, Direction direction) { + adjacentTile.get(direction).spawnStargate(stargate, direction); + } +} diff --git a/cicaprojekt/Stargate.java b/cicaprojekt/Stargate.java new file mode 100644 index 0000000..5fa2a24 --- /dev/null +++ b/cicaprojekt/Stargate.java @@ -0,0 +1,28 @@ +package cicaprojekt; + +public class Stargate { + + private boolean isSpawned; + + public static final Stargate yellowStargate = new Stargate(); + public static final Stargate blueStargate = new Stargate(); + public final Stargate other = null; /*null, hogy ne sírjon*/ + + private cicaprojekt.Wall currentWall; + + public static void init() {} + + public cicaprojekt.Wall getCurrentWall() { + return currentWall; + } + + public void setCurrentWall(cicaprojekt.Wall wall) { + currentWall = wall; + } + + public boolean isOpen() { + return isSpawned; + } + + public void teleport(Direction incomingDirection) {} +} diff --git a/cicaprojekt/Tile.java b/cicaprojekt/Tile.java new file mode 100644 index 0000000..ac32f5c --- /dev/null +++ b/cicaprojekt/Tile.java @@ -0,0 +1,32 @@ +package cicaprojekt; + +import java.util.Map; + +public abstract class Tile { + protected Map adjacentTile; + private Pickable itemOnTile; + + public void setAdajacentTile(Tile newTile, Direction direction) { + adjacentTile.put(direction, newTile); + } + + public Tile getAdjacentTile(Direction direction) { + return adjacentTile.get(direction); + } + + public abstract void spawnStargate(Stargate stargate, Direction direction); + + public abstract void onEntry(); + + public abstract void onExit(); + + public Pickable removeItemFromTile() { + Pickable item = itemOnTile; + itemOnTile = null; + return item; + } + + public void setItemOnTile(Pickable item) { + itemOnTile = item; + } +} diff --git a/cicaprojekt/Wall.java b/cicaprojekt/Wall.java new file mode 100644 index 0000000..a46f031 --- /dev/null +++ b/cicaprojekt/Wall.java @@ -0,0 +1,21 @@ +package cicaprojekt; + +public class Wall extends Tile { + + private Stargate sg; + + public void spawnStargate(Stargate stargate, Direction direction) { + if(sg == null) + sg = stargate; + else return; + } + + public void clearStargate(){ + sg = null; + } + + public void onEntry() { } + + public void onExit() {} + +} diff --git a/cicaprojekt/ZPM.java b/cicaprojekt/ZPM.java new file mode 100644 index 0000000..f0fe9d5 --- /dev/null +++ b/cicaprojekt/ZPM.java @@ -0,0 +1,8 @@ +package cicaprojekt; + +public class ZPM implements cicaprojekt.Pickable +{ + + public void pick() {} + +}