Download LyraStarterGame/Source/LyraGame/Messages/LyraVerbMessageHelpers.cpp from Alexhas2/unitysamples: direct link, hf CLI and curl.
- Browser
- Download file 2.68 kB
-
https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/Messages/LyraVerbMessageHelpers.cpp
- Command line
-
hf download hf://datasets/Alexhas2/unitysamples/LyraStarterGame/Source/LyraGame/Messages/LyraVerbMessageHelpers.cpp
-
curl -L -o LyraVerbMessageHelpers.cpp https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/Messages/LyraVerbMessageHelpers.cpp
2.68 kB
| // Copyright Epic Games, Inc. All Rights Reserved. | |
| ////////////////////////////////////////////////////////////////////// | |
| // FLyraVerbMessage | |
| FString FLyraVerbMessage::ToString() const | |
| { | |
| FString HumanReadableMessage; | |
| FLyraVerbMessage::StaticStruct()->ExportText(/*out*/ HumanReadableMessage, this, /*Defaults=*/ nullptr, /*OwnerObject=*/ nullptr, PPF_None, /*ExportRootScope=*/ nullptr); | |
| return HumanReadableMessage; | |
| } | |
| ////////////////////////////////////////////////////////////////////// | |
| // | |
| APlayerState* ULyraVerbMessageHelpers::GetPlayerStateFromObject(UObject* Object) | |
| { | |
| if (APlayerController* PC = Cast<APlayerController>(Object)) | |
| { | |
| return PC->PlayerState; | |
| } | |
| if (APlayerState* TargetPS = Cast<APlayerState>(Object)) | |
| { | |
| return TargetPS; | |
| } | |
| if (APawn* TargetPawn = Cast<APawn>(Object)) | |
| { | |
| if (APlayerState* TargetPS = TargetPawn->GetPlayerState()) | |
| { | |
| return TargetPS; | |
| } | |
| } | |
| return nullptr; | |
| } | |
| APlayerController* ULyraVerbMessageHelpers::GetPlayerControllerFromObject(UObject* Object) | |
| { | |
| if (APlayerController* PC = Cast<APlayerController>(Object)) | |
| { | |
| return PC; | |
| } | |
| if (APlayerState* TargetPS = Cast<APlayerState>(Object)) | |
| { | |
| return TargetPS->GetPlayerController(); | |
| } | |
| if (APawn* TargetPawn = Cast<APawn>(Object)) | |
| { | |
| return Cast<APlayerController>(TargetPawn->GetController()); | |
| } | |
| return nullptr; | |
| } | |
| FGameplayCueParameters ULyraVerbMessageHelpers::VerbMessageToCueParameters(const FLyraVerbMessage& Message) | |
| { | |
| FGameplayCueParameters Result; | |
| Result.OriginalTag = Message.Verb; | |
| Result.Instigator = Cast<AActor>(Message.Instigator); | |
| Result.EffectCauser = Cast<AActor>(Message.Target); | |
| Result.AggregatedSourceTags = Message.InstigatorTags; | |
| Result.AggregatedTargetTags = Message.TargetTags; | |
| //@TODO: = Message.ContextTags; | |
| Result.RawMagnitude = Message.Magnitude; | |
| return Result; | |
| } | |
| FLyraVerbMessage ULyraVerbMessageHelpers::CueParametersToVerbMessage(const FGameplayCueParameters& Params) | |
| { | |
| FLyraVerbMessage Result; | |
| Result.Verb = Params.OriginalTag; | |
| Result.Instigator = Params.Instigator.Get(); | |
| Result.Target = Params.EffectCauser.Get(); | |
| Result.InstigatorTags = Params.AggregatedSourceTags; | |
| Result.TargetTags = Params.AggregatedTargetTags; | |
| //@TODO: Result.ContextTags = ???; | |
| Result.Magnitude = Params.RawMagnitude; | |
| return Result; | |
| } | |