|
bwmodel
A modeling environment for Minecraft Bedwars
|
#include <game.h>
Public Member Functions | |
| Game (std::unique_ptr< Map > map, PlayerColor me) | |
| const Map & | map () const |
| uint64_t | time () const |
| PlayerColor | me () const |
| const std::set< PlayerColor > & | players_left () const |
| bool | player_has_bed (PlayerColor color) |
| void | attach (std::shared_ptr< GameDelegate > delegate) |
| void | notify_start () |
| void | notify_end () |
| bool | should_end () const |
| void | cycle () |
| void | notify_player_kill (PlayerColor victor, PlayerColor loser) |
| void | notify_break_bed (PlayerColor breaker, PlayerColor bed) |
Models a bedwars game.
When a player player (bwmodel::PlayerColor) enters a bedwars game on a map (as a std::unique_ptr to bwmodel::Map), the game Game(map,
player) will model that game until it ends.
Before beginning the game lifecycle (see next section), you may attach delegates via Game::attach. In fact, you may do this at any point, but it likely you wish to do this at the start.
| bwmodel::Game::Game | ( | std::unique_ptr< Map > | map, |
| PlayerColor | me ) |
Constructs a new game from map, taking ownership of it. See Game::me() for information about me.
| void bwmodel::Game::attach | ( | std::shared_ptr< GameDelegate > | delegate | ) |
Attaches the given delegate to notify for game events.
| void bwmodel::Game::cycle | ( | ) |
Cycle the game.
| const Map & bwmodel::Game::map | ( | ) | const |
| PlayerColor bwmodel::Game::me | ( | ) | const |
The player whose perspective this game is played from.
| void bwmodel::Game::notify_break_bed | ( | PlayerColor | breaker, |
| PlayerColor | bed ) |
Player breaker breaks the bed for player whose color is given by bed.
| void bwmodel::Game::notify_end | ( | ) |
Ends the game.
| void bwmodel::Game::notify_player_kill | ( | PlayerColor | victor, |
| PlayerColor | loser ) |
Player victor kills player loser.
| void bwmodel::Game::notify_start | ( | ) |
Begins the game.
| bool bwmodel::Game::player_has_bed | ( | PlayerColor | color | ) |
Whether the player whose color is color currently has a bed.
| const std::set< PlayerColor > & bwmodel::Game::players_left | ( | ) | const |
A list of remaining players.
| bool bwmodel::Game::should_end | ( | ) | const |
Whether the game should be ended.
| uint64_t bwmodel::Game::time | ( | ) | const |
The time in milliseconds since the game started.