- Timestamp:
- Nov 12, 2008, 1:29:33 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem2/src/orxonox/objects/quest/QuestEffectBeacon.cc
r2146 r2191 32 32 #include "core/CoreIncludes.h" 33 33 #include "core/XMLPort.h" 34 #include "core/Event.h" 34 35 35 36 #include "orxonox/objects/worldentities/ControllableEntity.h" 37 #include "orxonox/objects/worldentities/triggers/Trigger.h" 36 38 #include "QuestEffect.h" 37 39 … … 46 48 this->status_ = QuestEffectBeaconStatus::active; 47 49 this->times_ = -1; 50 this->trigger_ = NULL; 48 51 } 49 50 52 51 53 QuestEffectBeacon::~QuestEffectBeacon() … … 58 60 59 61 XMLPortParam(QuestEffectBeacon, "times", setTimes, getTimes, xmlelement, mode); 60 XMLPortObject(QuestEffectBeacon, QuestEffect, "", addEffect, getEffects, xmlelement, mode); 62 XMLPortObject(QuestEffectBeacon, QuestEffect, "", addEffect, getEffect, xmlelement, mode); 63 XMLPortObject(QuestEffectBeacon, Trigger, "", addTrigger, getTrigger, xmlelement, mode); 64 } 65 66 void processEvent(Event& event) 67 { 68 //TDO. Resolve pseudo code. 69 //if(isControllableEntity(event.originator_)) 70 //{ 71 // SetEvent(BaseObject, "activity", execute, event); 72 //} 61 73 } 62 74 … … 93 105 return false; 94 106 } 95 if(this-> times_== -1)107 if(this->getTimes() == -1) 96 108 { 97 109 return true; … … 99 111 100 112 this->times_ = this->times_ - 1; 101 if(this-> times_== 0)113 if(this->getTimes() == 0) 102 114 { 103 115 this->status_ = QuestEffectBeaconStatus::inactive; … … 134 146 this->effects_.push_back(effect); 135 147 136 COUT(3) << "A n effect was added to a QuestEffectBeacon." << std::endl;148 COUT(3) << "A QuestEffect was added to a QuestEffectBeacon." << std::endl; 137 149 return true; 150 } 151 152 bool QuestEffectBeacon::addTrigger(Trigger* trigger) 153 { 154 if(this->trigger_ != NULL) 155 { 156 COUT(2) << "A Trigger was trying to be added, where one was already set." << std::endl; 157 return false; 158 } 159 if(trigger == NULL) 160 { 161 COUT(2) << "A NULL-Trigger was trying to be added." << std::endl; 162 return false; 163 } 164 165 COUT(3) << "A Trigger was added to a QuestEffectBeacon." << std::endl; 166 this->trigger_ = trigger; 167 return true; 138 168 } 139 169 … … 142 172 143 173 */ 144 const QuestEffect* QuestEffectBeacon::getEffect s(unsigned int index) const174 const QuestEffect* QuestEffectBeacon::getEffect(unsigned int index) const 145 175 { 146 176 int i = index; … … 156 186 } 157 187 188 const Trigger* QuestEffectBeacon::getTrigger(unsigned int index) const 189 { 190 if(index == 0) 191 { 192 return this->trigger_; 193 } 194 195 return NULL; 196 } 158 197 159 198 }
Note: See TracChangeset
for help on using the changeset viewer.