Download LyraStarterGame/Plugins/CommonGame/Source/Private/CommonPlayerController.cpp from Alexhas2/unitysamples: direct link, hf CLI and curl.
- Browser
- Download file 1.65 kB
-
https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Plugins/CommonGame/Source/Private/CommonPlayerController.cpp
- Command line
-
hf download hf://datasets/Alexhas2/unitysamples/LyraStarterGame/Plugins/CommonGame/Source/Private/CommonPlayerController.cpp
-
curl -L -o CommonPlayerController.cpp https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Plugins/CommonGame/Source/Private/CommonPlayerController.cpp
1.65 kB
| // Copyright Epic Games, Inc. All Rights Reserved. | |
| class APawn; | |
| ACommonPlayerController::ACommonPlayerController(const FObjectInitializer& ObjectInitializer) | |
| : Super(ObjectInitializer) | |
| { | |
| } | |
| void ACommonPlayerController::ReceivedPlayer() | |
| { | |
| Super::ReceivedPlayer(); | |
| if (UCommonLocalPlayer* LocalPlayer = Cast<UCommonLocalPlayer>(Player)) | |
| { | |
| LocalPlayer->OnPlayerControllerSet.Broadcast(LocalPlayer, this); | |
| if (PlayerState) | |
| { | |
| LocalPlayer->OnPlayerStateSet.Broadcast(LocalPlayer, PlayerState); | |
| } | |
| } | |
| } | |
| void ACommonPlayerController::SetPawn(APawn* InPawn) | |
| { | |
| Super::SetPawn(InPawn); | |
| if (UCommonLocalPlayer* LocalPlayer = Cast<UCommonLocalPlayer>(Player)) | |
| { | |
| LocalPlayer->OnPlayerPawnSet.Broadcast(LocalPlayer, InPawn); | |
| } | |
| } | |
| void ACommonPlayerController::OnPossess(APawn* APawn) | |
| { | |
| Super::OnPossess(APawn); | |
| if (UCommonLocalPlayer* LocalPlayer = Cast<UCommonLocalPlayer>(Player)) | |
| { | |
| LocalPlayer->OnPlayerPawnSet.Broadcast(LocalPlayer, APawn); | |
| } | |
| } | |
| void ACommonPlayerController::OnUnPossess() | |
| { | |
| Super::OnUnPossess(); | |
| if (UCommonLocalPlayer* LocalPlayer = Cast<UCommonLocalPlayer>(Player)) | |
| { | |
| LocalPlayer->OnPlayerPawnSet.Broadcast(LocalPlayer, nullptr); | |
| } | |
| } | |
| void ACommonPlayerController::OnRep_PlayerState() | |
| { | |
| Super::OnRep_PlayerState(); | |
| if (PlayerState) | |
| { | |
| if (UCommonLocalPlayer* LocalPlayer = Cast<UCommonLocalPlayer>(Player)) | |
| { | |
| LocalPlayer->OnPlayerStateSet.Broadcast(LocalPlayer, PlayerState); | |
| } | |
| } | |
| } | |