Download LyraStarterGame/Source/LyraGame/Development/LyraBotCheats.cpp from Alexhas2/unitysamples: direct link, hf CLI and curl.
- Browser
- Download file 1.44 kB
-
https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/Development/LyraBotCheats.cpp
- Command line
-
hf download hf://datasets/Alexhas2/unitysamples/LyraStarterGame/Source/LyraGame/Development/LyraBotCheats.cpp
-
curl -L -o LyraBotCheats.cpp https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/Development/LyraBotCheats.cpp
1.44 kB
| // Copyright Epic Games, Inc. All Rights Reserved. | |
| ////////////////////////////////////////////////////////////////////// | |
| // ULyraBotCheats | |
| ULyraBotCheats::ULyraBotCheats() | |
| { | |
| if (HasAnyFlags(RF_ClassDefaultObject)) | |
| { | |
| UCheatManager::RegisterForOnCheatManagerCreated(FOnCheatManagerCreated::FDelegate::CreateLambda( | |
| [](UCheatManager* CheatManager) | |
| { | |
| CheatManager->AddCheatManagerExtension(NewObject<ThisClass>(CheatManager)); | |
| })); | |
| } | |
| } | |
| void ULyraBotCheats::AddPlayerBot() | |
| { | |
| if (ULyraBotCreationComponent* BotComponent = GetBotComponent()) | |
| { | |
| BotComponent->Cheat_AddBot(); | |
| } | |
| } | |
| void ULyraBotCheats::RemovePlayerBot() | |
| { | |
| if (ULyraBotCreationComponent* BotComponent = GetBotComponent()) | |
| { | |
| BotComponent->Cheat_RemoveBot(); | |
| } | |
| } | |
| ULyraBotCreationComponent* ULyraBotCheats::GetBotComponent() const | |
| { | |
| if (UWorld* World = GetWorld()) | |
| { | |
| if (AGameStateBase* GameState = World->GetGameState()) | |
| { | |
| return GameState->FindComponentByClass<ULyraBotCreationComponent>(); | |
| } | |
| } | |
| return nullptr; | |
| } | |