// Fill out your copyright notice in the Description page of Project Settings. #include "BlasterGameMode.h" #include "Blaster/Character/BlasterCharacter.h" #include "GameFramework/PlayerStart.h" #include "Kismet/GameplayStatics.h" void ABlasterGameMode::PlayerEliminated(ABlasterCharacter* EliminatedCharacter, ABlasterPlayerController* VictimController, ABlasterPlayerController* AttackerController) { if (EliminatedCharacter) { EliminatedCharacter->Eliminated(); } } void ABlasterGameMode::RequestRespawn(ACharacter* EliminatedCharacter, AController* EliminatedController) { if (EliminatedCharacter) { EliminatedCharacter->Reset(); EliminatedCharacter->Destroy(); } if (EliminatedController) { TArray PlayerStarts; UGameplayStatics::GetAllActorsOfClass(this, APlayerStart::StaticClass(), PlayerStarts); const int32 Selection = FMath::RandRange(0, PlayerStarts.Num() - 1); RestartPlayerAtPlayerStart(EliminatedController, PlayerStarts[Selection]); } }