Changeset 2221 for code/branches/questsystem2/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc
- Timestamp:
- Nov 19, 2008, 11:50:03 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem2/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc
r2209 r2221 35 35 #include "core/XMLPort.h" 36 36 37 #include "orxonox/objects/worldentities/ControllableEntity.h" 38 37 39 namespace orxonox 38 40 { … … 45 47 this->distance_ = 100; 46 48 this->targetMask_.exclude(Class(BaseObject)); 47 this->setForPlayer(false); 49 this->setForPlayer(false); //!< Normally hasn't just ControllableEntities as targets. 48 50 } 49 51 … … 83 85 void DistanceTrigger::addTargets(const std::string& targets) 84 86 { 85 86 if(targets == "ControllableEntity") 87 Identifier* targetId = ClassByString(targets); 88 89 //! Checks whether the target is (or is derived from) a ControllableEntity. 90 Identifier* controllableEntityId = Class(ControllableEntity); 91 if(targetId->isA(controllableEntityId)) 87 92 { 88 93 this->setForPlayer(true); 89 94 } 90 91 Identifier* targetId = ClassByString(targets); 95 92 96 if (!targetId) 93 97 { … … 125 129 if (distanceVec.length() < this->distance_) 126 130 { 131 132 //! If the target is a player (resp. is a, or is derived from a, ControllableEntity) the triggeringPlayer is set to the target entity. 127 133 if(this->isForPlayer()) 128 134 { 129 130 135 ControllableEntity* player = dynamic_cast<ControllableEntity*>(entity); 136 this->setTriggeringPlayer(player); 131 137 } 132 138
Note: See TracChangeset
for help on using the changeset viewer.