Changeset 6697 for code/branches/dynamicmatch
- Timestamp:
- Apr 12, 2010, 5:04:07 PM (15 years ago)
- Location:
- code/branches/dynamicmatch/src/orxonox/gametypes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/dynamicmatch/src/orxonox/gametypes/Dynamicmatch.cc
r6692 r6697 34 34 #include "infos/PlayerInfo.h" 35 35 #include "worldentities/pawns/Pawn.h" 36 #include "worldentities/pawns/SpaceShip.h" 36 37 #include "core/ConfigValueIncludes.h" 37 38 #include "interfaces/TeamColourable.h" 38 //#include "Engine.h" 39 //timer mit new erstellen 39 #include "items/Engine.h" 40 #include "tools/Timer.h" 41 40 42 namespace orxonox 41 43 { … … 55 57 } 56 58 59 void Dynamicmatch::setConfigValues() 60 { 61 SetConfigValue(gameTime_, 180);//just for test cases 62 SetConfigValue(friendlyfire, true); 63 static ColourValue colours[] = 64 { 65 ColourValue(0.3f, 0.3f, 1.0f), 66 ColourValue(1.0f, 0.3f, 0.3f) 67 68 }; 69 static std::vector<ColourValue> defaultcolours(colours, colours + sizeof(colours) / sizeof(ColourValue)); 70 71 SetConfigValue(partyColours_, defaultcolours); 72 } 73 57 74 void Dynamicmatch::setPlayerColour(PlayerInfo* player) // not sure if this is the right place - helper function 58 75 { … … 81 98 } 82 99 83 84 85 void Dynamicmatch::setConfigValues()86 {87 SetConfigValue(gameTime_, 180);//just for test cases88 SetConfigValue(friendlyfire, true);89 static ColourValue colours[] =90 {91 ColourValue(0.3f, 0.3f, 1.0f),92 ColourValue(1.0f, 0.3f, 0.3f)93 94 };95 static std::vector<ColourValue> defaultcolours(colours, colours + sizeof(colours) / sizeof(ColourValue));96 97 SetConfigValue(partyColours_, defaultcolours);98 }99 100 100 101 bool Dynamicmatch::allowPawnDamage(Pawn* victim, Pawn* originator)//tested - works fine … … 120 121 COUT(0) << messageVictim << std::endl; 121 122 Host::Broadcast(messageVictim); 122 //party switch -> colour switch 123 124 setPlayerColour(victim->getPlayer()); //victim colour 125 setPlayerColour(originator->getPlayer());//orginator colour 123 124 //party switch -> colour switch 125 setPlayerColour(victim->getPlayer()); //victim colour 126 setPlayerColour(originator->getPlayer());//orginator colour 127 128 //Give new pig boost 129 SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim); 130 if (spaceship && spaceship->getEngine()) 131 { 132 spaceship->getEngine()->setSpeedFactor(5); 133 WeakPtr<Engine>* ptr = new WeakPtr<Engine>(spaceship->getEngine()); 134 new Timer(10, false, &createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this))->setDefaultValue(0, ptr), true); 135 } 136 126 137 } 127 138 //Case 3: there are only chasers -> new piggy is needed … … 131 142 onlyChasers=false; 132 143 setPlayerColour(victim->getPlayer()); //victim colour 133 //victim - Boost ueber setBoostFactor(float factor) //vermutlich muss victim gecastet werden 134 // timer aufrufen - nach 5 Sekunden wieder auf normalgeschwindigkeit setzen 144 145 //Give new pig boost 146 SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim); 147 if (spaceship && spaceship->getEngine()) 148 { 149 spaceship->getEngine()->setSpeedFactor(5); 150 WeakPtr<Engine>* ptr = new WeakPtr<Engine>(spaceship->getEngine()); 151 new Timer(10, false, &createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this))->setDefaultValue(0, ptr), true); 152 } 153 154 135 155 std::string message("First victim."); 136 156 COUT(0) << message << std::endl; … … 150 170 } 151 171 152 153 172 void Dynamicmatch::resetSpeedFactor(WeakPtr<Engine>* ptr) 173 { 174 if (*ptr) 175 { 176 (*ptr)->setSpeedFactor(1.0f); 177 } 178 delete ptr; 179 } 154 180 155 181 bool Dynamicmatch::allowPawnDeath(Pawn* victim, Pawn* originator)// … … 192 218 if (!player) 193 219 return; 194 playerParty_[player]=chaser;//playerparty 195 // Set the playercolour 196 Dynamicmatch::setPlayerColour(player); 220 playerParty_[player]=chaser;//playerparty 221 Dynamicmatch::setPlayerColour(player); //Set playercolour 197 222 } 198 223 -
code/branches/dynamicmatch/src/orxonox/gametypes/Dynamicmatch.h
r6686 r6697 58 58 virtual bool playerLeft(PlayerInfo* player);//ToDo: extract the player's party record - done? 59 59 virtual bool playerChangedName(PlayerInfo* player);//unchanged 60 61 void resetSpeedFactor(WeakPtr<Engine>* ptr); 60 62 61 63
Note: See TracChangeset
for help on using the changeset viewer.