Changeset 6864 for code/trunk/src/modules/objects/triggers/MultiTrigger.h
- Timestamp:
- May 9, 2010, 10:56:43 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/objects/triggers/MultiTrigger.h
r6859 r6864 82 82 'simultaniousTriggerers': The number of simultanious triggerers limits the number of object that are allowed to trigger the MultiTrigger at the same time. Or a little more precisely, the number of distinct objects the MultiTrigger has 'triggered' states for, at each point in time. 83 83 'mode': The mode describes how the MultiTrigger acts in relation to all the MultiTriggers, that are appended to it. There are 3 modes: 'and', meaning that the MultiTrigger can only be triggered if all the appended MultiTriggers are active. 'or', meaning that the MultiTrigger can only triggered if at least one of the appendend MultiTriggers is active. And 'xor', meaning that the MultiTrigger can only be triggered if one and only one appended MultiTrigger is active. Notice, that I wrote 'can only be active', that implies, that there is an addtitional condition to the activity of the MultiTrigger and that is the fulfillment of the triggering condition (the MultiTrigger itself doesn't have one, but all derived classes should). Also bear in mind, that the activity of a MultiTrigger is still coupled to the object that triggered it. The default is 'and'. 84 'broadcast' Broadcast is a bool, if true the MutliTrigger is in broadcast-mode, meaining, that all trigger events that are caused by no originator (originator is NULL) are broadcasted as having come from every possible originator, or more precisely as having come from all objects that are specified targets of this MultiTrigger. 84 85 'target': The target describes the kind of objects that are allowed to trigger this MultiTrigger. The default is 'Pawn'. 85 86 Also there is the possibility of appending MultiTriggers to the MultiTrigger just by adding them as subobjects in the XML description of your MultiTrigger. … … 109 110 @return The delay. 110 111 */ 111 inline float getDelay( ) const112 inline float getDelay(void) const 112 113 { return this->delay_; } 113 114 … … 122 123 @return Returns true if the MultiTriger is in switch-mode. 123 124 */ 124 inline bool getSwitch( ) const125 inline bool getSwitch(void) const 125 126 { return this->bSwitch_; } 126 127 … … 135 136 @return Returns true if the MultiTrigger stays active. 136 137 */ 137 inline bool getStayActive( ) const138 inline bool getStayActive(void) const 138 139 { return this->bStayActive_; } 139 140 … … 148 149 @return The number of activations. -1 denotes infinity. 149 150 */ 150 inline int getActivations( ) const151 inline int getActivations(void) const 151 152 { return this->remainingActivations_; } 152 153 … … 174 175 @return Returns true if the MultiTrigger is set to invert. 175 176 */ 176 inline bool getInvert( ) const177 inline bool getInvert(void) const 177 178 { return this->bInvertMode_; } 178 179 … … 193 194 194 195 /** 196 @brief Set the broadcast-mode of the MultiTrigger. 197 @param bBroadcast If true the MultiTrigger is set to broadcast; 198 */ 199 inline void setBroadcast(bool bBroadcast) 200 { this->bBroadcast_ = bBroadcast; } 201 /** 202 @brief Get the broadcast-mode of the MultiTrigger. 203 @return Returns true if the MultiTrigger is set to broadcast. 204 */ 205 inline bool getBroadcast(void) 206 { return this->bBroadcast_; } 207 208 /** 195 209 @brief Get whether the input object is a target of the MultiTrigger. 196 210 @param target A pointer to the object. … … 198 212 */ 199 213 inline bool isTarget(BaseObject* target) 200 { return targetMask_.isIncluded(target->getIdentifier()); }214 { if(target == NULL) return true; else return targetMask_.isIncluded(target->getIdentifier()); } 201 215 void addTargets(const std::string& targets); //!< Add some target to the MultiTrigger. 202 216 void removeTargets(const std::string& targets); //!< Remove some target from the MultiTrigger. … … 208 222 virtual std::queue<MultiTriggerState*>* letTrigger(void); //!< This method is called by the MultiTrigger to get information about new trigger events that need to be looked at. 209 223 210 void activityChanged(BaseObject* originator);224 void changeTriggered(BaseObject* originator = NULL); //!< This method can be called by any class inheriting from MultiTrigger to change it's triggered status for a specified originator. 211 225 212 226 bool isModeTriggered(BaseObject* triggerer = NULL); //!< Checks whetherx the MultiTrigger is triggered concerning it's sub-triggers. 213 227 bool isTriggered(BaseObject* triggerer = NULL); //!< Get whether the MultiTrigger is triggered for a given object. 214 228 215 void fire(bool status, BaseObject* originator = NULL); //!< Helper method. Creates an event for the given status and originator and fires it. 229 void fire(bool status, BaseObject* originator = NULL); //!< Helper method. Creates an Event for the given status and originator and fires it. 230 void broadcast(bool status); //!< Helper method. Broadcasts an Event for every object that is a target. 216 231 217 232 /** … … 240 255 static const std::string or_s; 241 256 static const std::string xor_s; 257 258 void subTrigggerActivityChanged(BaseObject* originator); //!< This method is called by any sub-trigger to advertise changes in it's state to it's parent-trigger. 242 259 243 260 bool addState(MultiTriggerState* state); //!< Helper method. Adds a state to the state queue, where the state will wait to become active. … … 266 283 MultiTriggerMode::Value mode_; //!< The mode of the MultiTrigger. 267 284 285 bool bBroadcast_; //!< Bool for the broadcast-mode, if true all triggers go to all possible targets. 286 268 287 MultiTrigger* parentTrigger_; 269 288 std::set<MultiTrigger*> subTriggers_; //!< The sub-triggers of this MultiTrigger.
Note: See TracChangeset
for help on using the changeset viewer.