Changeset 10840 for code/branches/campaignHS15/src/orxonox
- Timestamp:
- Nov 23, 2015, 4:56:50 PM (9 years ago)
- Location:
- code/branches/campaignHS15/src/orxonox/controllers
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc
r10838 r10840 80 80 void CommonController::setProtectXML( std::string val ) 81 81 { 82 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)83 {84 if ((*itP)->getName() == val)85 {86 this->setProtect (static_cast<ControllableEntity*>(*itP));87 } 88 89 } 82 this->protectName_ = val; 83 84 } 85 void CommonController::tick(float dt) 86 { 87 88 } 89 90 90 std::string CommonController::getProtectXML () 91 91 { … … 202 202 else if (action == Action::PROTECT) 203 203 { 204 if (target) 205 this->setProtect (target); 204 206 } 205 207 } … … 211 213 this->setTargetPosition (target); 212 214 } 213 else if (action == Action::PROTECT) 214 { 215 216 } 215 217 216 } 218 217 void CommonController::setAction (Action::Value action, const Vector3& target, const Quaternion& orient ) … … 224 223 this->setTargetOrientation (orient); 225 224 } 226 else if (action == Action::PROTECT) 227 { 228 229 } 225 230 226 } 231 227 void CommonController::setClosestTarget() -
code/branches/campaignHS15/src/orxonox/controllers/CommonController.h
r10838 r10840 77 77 CommonController(Context* context); 78 78 virtual ~CommonController(); 79 80 virtual void tick(float dt); 79 81 80 82 //----[XML data]---- … … 194 196 FormationMode::Value formationMode_; 195 197 Rank::Value rank_; 198 std::string protectName_; 196 199 Action::Value action_; 197 200 //----[/"Private" variables]---- -
code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc
r10838 r10840 133 133 else if (this->action_ == Action::PROTECT) 134 134 { 135 if (this->getProtect()) 136 { 137 orxout(internal_error) << "PROTECT FOUND" << endl; 138 } 135 if (!this->getProtect()) 136 { 137 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP) 138 { 139 if ((*itP)->getName() == this->protectName_) 140 { 141 this->setProtect (static_cast<ControllableEntity*>(*itP)); 142 } 143 } 144 } 145 else 146 { 147 /* if (this->myWingman_) 148 this->myWingman_->setAction (Action::PROTECT, this->getProtect()); 149 if (this->myFollower_) 150 this->myFollower_->setAction (Action::PROTECT, this->getProtect()); 151 */ 152 Vector3* targetRelativePosition; 153 154 targetRelativePosition = new Vector3 (0, 0, 500); 155 156 Vector3 targetAbsolutePosition = ((this->getProtect()->getWorldPosition()) + 157 (this->getProtect()->getWorldOrientation()* (*targetRelativePosition))); 158 this->setTargetPosition(targetAbsolutePosition); 159 160 this->setTargetPositionOfWingman(); 161 this->setTargetPositionOfFollower(); 162 } 163 139 164 } 140 165 -
code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc
r10838 r10840 145 145 else if (this->action_ == Action::PROTECT) 146 146 { 147 /* if (this->myWingman_) 148 this->myWingman_->setAction (Action::PROTECT, this->getProtect()); 149 */ 150 this->setTargetPositionOfWingman(); 147 151 148 152 }
Note: See TracChangeset
for help on using the changeset viewer.