Changeset 1550 for code/branches/script_trigger/src
- Timestamp:
- Jun 6, 2008, 12:03:56 AM (17 years ago)
- Location:
- code/branches/script_trigger/src/orxonox/objects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/script_trigger/src/orxonox/objects/Trigger.cc
r1541 r1550 29 29 #include "Trigger.h" 30 30 31 #include "core/Debug.h" 32 31 33 #include "core/CoreIncludes.h" 32 34 … … 40 42 41 43 targetMask_.exclude(Class(BaseObject)); 44 45 if (getSoftDebugLevel() >= ORX_DEBUG) 46 { 47 debugBillboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1); 48 this->getNode()->attachObject(debugBillboard_.getBillboardSet()); 49 } 42 50 } 43 51 … … 85 93 } 86 94 95 void Trigger::XMLPort(Element& xmlelement, XMLPort::Mode mode) 96 { 97 WorldEntity::XMLPort(xmlelement, mode); 98 } 99 87 100 void Trigger::addTrigger(Trigger* trig) 88 101 { 89 102 if (this != trig) 90 this-> triggers_.insert(trig);103 this->subTriggers_.insert(trig); 91 104 } 92 105 … … 99 112 } 100 113 114 void Trigger::removeTargets(std::string targets) 115 { 116 Identifier* targetId = ID(targets); 117 targetMask_.exclude(targetId); 118 } 119 101 120 bool Trigger::checkAnd() 102 121 { 103 122 std::set<Trigger*>::iterator it; 104 for(it = this-> triggers_.begin(); it != this->triggers_.end(); it++)123 for(it = this->subTriggers_.begin(); it != this->subTriggers_.end(); it++) 105 124 { 106 125 if(!((*it)->isTriggered())) … … 113 132 { 114 133 std::set<Trigger*>::iterator it; 115 for(it = this-> triggers_.begin(); it != this->triggers_.end(); it++)134 for(it = this->subTriggers_.begin(); it != this->subTriggers_.end(); it++) 116 135 { 117 136 if((*it)->isTriggered()) -
code/branches/script_trigger/src/orxonox/objects/Trigger.h
r1541 r1550 37 37 #include "core/BaseObject.h" 38 38 #include "core/ClassTreeMask.h" 39 #include "../tools/BillboardSet.h" 39 40 40 41 namespace orxonox { … … 54 55 public: 55 56 Trigger(); 57 Trigger(bool active) { bActive_ = active; } 56 58 ~Trigger(); 57 59 … … 60 62 void addTrigger(Trigger* trig); 61 63 void addTargets(std::string targets); 64 void removeTargets(std::string targets); 65 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 62 66 inline TriggerMode getMode() { return mode_; } 63 67 inline void setMode(TriggerMode mode) { this->mode_ = mode; } 64 inline void tick(float dt) { this->actualTime_ += dt; } 68 inline void tick(float dt) { if(bActive_) this->actualTime_ += dt; } 69 inline void reset(float time) { this->actualTime_ = 0; this->triggingTime_ = time; } 70 inline void reset() { reset(triggingTime_); } 65 71 66 72 private: … … 71 77 72 78 private: 73 std::set<Trigger*> triggers_;79 std::set<Trigger*> subTriggers_; 74 80 TriggerMode mode_; 75 81 float triggingTime_; 76 82 float actualTime_; 77 83 float radius_; 84 bool bActive_; 78 85 ClassTreeMask targetMask_; 86 BillboardSet debugBillboard_; 79 87 }; 80 88
Note: See TracChangeset
for help on using the changeset viewer.