Changeset 10073 in orxonox.OLD for branches/playability/src/world_entities/weapons/swarm_launcher.cc
- Timestamp:
- Dec 13, 2006, 10:30:51 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/weapons/swarm_launcher.cc
r10046 r10073 25 25 #include "animation3d.h" 26 26 27 #include <list> 28 #include <iterator> 29 #include "util/state.h" 30 31 #include "math/quaternion.h" 32 27 33 #include "util/loading/factory.h" 28 34 29 35 #include "class_id_DEPRECATED.h" 36 37 using namespace std; 30 38 31 39 ObjectListDefinitionID(SwarmLauncher, CL_SWARM_LAUNCHER); … … 136 144 void SwarmLauncher::fire() 137 145 { 138 Projectile* pj = this->getProjectile(); 139 if (pj == NULL) 140 return; 146 Projectile* pj; 147 int i = 0; 148 std::list<WorldEntity*> eList = State::getObjectManager()->getEntityList( OM_GROUP_00); 149 list<WorldEntity*>::iterator eIterator; 150 PRINTF(0)("Iterator output: %i\n",eList.size()); 151 for( eIterator = eList.begin(); eIterator != eList.end(); eIterator++); 152 { 153 PRINTF(0)("Iterator step: %i with content: %s\n",++i,*eIterator); 154 if( (dynamic_cast<WorldEntity*>(*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 50000.0) 155 { 156 pj = this->getProjectile(); 157 if (pj == NULL) 158 return; 141 159 142 pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*165.0 /*+ VECTOR_RAND(13) */ 143 /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity()); 144 145 pj->setParent(PNode::getNullParent()); 146 pj->setAbsCoor(this->getEmissionPoint()); 147 pj->setAbsDir(this->getAbsDir()); 148 pj->activate(); 160 pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*165.0 + VECTOR_RAND(20))*.5); 161 162 pj->setParent(PNode::getNullParent()); 163 pj->setAbsCoor(this->getEmissionPoint()); 164 pj->setAbsDir(this->getAbsDir()); 165 pj->setTarget( *eIterator); 166 pj->activate(); 167 this->increaseEnergy( pj->getMinEnergy()); 168 } 169 } 170 this->increaseEnergy( - pj->getMinEnergy()); 149 171 }
Note: See TracChangeset
for help on using the changeset viewer.