-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deplacement isCollision et nbrMaxRoom dans strategy
- Loading branch information
1 parent
2f45f8c
commit f1407b8
Showing
12 changed files
with
237 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
package Model.Map.Strategy; | ||
|
||
import Model.Map.Etage; | ||
import Model.Map.Room; | ||
import Model.Utils.Position; | ||
|
||
public class LabyRoomStrategy extends RoomStrategy { | ||
|
||
@Override | ||
public void composeRoom(Room r) { | ||
|
||
} | ||
|
||
@Override | ||
public boolean isCollision(Etage etage, Room room, Position pos) { | ||
return super.isCollision(etage,room,pos,0); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,30 @@ | ||
package Model.Map.Strategy; | ||
|
||
import Model.Map.Cell; | ||
import Model.Map.Etage; | ||
import Model.Map.Room; | ||
import Model.Utils.Position; | ||
|
||
public abstract class RoomStrategy{ | ||
|
||
public void composeRoom(Room r){ | ||
r.fillMap(new Cell(true, Cell.CellType.NORMAL)); | ||
} | ||
|
||
protected boolean isCollision(Etage etage,Room room,Position pos,int DistanceMin){ | ||
for (int y = 0; y < room.getHeigth()+DistanceMin*2; y++) { | ||
for (int x = 0; x < room.getWidth()+DistanceMin*2; x++) { | ||
if (etage.get(Math.max(Math.min(pos.getX() + x - DistanceMin, etage.getWidth()-1), 0), Math.max(Math.min(pos.getY() + y - DistanceMin, etage.getHeigth()-1),0)).getType() != Cell.CellType.VOID){ | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
public abstract boolean isCollision(Etage etage,Room room,Position pos); | ||
|
||
public int getNbrMaxRoom() { | ||
return 8; | ||
} | ||
} |
Oops, something went wrong.