MCPcopy Create free account
hub / github.com/arnaud-jamin/Cog / TryHit

Method TryHit

Source/CogSample/CogSampleProjectileComponent.cpp:458–488  ·  view source on GitHub ↗

--------------------------------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

456
457//--------------------------------------------------------------------------------------------------------------------------
458void UCogSampleProjectileComponent::TryHit(const FHitResult& HitResult)
459{
460 COG_LOG_OBJECT(LogCogProjectile, ELogVerbosity::Verbose, Creator.Get(), TEXT("Projectile:%s | Role:%s | Other:%s | Comp:%s | Bone:%s"),
461 *GetNameSafe(GetOwner()),
462 *GetRoleName(),
463 *GetNameSafe(HitResult.GetActor()),
464 *GetNameSafe(HitResult.GetComponent()),
465 *HitResult.BoneName.ToString());
466
467 //-----------------------------------------------------------------------------------------
468 // User defined callback for gameplay logic
469 //-----------------------------------------------------------------------------------------
470 if (ShouldHit(HitResult) == false)
471 {
472 COG_LOG_OBJECT(LogCogProjectile, ELogVerbosity::Verbose, Creator.Get(), TEXT("Skipped by ShouldHit callback"));
473 return;
474 }
475
476 HitActors.Add(HitResult.GetActor());
477
478 //-----------------------------------------------------------------------------------------
479 // User defined callback to decide what should happen to projectile (Stop, Attach, ...)
480 //-----------------------------------------------------------------------------------------
481 FCogSampleHitConsequence HitConsequence;
482 Hit(HitResult, HitConsequence);
483
484 if (HitConsequence.Stop)
485 {
486 //InternalStop(HitResult, HitConsequence);
487 }
488}
489
490//--------------------------------------------------------------------------------------------------------------------------
491void UCogSampleProjectileComponent::StopSimulating(const FHitResult& HitResult)

Callers

nothing calls this directly

Calls 3

GetOwnerFunction · 0.85
ToStringMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected