本文整理汇总了C++中APlayerController::ClientPlayForceFeedback方法的典型用法代码示例。如果您正苦于以下问题:C++ APlayerController::ClientPlayForceFeedback方法的具体用法?C++ APlayerController::ClientPlayForceFeedback怎么用?C++ APlayerController::ClientPlayForceFeedback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类APlayerController
的用法示例。
在下文中一共展示了APlayerController::ClientPlayForceFeedback方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnBeginOverlap
void ABouncerPlayer::OnBeginOverlap(AActor* OtherActor)
{
if (OtherActor->GetClass()->IsChildOf(ABall::StaticClass()))
{
ABall *ShootingBall = Cast<ABall>(OtherActor);
if (ShootingBall)
{
APlayerController* PlayerController = Cast<APlayerController>(Controller);
if (PlayerController)
{
PlayerController->ClientPlayForceFeedback(EffectClass, false, "Hit");
}
ShootingBall->SetOwner(this,SpotLight->GetLightColor());
}
}
}
示例2: PlayHit
void AAmethystCharacter::PlayHit(float DamageTaken, struct FDamageEvent const& DamageEvent, class APawn* PawnInstigator, class AActor* DamageCauser)
{
if (Role == ROLE_Authority)
{
ReplicateHit(DamageTaken, DamageEvent, PawnInstigator, DamageCauser, false);
// play the force feedback effect on the client player controller
APlayerController* PC = Cast<APlayerController>(Controller);
if (PC && DamageEvent.DamageTypeClass)
{
UAmethystDamageType *DamageType = Cast<UAmethystDamageType>(DamageEvent.DamageTypeClass->GetDefaultObject());
if (DamageType && DamageType->HitForceFeedback)
{
PC->ClientPlayForceFeedback(DamageType->HitForceFeedback, false, "Damage");
}
}
}
if (DamageTaken > 0.f)
{
ApplyDamageMomentum(DamageTaken, DamageEvent, PawnInstigator, DamageCauser);
}
AamethystforestPlayerController* MyPC = Cast<AamethystforestPlayerController>(Controller);
AAmethystHUD* MyHUD = MyPC ? Cast<AAmethystHUD>(MyPC->GetHUD()) : NULL;
if (MyHUD)
{
MyHUD->NotifyHit(DamageTaken, DamageEvent, PawnInstigator);
}
if (PawnInstigator && PawnInstigator != this && PawnInstigator->IsLocallyControlled())
{
AamethystforestPlayerController* InstigatorPC = Cast<AamethystforestPlayerController>(PawnInstigator->Controller);
AAmethystHUD* InstigatorHUD = InstigatorPC ? Cast<AAmethystHUD>(InstigatorPC->GetHUD()) : NULL;
if (InstigatorHUD)
{
InstigatorHUD->NotifyEnemyHit();
}
}
}
示例3: OnDeath
void ANimModCharacter::OnDeath(float KillingDamage, struct FDamageEvent const& DamageEvent, class APawn* PawnInstigator, class AActor* DamageCauser)
{
if (bIsDying)
{
return;
}
bReplicateMovement = false;
bTearOff = true;
bIsDying = true;
if (Role == ROLE_Authority)
{
ReplicateHit(KillingDamage, DamageEvent, PawnInstigator, DamageCauser, true);
// play the force feedback effect on the client player controller
APlayerController* PC = Cast<APlayerController>(Controller);
if (PC && DamageEvent.DamageTypeClass)
{
UNimModDamageType *DamageType = Cast<UNimModDamageType>(DamageEvent.DamageTypeClass->GetDefaultObject());
if (DamageType && DamageType->KilledForceFeedback)
{
PC->ClientPlayForceFeedback(DamageType->KilledForceFeedback, false, "Damage");
}
}
}
// cannot use IsLocallyControlled here, because even local client's controller may be NULL here
if (GetNetMode() != NM_DedicatedServer && DeathSound && Mesh1P && Mesh1P->IsVisible())
{
UGameplayStatics::PlaySoundAtLocation(this, DeathSound, GetActorLocation());
}
ANimModPlayerController *controller = GetNimModPlayerController();
if (controller)
{
ANimModPlayerCameraManager *cameraManager = controller->GetNimModPlayerCameraManager();
if (cameraManager)
cameraManager->ResetFOV();
}
// remove all weapons
DestroyInventory();
// switch back to 3rd person view
UpdatePawnMeshes();
DetachFromControllerPendingDestroy();
StopAllAnimMontages();
if (LowHealthWarningPlayer && LowHealthWarningPlayer->IsPlaying())
{
LowHealthWarningPlayer->Stop();
}
if (RunLoopAC)
{
RunLoopAC->Stop();
}
// disable collisions on capsule
GetCapsuleComponent()->SetCollisionEnabled(ECollisionEnabled::NoCollision);
GetCapsuleComponent()->SetCollisionResponseToAllChannels(ECR_Ignore);
if (GetMesh())
{
static FName CollisionProfileName(TEXT("Ragdoll"));
GetMesh()->SetCollisionProfileName(CollisionProfileName);
}
SetActorEnableCollision(true);
// Death anim
float DeathAnimDuration = PlayAnimMontage(DeathAnim);
// Ragdoll
if (DeathAnimDuration > 0.f)
{
// Use a local timer handle as we don't need to store it for later but we don't need to look for something to clear
FTimerHandle TimerHandle;
GetWorldTimerManager().SetTimer(TimerHandle, this, &ANimModCharacter::SetRagdollPhysics, FMath::Min(0.1f, DeathAnimDuration), false);
}
else
{
SetRagdollPhysics();
}
}