Changeset 1969
- Timestamp:
- Oct 20, 2008, 2:08:04 AM (16 years ago)
- Location:
- code/branches/objecthierarchy/src/orxonox/objects
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/objects/DistanceTrigger.cc
r1961 r1969 69 69 } 70 70 71 void DistanceTrigger::addTargets( std::stringtargets)71 void DistanceTrigger::addTargets(const std::string& targets) 72 72 { 73 73 Identifier* targetId = ClassByString(targets); … … 78 78 } 79 79 80 void DistanceTrigger::removeTargets( std::stringtargets)80 void DistanceTrigger::removeTargets(const std::string& targets) 81 81 { 82 82 Identifier* targetId = ClassByString(targets); -
code/branches/objecthierarchy/src/orxonox/objects/DistanceTrigger.h
r1959 r1969 48 48 void addTarget(Ogre::Node* targetNode); 49 49 void removeTarget(Ogre::Node* targetNode); 50 void addTargets( std::stringtargets);51 void removeTargets( std::stringtargets);50 void addTargets(const std::string& targets); 51 void removeTargets(const std::string& targets); 52 52 void setDistance(float dist); 53 53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); -
code/branches/objecthierarchy/src/orxonox/objects/Trigger.cc
r1962 r1969 39 39 { 40 40 41 SetConsoleCommand(Trigger, setVisibility, false).accessLevel(AccessLevel::User).defaultValues(0);41 SetConsoleCommand(Trigger, debugFlares, false).defaultValues(false); 42 42 43 43 CreateFactory(Trigger); … … 58 58 59 59 debugBillboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1); 60 debugBillboard_.setVisible(false); 61 60 62 this->getNode()->attachObject(debugBillboard_.getBillboardSet()); 61 63 } … … 67 69 void Trigger::init() 68 70 { 69 this->setVisibility(true);70 71 timeSinceLastEvent_ = delay_; 71 72 } 72 73 73 void Trigger::setVisibility(bool bVisible) 74 { 75 if(bVisible) 76 this->setScale(2); 77 else 78 this->setScale(0); 74 void Trigger::debugFlares(bool bVisible) 75 { 76 for (ObjectList<Trigger>::iterator it = ObjectList<Trigger>::begin(); it != ObjectList<Trigger>::end(); ++it) 77 it->setVisible(bVisible); 78 } 79 80 void Trigger::changedVisibility() 81 { 82 debugBillboard_.setVisible(this->isVisible()); 79 83 } 80 84 … … 206 210 } 207 211 208 void Trigger::setMode( std::stringmodeName)212 void Trigger::setMode(const std::string& modeName) 209 213 { 210 214 if (modeName == "and") … … 224 228 XMLPortParamLoadOnly(Trigger, "activations", setActivations, xmlelement, mode); 225 229 XMLPortParamLoadOnly(Trigger, "invert", setInvert, xmlelement, mode); 226 //XMLPortParamLoadOnlyTemplate(Trigger, "mode", setMode, xmlelement, mode, std::string);230 XMLPortParamLoadOnlyTemplate(Trigger, "mode", setMode, xmlelement, mode, const std::string&); 227 231 228 232 XMLPortObject(Trigger, Trigger, "", addTrigger, getTrigger, xmlelement, mode); -
code/branches/objecthierarchy/src/orxonox/objects/Trigger.h
r1961 r1969 54 54 ~Trigger(); 55 55 56 inline bool isActive() { return bActive_; } 56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 57 virtual void tick(float dt); 58 59 inline bool isActive() const 60 { return bActive_; } 61 57 62 void addTrigger(Trigger* trig); 58 void setInvert(int invert) { bInvertMode_ = invert; }59 63 const Trigger* getTrigger(unsigned int index) const; 60 void setVisibility(bool bVisible); 64 65 inline TriggerMode getMode() const 66 { return mode_; } 67 inline void setMode(TriggerMode mode) 68 { this->mode_ = mode; } 69 void setMode(const std::string& modeName); 70 71 inline void setInvert(int invert) 72 { bInvertMode_ = invert; } 73 inline void setStayOn(int stayOn) 74 { this->bStayOn_ = (stayOn == 1) ? true : false; } 75 inline void setActivations(int activations) 76 { this->remainingActivations_ = activations; } 61 77 void setDelay(float delay); 62 78 bool switchState(); 63 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 64 inline TriggerMode getMode() { return mode_; } 65 inline void setMode(TriggerMode mode) { this->mode_ = mode; } 66 void setMode(std::string modeName); 67 inline void setStayOn(int stayOn) { if (stayOn == 1) this->bStayOn_ = true; else this->bStayOn_ = false; } 68 inline void setActivations(int activations) { this->remainingActivations_ = activations; } 69 void tick(float dt); 79 80 static void debugFlares(bool bVisible); 81 virtual void changedVisibility(); 70 82 71 83 private:
Note: See TracChangeset
for help on using the changeset viewer.