-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
210 additions
and
93 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/*/ | ||
!src | ||
config.ini | ||
|
||
# Compiled class file | ||
*.class | ||
|
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (C) 2022 Seekers Contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.seekers.game; | ||
|
||
import javafx.geometry.Point2D; | ||
import javafx.scene.layout.BorderPane; | ||
import org.seekers.plugin.GameMap; | ||
import org.seekers.plugin.GameMode; | ||
|
||
public class StandardMode implements GameMode { | ||
|
||
@Override | ||
public Game createGame(Game.Properties gameProperties, Camp.Properties campProperties, | ||
Seeker.Properties seekerProperties, Goal.Properties goalProperties) { | ||
Game game = new Game(new BorderPane(), gameProperties, campProperties, seekerProperties, goalProperties); | ||
game.setGameMap(createGameMap(game)); | ||
for (int i = 0; i < game.getGameProperties().goals; i++) | ||
createGoal(game).setPosition(game.getGameMap().getRandomPosition()); | ||
return game; | ||
} | ||
|
||
@Override | ||
public GameMap createGameMap(Game game) { | ||
return new TorusMap(game.getGameProperties().width, game.getGameProperties().height); | ||
} | ||
|
||
@Override | ||
public Player createPlayer(Game game) { | ||
Player player = new Player(game); | ||
createCamp(player).setPosition(new Point2D(game.getGameProperties().width * (game.getPlayers().size() - 0.5) | ||
/ game.getGameProperties().players, game.getGameProperties().height * 0.5)); | ||
for (int i = 0; i < game.getGameProperties().seekers; i++) | ||
createSeeker(player).setPosition(game.getGameMap().getRandomPosition()); | ||
return player; | ||
} | ||
|
||
@Override | ||
public Camp createCamp(Player player) { | ||
return new Camp(player, player.getGame().getCampProperties()); | ||
} | ||
|
||
@Override | ||
public Seeker createSeeker(Player player) { | ||
return new Seeker(player, player.getGame().getSeekerProperties()); | ||
} | ||
|
||
@Override | ||
public Goal createGoal(Game game) { | ||
return new Goal(game, game.getGoalProperties()); | ||
} | ||
} |
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
Oops, something went wrong.