Changeset 2196 for code/branches/questsystem2
- Timestamp:
- Nov 12, 2008, 3:32:33 PM (16 years ago)
- Location:
- code/branches/questsystem2/src/orxonox/objects
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem2/src/orxonox/objects/quest/QuestEffectBeacon.cc
r2195 r2196 63 63 XMLPortParam(QuestEffectBeacon, "times", setTimes, getTimes, xmlelement, mode); 64 64 XMLPortObject(QuestEffectBeacon, QuestEffect, "", addEffect, getEffect, xmlelement, mode); 65 XMLPortObject(QuestEffectBeacon, Trigger, "", addTrigger, getTrigger, xmlelement, mode);65 XMLPortObject(QuestEffectBeacon, PlayerTrigger, "", addTrigger, getTrigger, xmlelement, mode); 66 66 } 67 67 … … 187 187 } 188 188 189 const Trigger* QuestEffectBeacon::getTrigger(unsigned int index) const189 const PlayerTrigger* QuestEffectBeacon::getTrigger(unsigned int index) const 190 190 { 191 191 if(index == 0) -
code/branches/questsystem2/src/orxonox/objects/quest/QuestEffectBeacon.h
r2195 r2196 85 85 86 86 const QuestEffect* getEffect(unsigned int index) const; 87 const Trigger* getTrigger(unsigned int index) const;87 const PlayerTrigger* getTrigger(unsigned int index) const; 88 88 89 89 }; -
code/branches/questsystem2/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc
r2193 r2196 45 45 this->distance_ = 100; 46 46 this->targetMask_.exclude(Class(BaseObject)); 47 this-> player_ = NULL;47 this->setForPlayer(false); 48 48 } 49 49 … … 83 83 void DistanceTrigger::addTargets(const std::string& targets) 84 84 { 85 86 if(targets == "ControllableEntity") 87 { 88 this->setForPlayer(true); 89 } 90 85 91 Identifier* targetId = ClassByString(targets); 86 92 if (!targetId) … … 119 125 if (distanceVec.length() < this->distance_) 120 126 { 121 this->player_ = dynamic_cast<ControllableEntity*>(entity); 127 if(this->isForPlayer()) 128 { 129 ControllableEntity* player = dynamic_cast<ControllableEntity*>(entity); 130 this->setTriggeringPlayer(player); 131 } 132 122 133 return true; 123 134 } 124 135 } 125 136 return false; 126 127 }128 129 ControllableEntity* DistanceTrigger::getTriggeringPlayer(void) const130 {131 return this->player_;132 137 } 133 138 -
code/branches/questsystem2/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h
r2193 r2196 58 58 inline float getDistance() const 59 59 { return this->distance_; } 60 61 virtual ControllableEntity* getTriggeringPlayer(void) const;62 60 63 61 bool checkDistance(); … … 71 69 float distance_; 72 70 73 ControllableEntity* player_;74 75 71 }; 76 72 } -
code/branches/questsystem2/src/orxonox/objects/worldentities/triggers/PlayerTrigger.cc
r2194 r2196 36 36 { 37 37 RegisterObject(PlayerTrigger); 38 39 this->player_ = NULL; 40 this->isForPlayer_ = true; 38 41 } 39 42 -
code/branches/questsystem2/src/orxonox/objects/worldentities/triggers/PlayerTrigger.h
r2194 r2196 48 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 49 49 50 virtual ControllableEntity* getTriggeringPlayer(void) const = 0; 50 inline ControllableEntity* getTriggeringPlayer(void) const 51 { return this->player_; } 51 52 52 53 protected: 53 54 virtual bool isTriggered(TriggerMode mode) = 0; 55 56 inline void setTriggeringPlayer(ControllableEntity* player) 57 { this->player_ = player; } 58 inline bool isForPlayer(void) const 59 { return this->isForPlayer_; } 60 inline void setForPlayer(bool isForPlayer) 61 { this->isForPlayer_ = isForPlayer; } 62 63 private: 64 ControllableEntity* player_; 65 bool isForPlayer_; 54 66 55 67 };
Note: See TracChangeset
for help on using the changeset viewer.