- Timestamp:
- Dec 7, 2008, 11:39:44 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem3/src/orxonox/objects/quest/QuestEffectBeacon.h
r2349 r2352 29 29 /** 30 30 @file QuestEffectBeacon.h 31 @brief 32 Definition of the QuestEffectBeacon class. 31 @brief Definition of the QuestEffectBeacon class. 33 32 */ 34 33 … … 61 60 A QuestEffectBeacon can be inactive or active. 62 61 63 Creating a QuestEffectBeacon through XML goes as follows:64 65 <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.66 67 68 69 70 71 72 <execute>73 <EventListener event=eventIdString />74 </execute>75 </events>76 <attached>77 <PlayerTrigger name=eventIdString /> //A PlayerTrigger triggering the execution of the QuestEffectBeacon.78 </attached>79 </QuestEffectBeacon>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. 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> 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> 80 79 @author 81 80 Damian 'Mozork' Frick … … 83 82 class _OrxonoxExport QuestEffectBeacon : public PositionableEntity 84 83 { 85 public: 86 QuestEffectBeacon(BaseObject* creator); 87 virtual ~QuestEffectBeacon(); 88 89 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestEffectBeacon object through XML. 90 91 virtual void processEvent(Event& event); //!< Processes an event for this QuestEffectBeacon. 92 93 bool execute(bool b, PlayerTrigger* trigger); //!< Executes the QuestEffects of the QuestEffectBeacon. 94 95 /** 96 @brief Tests whether the QuestEffectBeacon is active. 97 @return Returns true if the QuestEffectBeacon is active, fals if not. 98 */ 99 inline bool isActive(void) 100 { return this->status_ == QuestEffectBeaconStatus::active; } 101 102 bool setActive(bool activate); //!< Set the status of the QuestEffectBeacon. 103 104 protected: 105 bool decrementTimes(void); //!< Decrement the number of times the QuestEffectBeacon can still be executed. 106 107 /** 108 @brief Returns the number of times the QUestEffectBeacon can still be executed. 109 @return Returns the number of times the QUestEffectBeacon can still be executed. 110 */ 111 inline const int & getTimes(void) const 112 { return this->times_; } 113 114 private: 115 static const int INFINITE = -1; //!< Constant to avoid using magic numbers. 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: 104 bool decrementTimes(void); //!< Decrement the number of times the QuestEffectBeacon can still be executed. 105 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 111 { return this->times_; } 116 112 117 std::list<QuestEffect*> effects_; //!< The list of QuestEffects to be invoked on the executing player. 118 int times_; //!< Number of times the beacon can be exectued. 119 QuestEffectBeaconStatus::Enum status_; //!< The status of the QUestEffectBeacon, Can be eighter active or inactive. 120 121 bool setTimes(const int & n); //!< Set the number of times the QuestEffectBeacon can be executed. 122 bool addEffect(QuestEffect* effect); //!< Add a QuestEffect to the QuestEffectBeacon. 123 124 const QuestEffect* getEffect(unsigned int index) const; //!< Get the QuestEffect at a given index. 113 private: 114 static const int INFINITE = -1; //!< Constant to avoid using magic numbers. 115 116 std::list<QuestEffect*> effects_; //!< The list of QuestEffects to be invoked on the executing player. 117 int times_; //!< Number of times the beacon can be exectued. 118 QuestEffectBeaconStatus::Enum status_; //!< The status of the QUestEffectBeacon, Can be eighter active or inactive. 119 120 bool setTimes(const int & n); //!< Set the number of times the QuestEffectBeacon can be executed. 121 bool addEffect(QuestEffect* effect); //!< Add a QuestEffect to the QuestEffectBeacon. 122 123 const QuestEffect* getEffect(unsigned int index) const; //!< Get the QuestEffect at a given index. 125 124 126 125 };
Note: See TracChangeset
for help on using the changeset viewer.