File indexing completed on 2024-11-03 03:46:16

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 #ifndef BONUS_H
0011 #define BONUS_H
0012 
0013 #include "element.h"
0014 
0015 /**
0016  * @brief This class represents a Bonus for the Player.
0017  */
0018 class Bonus : public Element {
0019     Q_OBJECT
0020 public:
0021     /**
0022       * Creates a new Bonus instance.
0023       * @param p_x the initial x-coordinate
0024       * @param p_y the initial y-coordinate
0025       * @param p_arena a reference to the Arena the Bonus will be on
0026       * @param bonusType the Bonus Type
0027       */
0028     Bonus(qreal p_x, qreal p_y, Arena* p_arena, Granatier::Bonus::Type bonusType);
0029 
0030     /**
0031       * Deletes the Bonus instance.
0032       */
0033     ~Bonus() override;
0034 
0035     /**
0036       * Computes an action on a collision with the Player.
0037       * @param p_player the Player instance that collides with the Bonus
0038       */
0039     void doActionOnCollision(Player* p_player) override;
0040 
0041     Granatier::Bonus::Type getBonusType() const;
0042 
0043     void setTaken();
0044 
0045     bool isTaken() const;
0046 
0047     void setDestroyed();
0048 
0049     bool isDestroyed() const;
0050 
0051 private:
0052     /** The Bonus type */
0053     Granatier::Bonus::Type m_bonusType;
0054 
0055     bool m_taken;
0056     bool m_destroyed;
0057 };
0058 
0059 #endif
0060