From c0342f3a9e8a76b77a412886ef04d3b917d396a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=C3=A9o=20Delabre?= Date: Mon, 11 Apr 2016 23:16:59 +0200 Subject: [PATCH] =?UTF-8?q?Comportement=20bloc=20arriv=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/finish_block.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/finish_block.cpp b/src/finish_block.cpp index 743a86f..6d15fc9 100644 --- a/src/finish_block.cpp +++ b/src/finish_block.cpp @@ -18,7 +18,16 @@ void FinishBlock::prepareDraw(ResourceManager& resources) { void FinishBlock::activate(Game& game, Object::Ptr object) { Block::activate(game, object); - // TODO: implémenter le comportmeent des blocs d'arrivée + + // si un joueur touche le bloc d'arrivée, + // on le tue et s'il ne reste plus de joueur, on a gagné + if (object->getTypeId() == Player::TYPE_ID) { + if (game.getPlayers().size() == 1) { + game.setMode(Game::Mode::WON); + } + + game.kill(object); + } } unsigned int FinishBlock::getTypeId() const {