Add Respawn Point to Prevent Restarting Whole Level
This commit is contained in:
parent
ac1400019c
commit
00011764c3
BIN
EndlessVendetta/Content/BountySystem/TutorialFacility/RespawnPoint.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/BountySystem/TutorialFacility/RespawnPoint.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Levels/TrainingFacility.umap
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Levels/TrainingFacility.umap
(Stored with Git LFS)
Binary file not shown.
@ -204,8 +204,18 @@ float AEndlessVendettaCharacter::TakeDamage(const float DamageAmount, FDamageEve
|
||||
GetWorld()->GetTimerManager().ClearTimer(RegenHealthTimerHandle);
|
||||
}
|
||||
UE_LOG(LogTemp, Warning, TEXT("Player is dead"));
|
||||
UGameplayStatics::OpenLevel(this, FName(*GetWorld()->GetName()), false);
|
||||
|
||||
TArray<AActor*> FoundActors;
|
||||
UGameplayStatics::GetAllActorsWithTag(GetWorld(), FName(TEXT("Respawn")), FoundActors);
|
||||
if (FoundActors.Num() > 0)
|
||||
{
|
||||
const AActor* RespawnPoint = FoundActors[0];
|
||||
SetActorLocationAndRotation(RespawnPoint->GetActorLocation(), RespawnPoint->GetActorRotation());
|
||||
CurrentHealth = MaxHealth;
|
||||
return Super::TakeDamage(DamageAmount, DamageEvent, EventInstigator, DamageCauser);
|
||||
}
|
||||
|
||||
UGameplayStatics::OpenLevel(this, FName(*GetWorld()->GetName()), false);
|
||||
return Super::TakeDamage(DamageAmount, DamageEvent, EventInstigator, DamageCauser);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user