use of src.model.board.TimeCase in project Labyrinthe3d by FauconFan.
the class ContentMazeFactory method initiateSpecialCases.
public void initiateSpecialCases(boolean genStart, boolean genEnd) {
ArrayList<Point> oldPoints;
ArrayList<RectInMaze> li;
RectInMaze rim;
Random ran;
int x;
int y;
int max;
Point tmp;
Point tmp2;
ran = new Random();
li = this.mazeDim.getListRectMaze();
oldPoints = new ArrayList<>();
if (genStart) {
tmp = this.genRandomPoint(ran, li, oldPoints);
this.contentSpecialCases.add(new StartCase(tmp.x, tmp.y));
}
if (genEnd) {
tmp = this.genRandomPoint(ran, li, oldPoints);
this.contentSpecialCases.add(new EndCase(tmp.x, tmp.y));
}
max = 0;
if (this.mazeDim.size() >= 200) {
max = 3;
} else if (this.mazeDim.size() >= 100) {
max = 2;
}
for (int i = 0; i < max; i++) {
tmp = this.genRandomPoint(ran, li, oldPoints);
this.contentSpecialCases.add(new SpeedCase(tmp.x, tmp.y, 0.5f));
tmp = this.genRandomPoint(ran, li, oldPoints);
this.contentSpecialCases.add(new TimeCase(tmp.x, tmp.y, 1000));
tmp = this.genRandomPoint(ran, li, oldPoints);
tmp2 = this.genRandomPoint(ran, li, oldPoints);
this.contentSpecialCases.add(new TeleportCase(tmp.x, tmp.y, tmp2.x, tmp2.y));
tmp = this.genRandomPoint(ran, li, oldPoints);
this.contentSpecialCases.add(new JumpCase(tmp.x, tmp.y, 0.05f));
}
}
use of src.model.board.TimeCase in project Labyrinthe3d by FauconFan.
the class MainMaze method actionCase.
public void actionCase() {
// TODO to change actually
for (Case c : cm[current_level].getSpecialCases()) {
if (this.p.playerInCase(c)) {
switch(c.type) {
case END:
this.p.setWin(true);
break;
case TELEPORT:
this.p.setPosX(((TeleportCase) c).getXDest() + 0.5f);
this.p.setPosY(((TeleportCase) c).getYDest() + 0.5f);
break;
case SPEED:
if (!((SpeedCase) c).isActivated()) {
((SpeedCase) c).activate();
this.p.setSpeed(((SpeedCase) c).getSpeedModif() * this.p.getSpeed());
}
break;
case TIME:
if (!((TimeCase) c).isActivated()) {
((TimeCase) c).activate();
p.updateTime(((TimeCase) c).getTimeMillis());
}
break;
case JUMP:
this.p.setVelocityZ(0.05f);
}
}
}
}
Aggregations