Search in sources :

Example 1 with EndCase

use of src.model.board.EndCase 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));
    }
}
Also used : JumpCase(src.model.board.JumpCase) StartCase(src.model.board.StartCase) EndCase(src.model.board.EndCase) Random(java.util.Random) SpeedCase(src.model.board.SpeedCase) RectInMaze(src.model.MazeDimension.RectInMaze) TeleportCase(src.model.board.TeleportCase) TimeCase(src.model.board.TimeCase)

Aggregations

Random (java.util.Random)1 RectInMaze (src.model.MazeDimension.RectInMaze)1 EndCase (src.model.board.EndCase)1 JumpCase (src.model.board.JumpCase)1 SpeedCase (src.model.board.SpeedCase)1 StartCase (src.model.board.StartCase)1 TeleportCase (src.model.board.TeleportCase)1 TimeCase (src.model.board.TimeCase)1