void CBurnEffectManager::AddBurnPoint( const EventPhysCollision& pCollision, SMikeBulletParams* pBurnBulletParams, int hitType, bool shooterIsPlayer, const uint8 shooterFactionID) { int surfaceType = pCollision.idmat[1]; CGameRules* pGameRules = g_pGame->GetGameRules(); IEntity* pEntity = pCollision.iForeignData[1] == PHYS_FOREIGN_ID_ENTITY ? (IEntity*)pCollision.pForeignData[1] : NULL; const SMikeBulletParams::SBurnParams* pBurnParams = NULL; EntityId entityId = 0; if(pEntity) { pBurnParams = pBurnBulletParams->GetBurnClassParams(pEntity->GetClass()); entityId = pEntity->GetId(); } if(!pBurnParams) { entityId = 0; pBurnParams = pBurnBulletParams->GetBurnSurfaceParams(surfaceType); } // Burn-points are 'recycled/shared' between entities, so we can only differentiate // between factions. This limits the 'hit detection' to a per factions basis also. TBurnPoints::iterator best = entityId ? FindBurnPointOnEntity(entityId, shooterFactionID) : FindClosestBurnPoint(pCollision.pt, surfaceType, shooterFactionID); if (best != m_burnPoints.end()) { best->m_accumulation += best->m_pBurnParams->m_buildUp; best->m_accumulationDelay = best->m_pBurnParams->m_dissipationDelay; } else { SBurnPoint burnPoint; burnPoint.m_pBurnParams = pBurnParams; burnPoint.m_effect = 0; burnPoint.m_accumulation = burnPoint.m_pBurnParams->m_buildUp; burnPoint.m_accumulationDelay = burnPoint.m_pBurnParams->m_dissipationDelay; burnPoint.m_radius = pBurnParams->m_radius; burnPoint.m_position = pCollision.pt; burnPoint.m_surfaceType = surfaceType; burnPoint.m_attachedEntityId = entityId; burnPoint.m_hitType = hitType; burnPoint.m_shootByPlayer = shooterIsPlayer; burnPoint.m_shooterFactionID = shooterFactionID; PushNewBurnPoint(pCollision, &burnPoint); } SpawnImpactEffect(pCollision, pBurnParams->m_impactEffectName.c_str()); }
void AShooterProjectile::SimulateExplode(const FHitResult& HitResult) { if (nullptr != StaticMeshComp) { StaticMeshComp->SetHiddenInGame(true); } if (nullptr != TrailParticleComp) { TrailParticleComp->SetHiddenInGame(true); } SpawnImpactEffect(HitResult); }
void AWeaponBase::DoFire(){ FHitResult Hit(ForceInit); FVector Start = WeaponMesh->GetSocketLocation(MuzzleSocketName); FVector End = Start + CalcSpread() * MaxRange; GetWorld()->LineTraceSingleByChannel(Hit, Start, End, ECC_Weapon, TraceParams); UE_LOG(LogTemp, Warning, TEXT("Fire!")); CurrentAmmo--; SpawnFireEffect(); if(Hit.GetActor()){ UE_LOG(LogTemp, Warning, TEXT("Hit! %s"), *Hit.GetActor()->GetName()); DealDamage(Hit); SpawnImpactEffect(Hit); } }