Changeset 10196 in orxonox.OLD for branches/playability/src/world_entities/weapons/spike_thrower.cc
- Timestamp:
- Jan 8, 2007, 9:46:13 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/weapons/spike_thrower.cc
r10180 r10196 146 146 void SpikeThrower::fire() 147 147 { 148 bool fired = false; 148 Projectile* pj = this->getProjectile(); 149 if (pj == NULL) 150 return; 149 151 150 Projectile* pj = NULL; 151 for( ObjectList<Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++) 152 { 153 if( ((*eIterator)->getOMListNumber() == OM_GROUP_00) && ((*eIterator)->getClassCName() != "Weapon") && ((*eIterator)->getClassCName() != "Projectile") && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 300) 154 { 155 pj = this->getProjectile(); 156 if (pj == NULL) 157 return; 158 159 fired = true; 160 pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*115.0 + VECTOR_RAND(10))); 152 // set the owner 153 pj->setOwner(this->getOwner()); 161 154 162 pj->setParent(PNode::getNullParent()); 163 pj->setAbsCoor(this->getEmissionPoint()); 164 pj->setAbsDir(this->getAbsDir()); 165 // dynamic_cast<SpikeProjectile*>(pj)->setTarget( (PNode*)(*eIterator) ); 166 pj->toList(OM_GROUP_01_PROJ); 167 pj->activate(); 168 } 169 } 170 if( !fired) 171 this->increaseEnergy( this->getProjectile()->getMinEnergy()); 155 pj->setParent(PNode::getNullParent()); 156 157 pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*150); 158 pj->setAbsCoor(this->getEmissionPoint()); 159 160 pj->setAbsDir(this->getAbsDir()); 161 pj->activate(); 172 162 }
Note: See TracChangeset
for help on using the changeset viewer.