Changeset 9733 for code/branches/levelKaan/src/orxonox
- Timestamp:
- Nov 1, 2013, 12:19:18 AM (11 years ago)
- Location:
- code/branches/levelKaan
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/levelKaan
- Property svn:mergeinfo changed
/code/trunk (added) merged: 9703,9716,9728-9730
- Property svn:mergeinfo changed
-
code/branches/levelKaan/src/orxonox/controllers/WaypointPatrolController.cc
r9667 r9733 42 42 RegisterObject(WaypointPatrolController); 43 43 44 this->alertnessradius_ = 500; 44 this->alertnessradius_ = 500.0f; 45 this->attackradius_ = 1000.0f; 45 46 46 47 this->patrolTimer_.setTimer(rnd(), true, createExecutor(createFunctor(&WaypointPatrolController::searchEnemy, this))); … … 52 53 53 54 XMLPortParam(WaypointPatrolController, "alertnessradius", setAlertnessRadius, getAlertnessRadius, xmlelement, mode).defaultValues(500.0f); 55 XMLPortParam(WaypointPatrolController, "attackradius", setAttackRadius, getAttackRadius, xmlelement, mode).defaultValues(1000.0f); 54 56 } 55 57 … … 59 61 return; 60 62 61 if (this->target_) 63 if (this->target_) //if there is a target, follow it and shoot it, if it is close enough 62 64 { 63 65 this->aimAtTarget(); … … 66 68 this->moveToTargetPosition(); 67 69 68 if (this->getControllableEntity() && this->isCloseAtTarget( 1000) && this->isLookingAtTarget(math::pi / 20.0f))70 if (this->getControllableEntity() && this->isCloseAtTarget(this->attackradius_) && this->isLookingAtTarget(math::pi / 20.0f)) 69 71 this->getControllableEntity()->fire(0); 70 72 } -
code/branches/levelKaan/src/orxonox/controllers/WaypointPatrolController.h
r9667 r9733 50 50 inline float getAlertnessRadius() const 51 51 { return this->alertnessradius_; } 52 53 inline void setAttackRadius(float distance) 54 { this->attackradius_ = distance; } 55 inline float getAttackRadius() const 56 { return this->attackradius_; } 52 57 53 58 protected: 54 59 void searchEnemy(); 55 60 56 float alertnessradius_; 61 float alertnessradius_; //!< Enemies within this radius are being followed and shot. 62 float attackradius_; //!< Enemies only get shot, if they are within the attackradius_. 57 63 Timer patrolTimer_; 58 64 }; -
code/branches/levelKaan/src/orxonox/gametypes/Mission.cc
r9667 r9733 32 32 33 33 #include "core/CoreIncludes.h" 34 #include "core/command/ConsoleCommand.h" 35 #include "infos/PlayerInfo.h" 34 36 #include "network/Host.h" 35 37 #include "worldentities/pawns/Pawn.h" 36 38 39 37 40 namespace orxonox 38 41 { 42 SetConsoleCommand("Mission", "endMission", &Mission::endMission); 43 SetConsoleCommand("Mission", "setLives", &Mission::setLivesWrapper); 39 44 RegisterUnloadableClass(Mission); 40 45 … … 56 61 this->end(); 57 62 } 63 else if (this->lives_ == 0) 64 { 65 this->missionAccomplished_ = false; 66 this->end(); 67 } 58 68 } 59 69 60 70 void Mission::pawnKilled(Pawn* victim, Pawn* killer) 61 71 { 62 if (victim && victim->getPlayer() && this->lives_ == 1)72 if (victim && victim->getPlayer() && victim->getPlayer()->isHumanPlayer() ) 63 73 { 64 this->missionAccomplished_ = false; 65 this->end(); 74 this->lives_--; 66 75 } 67 76 } … … 78 87 { 79 88 Gametype::end(); 80 /*if (this->missionAccomplished_)89 if (this->missionAccomplished_) 81 90 this->gtinfo_->sendAnnounceMessage("Mission accomplished!"); 82 91 else 83 92 this->gtinfo_->sendAnnounceMessage("Mission failed!"); 84 */85 93 } 86 94 … … 94 102 } 95 103 } 96 104 void Mission::endMission(bool accomplished) 105 { 106 for (ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it) 107 {//TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would end ALL missions! 108 it->setMissionAccomplished(accomplished); 109 it->end(); 110 } 111 } 112 113 void Mission::setLivesWrapper(unsigned int amount) 114 { 115 for (ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it) 116 {//TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would affect ALL missions! 117 it->setLives(amount); 118 } 119 } 97 120 98 121 -
code/branches/levelKaan/src/orxonox/gametypes/Mission.h
r9667 r9733 52 52 inline unsigned int getLives() 53 53 {return this->lives_;} 54 inline void setMissionAccomplished(bool acc) 55 {this->missionAccomplished_ = acc;} 56 static void endMission(bool accomplished); 57 static void setLivesWrapper(unsigned int amount); 54 58 55 59 protected: … … 57 61 bool missionAccomplished_; //<! indicates if player successfully finsihed the mission; 58 62 int lives_; //<! amount of player's lives <-> nr. of retries 59 63 //<! If the lives_ are set negative -> unlimited lives. 60 64 }; 61 65 }
Note: See TracChangeset
for help on using the changeset viewer.