Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.h @ 2929

Last change on this file since 2929 was 2911, checked in by landauf, 16 years ago

Merged r1-2096 of questsystem5 back to trunk

I hope there weren't more "hidden merge changes" in r2909 than the one in OverlayGroup (removeElement) (and related to this the adjustments in NotificationQueue).

The corresponding media commit seems not yet to be done, but it doesn't break the build.

  • Property svn:eol-style set to native
File size: 5.0 KB
RevLine 
[2146]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Damian 'Mozork' Frick
24 *   Co-authors:
25 *      ...
26 *
27 */
28
[2221]29/**
[2911]30    @file QuestEffectBeacon.h
[2662]31    @brief Definition of the QuestEffectBeacon class.
[2221]32*/
33
[2146]34#ifndef _QuestEffectBeacon_H__
35#define _QuestEffectBeacon_H__
36
37#include "OrxonoxPrereqs.h"
38
[2662]39#include "orxonox/objects/worldentities/StaticEntity.h"
[2146]40
[2662]41namespace orxonox
[2146]42{
[2662]43    namespace QuestEffectBeaconStatus
[2146]44    {
[2221]45
[2662]46        //! The status of the beacon, can be either active or inactive.
47        enum Enum
48        {
49            inactive,
50            active
51        };
[2146]52
[2662]53    }
[2146]54
55    /**
56    @brief
[2221]57        A QuestEffectBeacon is a physical entity in the game which can (under some condition(s)) invoke a number QuestEffects on players meeting the condition(s).
[2208]58        The conditions under which the QuestEffects are invoked on the player are defined by Triggers.
59        A QuestEffectBeacon can be executed a defined number of times.
[2221]60        A QuestEffectBeacon can be inactive or active.
61       
[2662]62        Creating a QuestEffectBeacon through XML goes as follows:
63       
64        <QuestEffectBeacon times=n> //Where 'n' is eighter a number >= 0, which means the QuestEffectBeacon can be executed n times. Or n = -1, which means the QuestEffectBeacon can be executed an infinite number of times.
[2221]65            <effects>
66                <QuestEffect /> //A list of QuestEffects, invoked when the QuestEffectBeacon is executed, see QuestEffect for the full XML representation.
67                ...
68                <QuestEffect />
69            </effects>
70            <events>
[2662]71                <execute>
72                    <EventListener event=eventIdString />
73                </execute>
74            </events>
75            <attached>
76                <PlayerTrigger name=eventIdString /> //A PlayerTrigger triggering the execution of the QuestEffectBeacon.
77            </attached>
78        </QuestEffectBeacon>
[2146]79    @author
80        Damian 'Mozork' Frick
81    */
[2662]82    class _OrxonoxExport QuestEffectBeacon : public StaticEntity
[2146]83    {
[2662]84        public:
85            QuestEffectBeacon(BaseObject* creator);
86            virtual ~QuestEffectBeacon();
87           
88            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestEffectBeacon object through XML.
89           
90            virtual void processEvent(Event& event); //!< Processes an event for this QuestEffectBeacon.
91           
92            bool execute(bool b, PlayerTrigger* trigger); //!< Executes the QuestEffects of the QuestEffectBeacon.
93           
94            /**
95            @brief Tests whether the QuestEffectBeacon is active.
96            @return Returns true if the QuestEffectBeacon is active, fals if not.
97            */
98            inline bool isActive(void)
99            { return this->status_ == QuestEffectBeaconStatus::active; }
100           
101            bool setActive(bool activate); //!< Set the status of the QuestEffectBeacon.
102           
103        protected:
[2208]104            bool decrementTimes(void); //!< Decrement the number of times the QuestEffectBeacon can still be executed.
[2191]105           
[2221]106            /**
107            @brief Returns the number of times the QUestEffectBeacon can still be executed.
108            @return Returns the number of times the QUestEffectBeacon can still be executed.
109            */
110            inline const int & getTimes(void) const
[2191]111                { return this->times_; }
[2662]112   
[2191]113        private:
[2662]114            static const int INFINITE_TIME = -1; //!< Constant to avoid using magic numbers.
115           
[2208]116            std::list<QuestEffect*> effects_; //!< The list of QuestEffects to be invoked on the executing player.
[2146]117            int times_; //!< Number of times the beacon can be exectued.
[2208]118            QuestEffectBeaconStatus::Enum status_; //!< The status of the QUestEffectBeacon, Can be eighter active or inactive.
[2146]119           
[2208]120            bool setTimes(const int & n); //!< Set the number of times the QuestEffectBeacon can be executed.
[2221]121            bool addEffect(QuestEffect* effect); //!< Add a QuestEffect to the QuestEffectBeacon.
[2146]122           
[2221]123            const QuestEffect* getEffect(unsigned int index) const; //!< Get the QuestEffect at a given index.
[2146]124   
125    };
126
127}
128
129#endif /* _QuestEffectBeacon_H__ */
Note: See TracBrowser for help on using the repository browser.