bucketed_game :: Game :: defaultinit
# Full game logic
class Game
super ThinGame
# Game type used in this implementation.
type G: Game
# Bucket list in this game.
var buckets: Buckets[G] = new Buckets[G]
# Last turn executed in this game
# Can be used to consult the latest events (by the display for example),
# but cannot be used to add new Events.
var last_turn: nullable ThinGameTurn[G] = null
# Execute and return a new GameTurn.
#
# This method calls `do_pre_turn` before executing the GameTurn
# and `do_post_turn` after.
fun do_turn: GameTurn[G]
do
var turn = new GameTurn[G](self)
do_pre_turn(turn)
buckets.do_turn(turn)
do_post_turn(turn)
last_turn = turn
tick += 1
return turn
end
# Execute something before executing the current GameTurn.
#
# Should be redefined by clients to add a pre-turn behavior.
# See `Game::do_turn`.
fun do_pre_turn(turn: GameTurn[G]) do end
# Execute something after executing the current GameTurn.
#
# Should be redefined by clients to add a post-turn behavior.
# See `Game::do_turn`.
fun do_post_turn(turn: GameTurn[G]) do end
end
lib/bucketed_game/bucketed_game.nit:204,1--249,3