File indexing completed on 2024-02-18 04:03:24

0001 /*
0002     SPDX-FileCopyrightText: 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
0003     SPDX-FileCopyrightText: 2007-2008 Gaƫl Courcelle <gael.courcelle@gmail.com>
0004     SPDX-FileCopyrightText: 2007-2008 Alexia Allanic <alexia_allanic@yahoo.fr>
0005     SPDX-FileCopyrightText: 2007-2008 Johann Hingue <yoan1703@hotmail.fr>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #include "bonus.h"
0011 #include "player.h"
0012 
0013 Bonus::Bonus(qreal p_x, qreal p_y, Arena* p_arena, Granatier::Bonus::Type bonusType) : Element(p_x, p_y, p_arena)
0014 {
0015     m_type = Granatier::Element::BONUS;
0016     m_bonusType = bonusType;
0017     m_taken = false;
0018     m_destroyed = false;
0019 }
0020 
0021 Bonus::~Bonus()
0022 = default;
0023 
0024 void Bonus::doActionOnCollision(Player* p_player)
0025 {
0026     p_player->addBonus(this);
0027 }
0028 
0029 Granatier::Bonus::Type Bonus::getBonusType() const
0030 {
0031   return m_bonusType;
0032 }
0033 
0034 void Bonus::setTaken()
0035 {
0036     m_taken = true;
0037 }
0038 
0039 bool Bonus::isTaken() const
0040 {
0041     return m_taken;
0042 }
0043 
0044 void Bonus::setDestroyed()
0045 {
0046     m_destroyed = true;
0047     m_taken = true;
0048 }
0049 
0050 bool Bonus::isDestroyed() const
0051 {
0052     return m_destroyed;
0053 }
0054 
0055 #include "moc_bonus.cpp"