Initial commit

Base files for the project were added.

Update ONeill.java

Update Box.java

fixed everything, code now compiles correctly
This commit is contained in:
ericnerdo 2016-03-28 00:27:24 +02:00 committed by Kjistóf
parent 13fd2e7d04
commit 88b594b666
16 changed files with 280 additions and 0 deletions

14
cicaprojekt/Box.java Normal file
View File

@ -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.");
}
}

View File

@ -0,0 +1,5 @@
package cicaprojekt;
public interface Destroyable {
public void destroy();
}

View File

@ -0,0 +1,5 @@
package cicaprojekt;
public enum Direction {
NORTH, SOUTH, EAST, WEST;
}

7
cicaprojekt/Dungeon.java Normal file
View File

@ -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*/ }
}

14
cicaprojekt/Field.java Normal file
View File

@ -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() {}
}

View File

@ -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() {}
}

16
cicaprojekt/Game.java Normal file
View File

@ -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) {}
}

13
cicaprojekt/Gap.java Normal file
View File

@ -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() {}
}

26
cicaprojekt/Gate.java Normal file
View File

@ -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;
}
}

58
cicaprojekt/ONeill.java Normal file
View File

@ -0,0 +1,58 @@
package cicaprojekt;
import java.util.List;
public class ONeill implements Destroyable{
private Game game;
private List<ZPM> 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);
}
}

View File

@ -0,0 +1,5 @@
package cicaprojekt;
public interface Pickable {
public void pick();
}

17
cicaprojekt/Scale.java Normal file
View File

@ -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);
}
}

28
cicaprojekt/Stargate.java Normal file
View File

@ -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) {}
}

32
cicaprojekt/Tile.java Normal file
View File

@ -0,0 +1,32 @@
package cicaprojekt;
import java.util.Map;
public abstract class Tile {
protected Map<Direction, Tile> 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;
}
}

21
cicaprojekt/Wall.java Normal file
View File

@ -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() {}
}

8
cicaprojekt/ZPM.java Normal file
View File

@ -0,0 +1,8 @@
package cicaprojekt;
public class ZPM implements cicaprojekt.Pickable
{
public void pick() {}
}