Changeset 10903 for code/branches/campaignHS15/src/orxonox/controllers
- Timestamp:
- Nov 30, 2015, 5:39:43 PM (9 years ago)
- Location:
- code/branches/campaignHS15/src/orxonox/controllers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc
r10898 r10903 119 119 if (!this->getControllableEntity() || !orxonox_cast<Pawn*> (this->getControllableEntity())) 120 120 return; 121 this->startAttackingEnemiesThatAreClose(); 121 122 122 123 this->deltaHp = orxonox_cast<Pawn*> (this->getControllableEntity())->getHealth() - this->previousHp; … … 132 133 // this->parsedActionpoints_.push_back(point); 133 134 // } 134 this->startAttackingEnemiesThatAreClose();135 135 136 136 if (this->parsedActionpoints_.empty() && this->loopActionpoints_.empty()) … … 146 146 if (this->action_ == Action::FIGHTALL) 147 147 { 148 148 149 if (!this->hasTarget()) 149 150 { … … 170 171 else if (this->action_ == Action::FIGHT) 171 172 { 172 if (!this->hasTarget()) 173 174 if (!this->hasTarget() ) 173 175 { 174 176 //----find a target---- … … 210 212 else if (this->action_ == Action::FLY) 211 213 { 212 this->startAttackingEnemiesThatAreClose();213 214 if (this->squaredDistanceToTarget() <= this->squaredaccuracy_) 214 215 { … … 219 220 else if (this->action_ == Action::PROTECT) 220 221 { 221 this->startAttackingEnemiesThatAreClose();222 222 if (!this->getProtect()) 223 223 { … … 229 229 else if (this->action_ == Action::ATTACK) 230 230 { 231 this->startAttackingEnemiesThatAreClose(); 231 232 232 if (!this->hasTarget()) 233 233 { … … 620 620 void ActionpointController::startAttackingEnemiesThatAreClose() 621 621 { 622 if (this->action_ != Action::FIGHT && this->action_ != Action::FIGHTALL)622 //if (this->action_ != Action::FIGHT && this->action_ != Action::FIGHTALL) 623 623 { 624 624 if (!this->target_ || (this->target_ && CommonController::distance (this->getControllableEntity(), this->target_) > this->attackRange_)) … … 636 636 else 637 637 { 638 //orxout (internal_error) << "found new target " << CommonController::getName(newTarget) <<endl; 638 639 Point p = { Action::FIGHT, CommonController::getName(newTarget), Vector3::ZERO, false }; 639 640 this->parsedActionpoints_.push_back(p); -
code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc
r10898 r10903 37 37 #include "weaponsystem/Weapon.h" 38 38 #include "weaponsystem/WeaponSlot.h" 39 #include "weaponsystem/WeaponSlot.h" 39 #include "weaponsystem/WeaponSystem.h" 40 #include "weaponsystem/Munition.h" 41 40 42 namespace orxonox 41 43 { … … 139 141 } 140 142 //too close? How do u expect to dodge anything? Just attack! 141 else if (diffLength < 400)143 else if (diffLength < 1000) 142 144 { 143 145 this->bKeepFormation_ = false; 144 146 145 147 //at this point, just look and shoot 146 if (diffLength < 200)148 if (diffLength < 500) 147 149 { 148 150 this->stopMoving(); … … 151 153 else 152 154 { 153 this->setTargetPosition(this->positionOfTarget_ - diffUnit * 100.0f);155 this->setTargetPosition(this->positionOfTarget_ - diffUnit * 300.0f); 154 156 } 155 157 } … … 158 160 { 159 161 this->bKeepFormation_ = false; 160 this->setTargetPosition(this->positionOfTarget_ - diffUnit * 100.0f);162 this->setTargetPosition(this->positionOfTarget_ - diffUnit * 300.0f); 161 163 } 162 164 //That's unfortunate, he is looking and probably shooting... try to dodge what we can... … … 166 168 if (maneuverCounter_ == 0) 167 169 { 168 this->setTargetPosition(this->positionOfTarget_ - diffUnit * 50.0f);170 this->setTargetPosition(this->positionOfTarget_ - diffUnit * 100.0f); 169 171 return; 170 172 } 171 dodge(thisPosition, diffUnit); 173 if (this->actionCounter_ % 3 == 0) 174 dodge(thisPosition, diffUnit); 172 175 } 173 176 } … … 365 368 { 366 369 std::string wName = wMode->getIdentifier()->getName(); 370 // SubclassIdentifier<Munition> munition = ClassByString(wName); 367 371 if (wName == "RocketFire") 368 372 this->rocketsLeft_ = 10; 373 // this->rocketsLeft_ = orxonox_cast<Pawn*>(this->getControllableEntity())->getWeaponSystem()->getMunition(&munition)->getNumMunitionInCurrentMagazine(wMode); 369 374 if(this->getFiremode(wName) == -1) //only add a weapon, if it is "new" 370 375 weaponModes_[wName] = wMode->getMode(); … … 375 380 }//pawn->weaponSystem_->getMunition(SubclassIdentifier< Munition > *identifier)->getNumMunition (WeaponMode *user); 376 381 } 382 383 //orxout (internal_error) << this->rocketsLeft_ << " rockets left" << endl; 377 384 } 378 385
Note: See TracChangeset
for help on using the changeset viewer.