Beispiel #1
0
void CluzookaCluster::DoExplosion()
{
  if ( !m_spawned_clusters )
  {
    ApplyExplosion(GetPosition(), cfg, "weapon/cluzooka_hit", false, ParticleEngine::LittleESmoke);
  }
  else
    Ghost();    // just hide ourselvers
}
Beispiel #2
0
void Suicide::Refresh()
{
  // The suicide sound may play at different speed for different players,
  // that's why the explosion should not depend on the fact if the sound has finished playing or not.
  uint time_since_last_fire = Time::GetInstance()->Read() - m_last_fire_time;
  Character *player = &ActiveCharacter();
  if (m_last_fire_time > 0 && time_since_last_fire > SUICIDE_SOUND_DURATION_IN_MS && !player->IsDead()) {
    player->DisableDeathExplosion();
    player->body->MakeParticles(ActiveCharacter().GetPosition());
    player->SetEnergy(0, player); // Die!
    ApplyExplosion(player->GetCenter(), cfg());
  }
}
void CPhysicsManager::OverlapSphereActorGrenade (float radiusSphere, const Vect3f& posSphere, std::vector<CPhysicUserData*> impactObjects, float _fPower)
{
	assert(m_pScene);

	NxSphere worldSphere(NxVec3(posSphere.x,posSphere.y,posSphere.z), radiusSphere);
	NxU32 nbShapes = m_pScene->getNbDynamicShapes();
	NxShape** shapes = new NxShape* [nbShapes];
	for (NxU32 i = 0; i < nbShapes; i++)
	{
		shapes[i] = NULL;
	}

	//NX_DYNAMIC_SHAPES
	m_pScene->overlapSphereShapes(worldSphere, NX_DYNAMIC_SHAPES, nbShapes, shapes, NULL);

	for (NxU32 i = 0; i < nbShapes; i++) 
	{
		if( shapes[i] != NULL )
		{
			NxActor* actor = &shapes[i]->getActor();
			CPhysicUserData* physicObject = (CPhysicUserData*)actor->userData;
			//Si está petando aquí quiere decir que se ha registrado un objeto físico sin proporcionarle ID
			assert(physicObject);	
			//Antes de meterlo comprobamos que no exista ya (un objeto fisico puede estar compuesto por varias shapes)
			std::vector<CPhysicUserData*>::iterator it(impactObjects.begin());
			std::vector<CPhysicUserData*>::iterator itEnd(impactObjects.end());
			bool find = false; 
			while (it!=itEnd)
			{
				CPhysicUserData* id = *it;
				if( id == physicObject)
					find = true;
				++it;
			}

			if(!find)
			{
				impactObjects.push_back(physicObject);
				physicObject->SetColor(colRED);
				ApplyExplosion(actor,posSphere,radiusSphere,_fPower);
			}
		}
		//delete &shapes[i];
	}

	delete shapes;
	/*for (NxU32 i = 0; i < nbShapes; i++) 
	{
	delete &shapes[i];
	}*/
}
//void CBreakableObject::Hit(float P,Fvector &dir, CObject* who,s16 element,
//					   Fvector p_in_object_space, float impulse, ALife::EHitType hit_type)
void	CBreakableObject::Hit					(SHit* pHDS)
{
	CheckHitBreak(pHDS->damage(),pHDS->hit_type);
	if(m_pPhysicsShell)
	{
		if(pHDS->hit_type==ALife::eHitTypeExplosion)
		{
			ApplyExplosion(pHDS->dir,pHDS->impulse);
		}
		else
		{
			//. hack: slipch ???
			if ((pHDS->impulse>EPS)&&(BI_NONE != pHDS->bone()))
				m_pPhysicsShell->applyImpulseTrace(pHDS->p_in_bone_space,pHDS->dir,pHDS->impulse,pHDS->bone());
		}
	}
}
Beispiel #5
0
void Cluster::DoExplosion()
{
  ApplyExplosion (GetPosition(), cfg, "weapon/explosion", false, ParticleEngine::LittleESmoke);
}