diff --git a/Config/DefaultGame.ini b/Config/DefaultGame.ini index 0b6c422..69e98a0 100644 --- a/Config/DefaultGame.ini +++ b/Config/DefaultGame.ini @@ -1,7 +1,10 @@ [/Script/EngineSettings.GeneralProjectSettings] ProjectID=D68B8A08410D0195272328B9EAD1AE41 +bShouldWindowPreserveAspectRatio=False +bUseBorderlessWindow=False [StartupActions] bAddPacks=True InsertPack=(PackSource="StarterContent.upack",PackName="StarterContent") + diff --git a/Content/Audio/Makai-Symphony-Dragon-Castle.uasset b/Content/Audio/Makai-Symphony-Dragon-Castle.uasset new file mode 100644 index 0000000..1851c62 Binary files /dev/null and b/Content/Audio/Makai-Symphony-Dragon-Castle.uasset differ diff --git a/Content/Audio/Makai-Symphony-Dragon-Castle_Cue.uasset b/Content/Audio/Makai-Symphony-Dragon-Castle_Cue.uasset new file mode 100644 index 0000000..3ced99f Binary files /dev/null and b/Content/Audio/Makai-Symphony-Dragon-Castle_Cue.uasset differ diff --git a/Content/BattleField/BP_BattleUI.uasset b/Content/BattleField/BP_BattleUI.uasset index 8c09052..818a0f2 100644 Binary files a/Content/BattleField/BP_BattleUI.uasset and b/Content/BattleField/BP_BattleUI.uasset differ diff --git a/Content/BattleField/Multiplayer/BP_BattleGameMode.uasset b/Content/BattleField/Multiplayer/BP_BattleGameMode.uasset index ce38b8d..c11f803 100644 Binary files a/Content/BattleField/Multiplayer/BP_BattleGameMode.uasset and b/Content/BattleField/Multiplayer/BP_BattleGameMode.uasset differ diff --git a/Content/BattleField/Multiplayer/BattleFieldMap.umap b/Content/BattleField/Multiplayer/BattleFieldMap.umap index 9d0bed5..a863b50 100644 Binary files a/Content/BattleField/Multiplayer/BattleFieldMap.umap and b/Content/BattleField/Multiplayer/BattleFieldMap.umap differ diff --git a/Content/BattleField/SinglePlayer/BP_SinglePlayerGM.uasset b/Content/BattleField/SinglePlayer/BP_SinglePlayerGM.uasset index 0a6b17d..1f37f82 100644 Binary files a/Content/BattleField/SinglePlayer/BP_SinglePlayerGM.uasset and b/Content/BattleField/SinglePlayer/BP_SinglePlayerGM.uasset differ diff --git a/Content/BattleField/SinglePlayer/OfflineBattleFieldMap.umap b/Content/BattleField/SinglePlayer/OfflineBattleFieldMap.umap index a70b900..1c9eb2a 100644 Binary files a/Content/BattleField/SinglePlayer/OfflineBattleFieldMap.umap and b/Content/BattleField/SinglePlayer/OfflineBattleFieldMap.umap differ diff --git a/Content/MainMenu/BP_SessionListEntry.uasset b/Content/MainMenu/BP_SessionListEntry.uasset index 36dc2c5..bc879b1 100644 Binary files a/Content/MainMenu/BP_SessionListEntry.uasset and b/Content/MainMenu/BP_SessionListEntry.uasset differ diff --git a/Content/MainMenu/BP_SessionListMenu.uasset b/Content/MainMenu/BP_SessionListMenu.uasset index 0f1b13f..60a0eb8 100644 Binary files a/Content/MainMenu/BP_SessionListMenu.uasset and b/Content/MainMenu/BP_SessionListMenu.uasset differ diff --git a/Content/MainMenu/MainMenuLevel.umap b/Content/MainMenu/MainMenuLevel.umap index d882ad5..3d7e721 100644 Binary files a/Content/MainMenu/MainMenuLevel.umap and b/Content/MainMenu/MainMenuLevel.umap differ diff --git a/Content/ManageSquadMenu/BP_MSMelee.uasset b/Content/ManageSquadMenu/BP_MSMelee.uasset new file mode 100644 index 0000000..2750e12 Binary files /dev/null and b/Content/ManageSquadMenu/BP_MSMelee.uasset differ diff --git a/Content/ManageSquadMenu/BP_MSWizard.uasset b/Content/ManageSquadMenu/BP_MSWizard.uasset new file mode 100644 index 0000000..8064ccb Binary files /dev/null and b/Content/ManageSquadMenu/BP_MSWizard.uasset differ diff --git a/Content/ManageSquadMenu/BP_ManageSquadGameMode.uasset b/Content/ManageSquadMenu/BP_ManageSquadGameMode.uasset new file mode 100644 index 0000000..5521ae6 Binary files /dev/null and b/Content/ManageSquadMenu/BP_ManageSquadGameMode.uasset differ diff --git a/Content/ManageSquadMenu/BP_ManageSquadGameState.uasset b/Content/ManageSquadMenu/BP_ManageSquadGameState.uasset new file mode 100644 index 0000000..6bfe6b5 Binary files /dev/null and b/Content/ManageSquadMenu/BP_ManageSquadGameState.uasset differ diff --git a/Content/ManageSquadMenu/BP_ManageSquadWidget.uasset b/Content/ManageSquadMenu/BP_ManageSquadWidget.uasset new file mode 100644 index 0000000..2fbcd2c Binary files /dev/null and b/Content/ManageSquadMenu/BP_ManageSquadWidget.uasset differ diff --git a/Content/ManageSquadMenu/ManageSquadLevel.umap b/Content/ManageSquadMenu/ManageSquadLevel.umap index fca80b0..b8a61c3 100644 Binary files a/Content/ManageSquadMenu/ManageSquadLevel.umap and b/Content/ManageSquadMenu/ManageSquadLevel.umap differ diff --git a/Content/StarterContent/Architecture/SM_AssetPlatform.uasset b/Content/StarterContent/Architecture/SM_AssetPlatform.uasset index 91af545..184b41e 100644 Binary files a/Content/StarterContent/Architecture/SM_AssetPlatform.uasset and b/Content/StarterContent/Architecture/SM_AssetPlatform.uasset differ diff --git a/Content/StarterContent/Props/SM_Stairs.uasset b/Content/StarterContent/Props/SM_Stairs.uasset index 5a868ee..bc1cadd 100644 Binary files a/Content/StarterContent/Props/SM_Stairs.uasset and b/Content/StarterContent/Props/SM_Stairs.uasset differ diff --git a/Content/Troopers/TrooperSkeletonMelee.uasset b/Content/Troopers/TrooperSkeletonMelee.uasset index 1b5a4c6..01271b7 100644 Binary files a/Content/Troopers/TrooperSkeletonMelee.uasset and b/Content/Troopers/TrooperSkeletonMelee.uasset differ diff --git a/Content/Troopers/TrooperWizard.uasset b/Content/Troopers/TrooperWizard.uasset index fee6f8c..5600e66 100644 Binary files a/Content/Troopers/TrooperWizard.uasset and b/Content/Troopers/TrooperWizard.uasset differ diff --git a/Content/Troopers/projectiles/BP_DefaultProjectile.uasset b/Content/Troopers/projectiles/BP_DefaultProjectile.uasset index 18875aa..9102bbc 100644 Binary files a/Content/Troopers/projectiles/BP_DefaultProjectile.uasset and b/Content/Troopers/projectiles/BP_DefaultProjectile.uasset differ diff --git a/Content/Troopers/projectiles/BP_Explosion.uasset b/Content/Troopers/projectiles/BP_Explosion.uasset new file mode 100644 index 0000000..cc37fc1 Binary files /dev/null and b/Content/Troopers/projectiles/BP_Explosion.uasset differ diff --git a/Content/Troopers/projectiles/BP_Fireball.uasset b/Content/Troopers/projectiles/BP_Fireball.uasset index 3a5feb6..ef19298 100644 Binary files a/Content/Troopers/projectiles/BP_Fireball.uasset and b/Content/Troopers/projectiles/BP_Fireball.uasset differ diff --git a/Content/Troopers/projectiles/BP_HealingProjectile.uasset b/Content/Troopers/projectiles/BP_HealingProjectile.uasset new file mode 100644 index 0000000..d6b8ea9 Binary files /dev/null and b/Content/Troopers/projectiles/BP_HealingProjectile.uasset differ diff --git a/Content/Troopers/projectiles/BP_MyExplosion.uasset b/Content/Troopers/projectiles/BP_MyExplosion.uasset index 06ea15c..ae43b41 100644 Binary files a/Content/Troopers/projectiles/BP_MyExplosion.uasset and b/Content/Troopers/projectiles/BP_MyExplosion.uasset differ diff --git a/Content/Troopers/projectiles/Materials/Healing_Material.uasset b/Content/Troopers/projectiles/Materials/Healing_Material.uasset new file mode 100644 index 0000000..401feea Binary files /dev/null and b/Content/Troopers/projectiles/Materials/Healing_Material.uasset differ diff --git a/Content/Troopers/projectiles/MyMyExplosion.uasset b/Content/Troopers/projectiles/MyMyExplosion.uasset deleted file mode 100644 index 52cfe7a..0000000 Binary files a/Content/Troopers/projectiles/MyMyExplosion.uasset and /dev/null differ diff --git a/Source/TurnBasedTutorial/BattleMode/BattleGameMode.cpp b/Source/TurnBasedTutorial/BattleMode/BattleGameMode.cpp index 016aff9..9133697 100644 --- a/Source/TurnBasedTutorial/BattleMode/BattleGameMode.cpp +++ b/Source/TurnBasedTutorial/BattleMode/BattleGameMode.cpp @@ -19,6 +19,7 @@ ABattleGameMode::ABattleGameMode() void ABattleGameMode::BeginPlay() { Super::BeginPlay(); + // UGameplayStatics::PlaySound2D(GetWorld(), BackgroundSound); } auto ABattleGameMode::GetMyGameState() const { @@ -34,10 +35,10 @@ void ABattleGameMode::InitializeBattleField_Implementation() { uint8 TrooperCount = 0; TArray bpPaths{ + TEXT("Blueprint'/Game/Troopers/TrooperWizard.TrooperWizard_C'"), TEXT( "Blueprint'/Game/Troopers/TrooperSkeletonMelee.TrooperSkeletonMelee_C'" - ), - TEXT("Blueprint'/Game/Troopers/TrooperWizard.TrooperWizard_C'") + ) }; // TArray LoadedBpAssets; for (int i = 0; i < bpPaths.Num(); ++i) { @@ -51,7 +52,7 @@ void ABattleGameMode::InitializeBattleField_Implementation() { FTransform SpawnLocationAndRotation(Rotation); SpawnLocationAndRotation.SetLocation(Location); AActor *Spawned = GetWorld()->SpawnActorDeferred( - LoadedBpAssets[i % 2], SpawnLocationAndRotation); + LoadedBpAssets[FirstPlayerTrooperKinds[i]], SpawnLocationAndRotation); // AActor *Spawned = GetWorld()->SpawnActorDeferred( // ATrooper::StaticClass(), SpawnLocationAndRotation); Cast(Spawned)->Initialize( @@ -68,7 +69,7 @@ void ABattleGameMode::InitializeBattleField_Implementation() { FTransform SpawnLocationAndRotation(Rotation); SpawnLocationAndRotation.SetLocation(Location); AActor *Spawned = GetWorld()->SpawnActorDeferred( - LoadedBpAssets[i % 2], SpawnLocationAndRotation); + LoadedBpAssets[SecondPlayerTrooperKinds[i]], SpawnLocationAndRotation); // AActor *Spawned = GetWorld()->SpawnActorDeferred( // ATrooper::StaticClass(), SpawnLocationAndRotation); Cast(Spawned)->Initialize( @@ -78,11 +79,6 @@ void ABattleGameMode::InitializeBattleField_Implementation() { GetMyGameState()->AddTrooper(Cast(Spawned)); Location += {0.f, 500.f, 0.0f}; } - } else { - // Cast(GetMyGameState())->GetEnemyAIController()-> - // SetTrooperAssetsAndSpawn( - // LoadedBpAssets, - // TrooperCount); } } @@ -137,8 +133,19 @@ void ABattleGameMode::PostLogin(APlayerController *NewPlayer) { // 0-indexation Cast(NewPlayer)->SetPlayerIndex( CurrentNumberOfPlayers - 1); + Cast(NewPlayer)-> + StartPlayingMusic(BackgroundSound); + + if (CurrentNumberOfPlayers == 1) + { + FirstPlayerTrooperKinds = Cast(NewPlayer)->TrooperKinds; + } else if (CurrentNumberOfPlayers == 2) + { + SecondPlayerTrooperKinds = Cast(NewPlayer)->TrooperKinds; + } + UE_LOG(LogTemp, Warning, TEXT("%d"), CurrentNumberOfPlayers); - if (CurrentNumberOfPlayers == 2) { + if (!bIsMultiplayer || CurrentNumberOfPlayers == 2) { UE_LOG(LogTemp, Warning, TEXT("Game Start")); // start the game // dynamic_cast( diff --git a/Source/TurnBasedTutorial/BattleMode/BattleGameMode.h b/Source/TurnBasedTutorial/BattleMode/BattleGameMode.h index c411706..2005a77 100644 --- a/Source/TurnBasedTutorial/BattleMode/BattleGameMode.h +++ b/Source/TurnBasedTutorial/BattleMode/BattleGameMode.h @@ -27,12 +27,21 @@ public: // void CycleTurns(); protected: + UPROPERTY(BlueprintReadWrite, EditAnywhere) + USoundBase *BackgroundSound; + UPROPERTY() TArray LoadedBpAssets; UPROPERTY() bool bIsMultiplayer = true; + UPROPERTY() + TArray FirstPlayerTrooperKinds; + + UPROPERTY() + TArray SecondPlayerTrooperKinds; + void InitializeSpawnPointsIfNeeded(AController *Player); UFUNCTION(Server, Reliable) diff --git a/Source/TurnBasedTutorial/BattleMode/BattlePlayerController.cpp b/Source/TurnBasedTutorial/BattleMode/BattlePlayerController.cpp index aa67c9f..49c9aa4 100644 --- a/Source/TurnBasedTutorial/BattleMode/BattlePlayerController.cpp +++ b/Source/TurnBasedTutorial/BattleMode/BattlePlayerController.cpp @@ -7,19 +7,27 @@ #include "BattlePlayerState.h" #include "Blueprint/UserWidget.h" #include "Net/UnrealNetwork.h" +#include "TurnBasedTutorial/ManageSquad/SelectedTrooperSaveGame.h" ABattlePlayerController::ABattlePlayerController() : Super()/*, bIsMyTurn(false), SelectedTrooper(nullptr)*/ { UE_LOG(LogTemp, Warning, TEXT("Player controller created")); SetShowMouseCursor(true); PlayerIndex = 0; + + if (UGameplayStatics::DoesSaveGameExist("Selected troopers", 0)) { + const USelectedTrooperSaveGame *SaveGameInstance = Cast< + USelectedTrooperSaveGame>( + UGameplayStatics::LoadGameFromSlot(TEXT("Selected troopers"), 0)); + TrooperKinds = SaveGameInstance->SelectedTroopers; + } else { + TrooperKinds = {0, 0, 0, 0, 0}; + } } void ABattlePlayerController::BeginPlay() { Super::BeginPlay(); - UUserWidget *CreatedWidget = CreateWidget( - GetWorld(), WidgetClass); - CreatedWidget->AddToViewport(); + CreateBattleWidget(); } void ABattlePlayerController::SetupInputComponent() { @@ -64,8 +72,9 @@ void ABattlePlayerController::EndTurn_Implementation() { // GetMyGameState()->CycleTurns(); // } // GetMyPlayerState()->CycleTurns(); - if (GetMyGameState()->IsInTurn(PlayerIndex)) + if (GetMyGameState()->IsInTurn(PlayerIndex)) { GetMyGameState()->CycleTurns(); + } } // void AMyPlayerController::EndTurn_Implementation() { @@ -147,6 +156,25 @@ uint8 ABattlePlayerController::GetPlayerIndex() const { return PlayerIndex; } +void ABattlePlayerController::CreateBattleWidget_Implementation() { + BattleWidget = CreateWidget( + GetWorld(), WidgetClass); + BattleWidget->AddToViewport(); + // GetPlayerState()->SetBattleWidget(BattleWidget); + +} + +void ABattlePlayerController::SetWidgetTurn_Implementation(bool bIsMyTurn) { + if (BattleWidget) { + BattleWidget->SetWhoseTurnText(bIsMyTurn); + } +} + +void ABattlePlayerController::StartPlayingMusic_Implementation( + USoundBase *BackgroundSound) const { + UGameplayStatics::PlaySound2D(GetWorld(), BackgroundSound, 0.25f); +} + // float AMyPlayerController::SetCurrentActionAndReturnRadius(int action) { // return GetMyPlayerState()->SetCurrentActionAndReturnRadius(action); // diff --git a/Source/TurnBasedTutorial/BattleMode/BattlePlayerController.h b/Source/TurnBasedTutorial/BattleMode/BattlePlayerController.h index c5e090d..12da459 100644 --- a/Source/TurnBasedTutorial/BattleMode/BattlePlayerController.h +++ b/Source/TurnBasedTutorial/BattleMode/BattlePlayerController.h @@ -2,6 +2,7 @@ #pragma once #include "CoreMinimal.h" +#include "BattleUI.h" #include "GameFramework/PlayerController.h" #include "BattlePlayerController.generated.h" @@ -50,7 +51,22 @@ public: // UFUNCTION(Client, Reliable) // void SetEnemySelection(const TArray &Troopers) const; + UFUNCTION(Client, Reliable) + void StartPlayingMusic(USoundBase *BackgroundSound) const; + + UFUNCTION(Client, Reliable) + void SetWidgetTurn(bool bIsMyTurn); + + UPROPERTY() + TArray TrooperKinds; + private: + UFUNCTION(Client, Reliable) + void CreateBattleWidget(); + + UPROPERTY() + UBattleUI *BattleWidget; + UPROPERTY(EditAnywhere) TSubclassOf WidgetClass; diff --git a/Source/TurnBasedTutorial/BattleMode/BattlePlayerState.cpp b/Source/TurnBasedTutorial/BattleMode/BattlePlayerState.cpp index 6c0928c..d5e459f 100644 --- a/Source/TurnBasedTutorial/BattleMode/BattlePlayerState.cpp +++ b/Source/TurnBasedTutorial/BattleMode/BattlePlayerState.cpp @@ -39,6 +39,11 @@ void ABattlePlayerState::SetPlayerIndex(uint8 NewPlayerIndex) { PlayerIndex = NewPlayerIndex; } +// void ABattlePlayerState:: +// SetBattleWidget_Implementation(UBattleUI *BattleWidget) { +// BattleUI = BattleWidget; +// } + void ABattlePlayerState::GameOver_Implementation(int PlayerLoseIndex) { UGameOverWidget *CreatedWidget = CreateWidget( GetWorld(), GameOverWidgetClass); @@ -61,7 +66,7 @@ void ABattlePlayerState::SetEnemySelection_Implementation( } void ABattlePlayerState::MoveTrooper_Implementation(ATrooper *Trooper, - FVector Location) { + FVector Location) { Location.Z = 0.0f; if (Trooper->CheckMoveCorrectness(Location)) { Trooper->MoveTrooper(Location); @@ -87,8 +92,8 @@ void ABattlePlayerState::MoveTrooper_Implementation(ATrooper *Trooper, // } void ABattlePlayerState::Attack_Implementation(ATrooper *Attacker, - FVector Location, - int ActionIndex) { + FVector Location, + int ActionIndex) { if (Attacker->CheckAttackCorrectness(Location, ActionIndex)) { Attacker->Attack(ActionIndex, Location); // for (const auto Trooper : Troopers) { @@ -116,12 +121,14 @@ bool ABattlePlayerState::IsMyTurn() const { void ABattlePlayerState::SetMyTurn(bool bMyTurn) { bIsMyTurn = bMyTurn; - if (bIsMyTurn) { - GEngine->AddOnScreenDebugMessage(-1, 3.0f, FColor::Green, - FString::Printf( - TEXT("CURRENT TURN: %d"), - PlayerIndex)); - } + Cast(GetWorld()->GetFirstPlayerController())-> + SetWidgetTurn(bIsMyTurn); + // if (bIsMyTurn) { + // GEngine->AddOnScreenDebugMessage(-1, 3.0f, FColor::Green, + // FString::Printf( + // TEXT("CURRENT TURN: %d"), + // PlayerIndex)); + // } } void ABattlePlayerState::StartTurn_Implementation() { @@ -139,6 +146,7 @@ void ABattlePlayerState::EndTurn_Implementation() { SelectedTrooper = nullptr; } UE_LOG(LogTemp, Warning, TEXT("Not your turn, %d"), PlayerIndex); + // AMyGameMode *gameMode = GetMyGameMode(); // gameMode->CycleTurns(); // Cast(GetWorld()->GetGameState())->CycleTurns(); @@ -156,8 +164,9 @@ void ABattlePlayerState::OnPlayerAction(const FHitResult &HitResult) { return; } - if (NewlySelectedTrooper == nullptr || !NewlySelectedTrooper-> - IsValidLowLevel() || NewlySelectedTrooper->GetPlayerIndex() != + if (HitResult.GetActor()->ActorHasTag(FName("Floor")) || + NewlySelectedTrooper != nullptr && + NewlySelectedTrooper->GetPlayerIndex() != PlayerIndex) { if (SelectedTrooper != nullptr && SelectedTrooper-> IsValidLowLevel()) { diff --git a/Source/TurnBasedTutorial/BattleMode/BattlePlayerState.h b/Source/TurnBasedTutorial/BattleMode/BattlePlayerState.h index a68163b..b325b16 100644 --- a/Source/TurnBasedTutorial/BattleMode/BattlePlayerState.h +++ b/Source/TurnBasedTutorial/BattleMode/BattlePlayerState.h @@ -4,6 +4,7 @@ #include "Trooper/Trooper.h" #include "CoreMinimal.h" +#include "BattlePlayerController.h" #include "GameFramework/PlayerState.h" #include "BattlePlayerState.generated.h" @@ -58,8 +59,14 @@ public: UFUNCTION(Client, Reliable) void GameOver(int PlayerLoseIndex); + + // UFUNCTION(Client, Reliable) + // void SetBattleWidget(UBattleUI *BattleWidget); protected: + // UPROPERTY() + // UBattleUI *BattleUI; + UPROPERTY(EditAnywhere, BlueprintReadWrite) TSubclassOf GameOverWidgetClass; diff --git a/Source/TurnBasedTutorial/BattleMode/BattleUI.cpp b/Source/TurnBasedTutorial/BattleMode/BattleUI.cpp new file mode 100644 index 0000000..b8ca44b --- /dev/null +++ b/Source/TurnBasedTutorial/BattleMode/BattleUI.cpp @@ -0,0 +1,63 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#include "BattleUI.h" +#include "Components/Button.h" +#include "Components/TextBlock.h" +#include "BattlePlayerController.h" +#include "BattlePlayerState.h" + + +void UBattleUI::NativeConstruct() { + Super::NativeConstruct(); + EndTurnButton->OnClicked.AddDynamic(this, &ThisClass::OnEndTurnClicked); + ButtonAction_0->OnClicked.AddDynamic(this, &ThisClass::OnActionSwitched_0); + ButtonAction_1->OnClicked.AddDynamic(this, &ThisClass::OnActionSwitched_1); + ButtonAction_2->OnClicked.AddDynamic(this, &ThisClass::OnActionSwitched_2); +} + +void UBattleUI::SetWidgetText_Implementation(const FString &Text) { + InformationText->SetText(FText::FromString(Text)); +} + +void UBattleUI::SetWhoseTurnText_Implementation(bool IsThisPlayerTurn) { + if (IsThisPlayerTurn) { + SetWidgetText(TEXT("Your turn!")); + } else { + SetWidgetText(TEXT("Opponent's turn")); + } +} + +void UBattleUI::OnEndTurnClicked() { + Cast(GetWorld()->GetFirstPlayerController())-> + EndTurn(); +} + +void UBattleUI::OnActionSwitched_0() { + ButtonAction_0->SetIsEnabled(false); + ButtonAction_1->SetIsEnabled(true); + ButtonAction_2->SetIsEnabled(true); + ActionType = 0; + OnActionSwitched(); +} + +void UBattleUI::OnActionSwitched_1() { + ButtonAction_0->SetIsEnabled(true); + ButtonAction_1->SetIsEnabled(false); + ButtonAction_2->SetIsEnabled(true); + ActionType = 1; + OnActionSwitched(); +} + +void UBattleUI::OnActionSwitched_2() { + ButtonAction_0->SetIsEnabled(true); + ButtonAction_1->SetIsEnabled(true); + ButtonAction_2->SetIsEnabled(false); + ActionType = 2; + OnActionSwitched(); +} + +void UBattleUI::OnActionSwitched() const { + Cast(GetWorld()->GetFirstPlayerController())-> + GetPlayerState()->SetCurrentAction(ActionType); +} + diff --git a/Source/TurnBasedTutorial/BattleMode/BattleUI.h b/Source/TurnBasedTutorial/BattleMode/BattleUI.h new file mode 100644 index 0000000..4015b91 --- /dev/null +++ b/Source/TurnBasedTutorial/BattleMode/BattleUI.h @@ -0,0 +1,58 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Blueprint/UserWidget.h" +#include "BattleUI.generated.h" + +/** + * + */ +UCLASS() +class TURNBASEDTUTORIAL_API UBattleUI : public UUserWidget { + GENERATED_BODY() + +public: + virtual void NativeConstruct() override; + + UFUNCTION(Client, Reliable) + void SetWhoseTurnText(bool IsThisPlayerTurn); + + UFUNCTION(Client, Reliable) + void SetWidgetText(const FString &Text); + +protected: + int ActionType = 0; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidget)) + class UButton *EndTurnButton; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidget)) + class UButton *ButtonAction_0; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidget)) + class UButton *ButtonAction_1; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidget)) + class UButton *ButtonAction_2; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidget)) + class UTextBlock *InformationText; + + UFUNCTION() + void OnEndTurnClicked(); + + UFUNCTION() + void OnActionSwitched_0(); + + UFUNCTION() + void OnActionSwitched_1(); + + UFUNCTION() + void OnActionSwitched_2(); + + UFUNCTION() + void OnActionSwitched() const; + +}; diff --git a/Source/TurnBasedTutorial/BattleMode/Singleplayer/SinglePlayerGM.cpp b/Source/TurnBasedTutorial/BattleMode/Singleplayer/SinglePlayerGM.cpp index 64d327a..d52ab0a 100644 --- a/Source/TurnBasedTutorial/BattleMode/Singleplayer/SinglePlayerGM.cpp +++ b/Source/TurnBasedTutorial/BattleMode/Singleplayer/SinglePlayerGM.cpp @@ -2,6 +2,7 @@ #include "SinglePlayerGM.h" #include "SinglePlayerGS.h" +#include "TurnBasedTutorial/BattleMode/BattlePlayerController.h" ASinglePlayerGM::ASinglePlayerGM() : Super() { @@ -12,10 +13,12 @@ ASinglePlayerGM::ASinglePlayerGM() void ASinglePlayerGM::BeginPlay() { Super::BeginPlay(); UE_LOG(LogTemp, Warning, TEXT("SinglePlayer GameMode BeginPlay")); - GameStateClass = ASinglePlayerGS::StaticClass(); - StartGame(); + // GameStateClass = ASinglePlayerGS::StaticClass(); + // StartGame(); } -void ASinglePlayerGM::PostLogin(APlayerController *NewPlayer) { - AGameMode::PostLogin(NewPlayer); -} +// void ASinglePlayerGM::PostLogin(APlayerController *NewPlayer) { +// AGameMode::PostLogin(NewPlayer); +// Cast(NewPlayer)-> +// StartPlayingMusic(BackgroundSound); +// } diff --git a/Source/TurnBasedTutorial/BattleMode/Singleplayer/SinglePlayerGM.h b/Source/TurnBasedTutorial/BattleMode/Singleplayer/SinglePlayerGM.h index 08d73ab..9d12fa9 100644 --- a/Source/TurnBasedTutorial/BattleMode/Singleplayer/SinglePlayerGM.h +++ b/Source/TurnBasedTutorial/BattleMode/Singleplayer/SinglePlayerGM.h @@ -18,5 +18,5 @@ public: virtual void BeginPlay() override; - virtual void PostLogin(APlayerController *NewPlayer) override; + // virtual void PostLogin(APlayerController *NewPlayer) override; }; diff --git a/Source/TurnBasedTutorial/BattleMode/Trooper/Projectile.cpp b/Source/TurnBasedTutorial/BattleMode/Trooper/Projectile.cpp index f05d525..d7de913 100644 --- a/Source/TurnBasedTutorial/BattleMode/Trooper/Projectile.cpp +++ b/Source/TurnBasedTutorial/BattleMode/Trooper/Projectile.cpp @@ -42,8 +42,8 @@ AProjectile::AProjectile() { } void AProjectile::Initialize(const UAbility *Ability, - uint8 playerIndex, - float PathLength) { + uint8 playerIndex, + float PathLength) { ProjectileMovementComponent->InitialSpeed = ProjectileMovementComponent->MaxSpeed = Ability->Speed; Damage = Ability->Damage; @@ -69,9 +69,16 @@ void AProjectile::NotifyActorBeginOverlap(AActor *OtherActor) { ), OtherTrooper->GetId(), OtherTrooper->GetPlayerIndex(), Damage, PlayerIndex); - if (PlayerIndex != -1 && PlayerIndex != OtherTrooper-> - GetPlayerIndex()) { - OtherTrooper->TrooperTakeDamage(Damage); + if (Damage > 0) { + if (PlayerIndex != -1 && PlayerIndex != OtherTrooper-> + GetPlayerIndex()) { + OtherTrooper->TrooperTakeDamage(Damage); + } + } else { + if (PlayerIndex != -1 && PlayerIndex == OtherTrooper-> + GetPlayerIndex()) { + OtherTrooper->TrooperTakeDamage(Damage); + } } } else { UE_LOG(LogTemp, Warning, TEXT("Overlapped not a trooper")); diff --git a/Source/TurnBasedTutorial/BattleMode/Trooper/Trooper.cpp b/Source/TurnBasedTutorial/BattleMode/Trooper/Trooper.cpp index d0f1809..221a26e 100644 --- a/Source/TurnBasedTutorial/BattleMode/Trooper/Trooper.cpp +++ b/Source/TurnBasedTutorial/BattleMode/Trooper/Trooper.cpp @@ -308,15 +308,20 @@ void ATrooper::TrooperTakeDamage_Implementation(float Damage) { if (bIsTakingDamage || bIsDead) { return; } - HitPoints = FMath::Max(0, HitPoints - Damage); - if (HitPoints == 0) { - bIsDead = true; - SetLifeSpan(DyingAnimationDuration); - GetWorld()->GetGameState()->DecreaseLivingTroopers( - PlayerIndex); + if (Damage > 0) { + HitPoints = FMath::Max(0, HitPoints - Damage); + if (HitPoints == 0) { + bIsDead = true; + SetLifeSpan(DyingAnimationDuration); + GetWorld()->GetGameState()-> + DecreaseLivingTroopers( + PlayerIndex); + } else { + // bIsTakingDamage = true; + SetIsTakingDamage(true); + } } else { - // bIsTakingDamage = true; - SetIsTakingDamage(true); + HitPoints = FMath::Min(StartHitPoints, HitPoints - Damage); } } diff --git a/Source/TurnBasedTutorial/MainMenu/MainMenuWidget.cpp b/Source/TurnBasedTutorial/MainMenu/MainMenuWidget.cpp index 0baf22f..22fb0dc 100644 --- a/Source/TurnBasedTutorial/MainMenu/MainMenuWidget.cpp +++ b/Source/TurnBasedTutorial/MainMenu/MainMenuWidget.cpp @@ -12,18 +12,19 @@ void UMainMenuWidget::NativeConstruct() { this, &ThisClass::UMainMenuWidget::OnHostOnlineGameButtonClicked); GetMyGameSubsystem()->OnCreateSessionCompleteEvent.AddDynamic( - this, &ThisClass::StartSessionWhenCreatingSessonComplete); + this, &ThisClass::StartSessionWhenCreatingSessionComplete); } void UMainMenuWidget::OnHostOnlineGameButtonClicked() { // Ensure we have left any session GetMyGameSubsystem()->DestroySession(); - - GetMyGameSubsystem()->CreateSession( - "Lobby " + FString::FromInt(FMath::RandRange(1, 1e6)), 2, true); + + const FString SessionName = "Lobby " + FString::FromInt( + FMath::RandRange(1, 1e6)); + GetMyGameSubsystem()->CreateSession(SessionName, 2, true); } -void UMainMenuWidget::StartSessionWhenCreatingSessonComplete(bool bSuccess) { +void UMainMenuWidget::StartSessionWhenCreatingSessionComplete(bool bSuccess) { if (!bSuccess) { return; } diff --git a/Source/TurnBasedTutorial/MainMenu/MainMenuWidget.h b/Source/TurnBasedTutorial/MainMenu/MainMenuWidget.h index 992d040..e3b81d6 100644 --- a/Source/TurnBasedTutorial/MainMenu/MainMenuWidget.h +++ b/Source/TurnBasedTutorial/MainMenu/MainMenuWidget.h @@ -26,7 +26,7 @@ protected: void OnHostOnlineGameButtonClicked(); UFUNCTION() - void StartSessionWhenCreatingSessonComplete(bool bSuccess); + void StartSessionWhenCreatingSessionComplete(bool bSuccess); private: USessionsGameInstanceSubsystem *GetMyGameSubsystem() const; diff --git a/Source/TurnBasedTutorial/MainMenu/SessionListEntryWidget.cpp b/Source/TurnBasedTutorial/MainMenu/SessionListEntryWidget.cpp index 849328b..b136433 100644 --- a/Source/TurnBasedTutorial/MainMenu/SessionListEntryWidget.cpp +++ b/Source/TurnBasedTutorial/MainMenu/SessionListEntryWidget.cpp @@ -4,10 +4,18 @@ #include "SessionListEntryWidget.h" #include "OnlineSessionSettings.h" #include "Components/TextBlock.h" +#include "Components/Button.h" +#include "Kismet/GameplayStatics.h" + +void USessionListEntryWidget::NativeConstruct() { + Super::NativeConstruct(); + JoinSessionButton->OnClicked.AddDynamic( + this, &ThisClass::OnJoinButton); +} void USessionListEntryWidget::Update(int SessionIndex, - const FOnlineSessionSearchResult & - Session) { + const FOnlineSessionSearchResult & + Session) { SessionId = SessionIndex; IndexText->SetText(FText::AsNumber(SessionIndex + 1)); @@ -22,3 +30,16 @@ void USessionListEntryWidget::Update(int SessionIndex, PlayersCountText->SetText(FText::AsNumber(CurPlayerCount)); PingText->SetText(FText::AsNumber(Session.PingInMs)); } + +void USessionListEntryWidget::OnJoinButton() { + GetMyGameSubsystem()->JoinSession(SessionId); +} + +USessionsGameInstanceSubsystem * +USessionListEntryWidget::GetMyGameSubsystem() const { + const UGameInstance *GameInstance = UGameplayStatics::GetGameInstance( + GetWorld()); + USessionsGameInstanceSubsystem *GameInstanceSubsystem = GameInstance-> + GetSubsystem(); + return GameInstanceSubsystem; +} diff --git a/Source/TurnBasedTutorial/MainMenu/SessionListEntryWidget.h b/Source/TurnBasedTutorial/MainMenu/SessionListEntryWidget.h index 8c74028..0b3686f 100644 --- a/Source/TurnBasedTutorial/MainMenu/SessionListEntryWidget.h +++ b/Source/TurnBasedTutorial/MainMenu/SessionListEntryWidget.h @@ -3,6 +3,7 @@ #pragma once #include "CoreMinimal.h" +#include "../SessionsGameInstanceSubsystem.h" #include "Blueprint/UserWidget.h" #include "SessionListEntryWidget.generated.h" @@ -14,6 +15,8 @@ class TURNBASEDTUTORIAL_API USessionListEntryWidget : public UUserWidget { GENERATED_BODY() public: + virtual void NativeConstruct() override; + UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidget)) class UTextBlock *IndexText; @@ -26,8 +29,18 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidget)) class UTextBlock *PingText; + UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidget)) + class UButton *JoinSessionButton; + void Update(int SessionIndex, const FOnlineSessionSearchResult &Session); + +protected: int SessionId; FString SessionName; + + USessionsGameInstanceSubsystem *GetMyGameSubsystem() const; + + UFUNCTION() + void OnJoinButton(); }; diff --git a/Source/TurnBasedTutorial/MainMenu/SessionListWidget.cpp b/Source/TurnBasedTutorial/MainMenu/SessionListWidget.cpp index af32814..e4bd9e9 100644 --- a/Source/TurnBasedTutorial/MainMenu/SessionListWidget.cpp +++ b/Source/TurnBasedTutorial/MainMenu/SessionListWidget.cpp @@ -13,8 +13,8 @@ void USessionListWidget::NativeConstruct() { RefreshListButton->OnClicked.AddDynamic( this, &ThisClass::OnRefreshListButtonClicked); - ConnectToSelectedSessionButton->OnClicked.AddDynamic( - this, &ThisClass::ConnectToFirstSession); + // ConnectToSelectedSessionButton->OnClicked.AddDynamic( + // this, &ThisClass::ConnectToFirstSession); const auto MyGameInstanceSubsystem = GetMyGameSubsystem(); MyGameInstanceSubsystem->OnFindSessionsCompleteEvent.AddUObject( @@ -54,9 +54,9 @@ void USessionListWidget::OnRefreshListButtonClicked() { GetMyGameSubsystem()->FindSessions(10, true); } -void USessionListWidget::ConnectToFirstSession() { - GetMyGameSubsystem()->JoinSession(0); -} +// void USessionListWidget::ConnectToFirstSession() { + // GetMyGameSubsystem()->JoinSession(0); +// } void USessionListWidget::OnJoinSessionSuccess( diff --git a/Source/TurnBasedTutorial/MainMenu/SessionListWidget.h b/Source/TurnBasedTutorial/MainMenu/SessionListWidget.h index e0b43ef..f9cdf4e 100644 --- a/Source/TurnBasedTutorial/MainMenu/SessionListWidget.h +++ b/Source/TurnBasedTutorial/MainMenu/SessionListWidget.h @@ -17,8 +17,8 @@ class TURNBASEDTUTORIAL_API USessionListWidget : public UUserWidget { protected: virtual void NativeConstruct() override; - UPROPERTY(meta = (BindWidget)) - class UButton *ConnectToSelectedSessionButton; + // UPROPERTY(meta = (BindWidget)) + // class UButton *ConnectToSelectedSessionButton; UPROPERTY(meta = (BindWidget)) class UButton *GoBackToMainMenuButton; @@ -43,6 +43,6 @@ private: UFUNCTION() void OnRefreshListButtonClicked(); - UFUNCTION() - void ConnectToFirstSession(); + // UFUNCTION() + // void ConnectToFirstSession(); }; diff --git a/Source/TurnBasedTutorial/ManageSquad/ManageSquadGameState.cpp b/Source/TurnBasedTutorial/ManageSquad/ManageSquadGameState.cpp index da48053..8d20f22 100644 --- a/Source/TurnBasedTutorial/ManageSquad/ManageSquadGameState.cpp +++ b/Source/TurnBasedTutorial/ManageSquad/ManageSquadGameState.cpp @@ -2,10 +2,48 @@ #include "ManageSquadGameState.h" -AManageSquadGameState::AManageSquadGameState() { - TroopersKinds = {0, 0, 0, 0, 0}; +#include "ManageSquadTrooper.h" +#include "SelectedTrooperSaveGame.h" +#include "Kismet/GameplayStatics.h" + +void AManageSquadGameState::BeginPlay() { + // USelectedTrooperSaveGame *SaveGameInstance = Cast( + // UGameplayStatics::CreateSaveGameObject( + // USelectedTrooperSaveGame::StaticClass())); + if (UGameplayStatics::DoesSaveGameExist("Selected troopers", 0)) { + const USelectedTrooperSaveGame *SaveGameInstance = Cast< + USelectedTrooperSaveGame>( + UGameplayStatics::LoadGameFromSlot(TEXT("Selected troopers"), 0)); + TroopersKinds = SaveGameInstance->SelectedTroopers; + } else { + TroopersKinds = {0, 0, 0, 0, 0}; + } + InitializeTroopers(); } void AManageSquadGameState::ChangeSquad(int TrooperIndex, int TrooperKind) { TroopersKinds[TrooperIndex] = TrooperKind; } + +TArray AManageSquadGameState::GetSquad() const { + return TroopersKinds; +} + +void AManageSquadGameState::InitializeTroopers() const { + FVector Location(-1150.0f, -2850.0f, 3000.0f); + const FRotator Rotation(0.0f, 90.0f, 0.0f); + for (int index = 0; index < 5; ++index) { + constexpr float DeltaX = 500.0f; + FTransform SpawnLocationAndRotation(Rotation); + SpawnLocationAndRotation.SetLocation(Location); + if (TroopersBpAssets.Num() > TroopersKinds[index]) { + AActor *Spawned = GetWorld()->SpawnActorDeferred( + TroopersBpAssets[TroopersKinds[index]], SpawnLocationAndRotation); + Cast(Spawned)->Initialize(index); + Spawned->SetActorRelativeScale3D({1.5f, 1.5f, 1.5f}); + Spawned->FinishSpawning(SpawnLocationAndRotation); + Spawned->SetActorLocation(Location); + } + Location += {DeltaX, 0.f, 0.0f}; + } +} diff --git a/Source/TurnBasedTutorial/ManageSquad/ManageSquadGameState.h b/Source/TurnBasedTutorial/ManageSquad/ManageSquadGameState.h index 1198780..ede79cc 100644 --- a/Source/TurnBasedTutorial/ManageSquad/ManageSquadGameState.h +++ b/Source/TurnBasedTutorial/ManageSquad/ManageSquadGameState.h @@ -14,12 +14,21 @@ class TURNBASEDTUTORIAL_API AManageSquadGameState : public AGameState { GENERATED_BODY() public: - AManageSquadGameState(); + virtual void BeginPlay() override; UFUNCTION() void ChangeSquad(int TrooperIndex, int TrooperKind); -private: + UFUNCTION() + TArray GetSquad() const; + +protected: + UPROPERTY(EditAnywhere, BlueprintReadWrite) + TArray TroopersBpAssets; + + UFUNCTION() + void InitializeTroopers() const; + UPROPERTY() - TArray TroopersKinds; + TArray TroopersKinds; }; diff --git a/Source/TurnBasedTutorial/ManageSquad/ManageSquadPlayerController.cpp b/Source/TurnBasedTutorial/ManageSquad/ManageSquadPlayerController.cpp index 72d4c77..1fada52 100644 --- a/Source/TurnBasedTutorial/ManageSquad/ManageSquadPlayerController.cpp +++ b/Source/TurnBasedTutorial/ManageSquad/ManageSquadPlayerController.cpp @@ -3,6 +3,7 @@ #include "ManageSquadPlayerController.h" #include "ManageSquadGameState.h" +#include "ManageSquadWidget.h" AManageSquadPlayerController::AManageSquadPlayerController() { SetShowMouseCursor(true); @@ -14,6 +15,19 @@ void AManageSquadPlayerController::SetupInputComponent() { &AManageSquadPlayerController::OnLeftMouseClick); } +void AManageSquadPlayerController::BeginPlay() { + Super::BeginPlay(); + const TSoftClassPtr WidgetClass = TSoftClassPtr< + UUserWidget>(FSoftObjectPath( + "WidgetBlueprint'/Game/ManageSquadMenu/BP_ManageSquadWidget.BP_ManageSquadWidget_C'" + )); + UUserWidget *CreatedWidget = CreateWidget( + GetWorld(), WidgetClass.LoadSynchronous()); + if (CreatedWidget) { + CreatedWidget->AddToViewport(); + } +} + void AManageSquadPlayerController::OnLeftMouseClick() { UE_LOG(LogTemp, Warning, TEXT("Mouse clicked")); FHitResult HitResult; diff --git a/Source/TurnBasedTutorial/ManageSquad/ManageSquadPlayerController.h b/Source/TurnBasedTutorial/ManageSquad/ManageSquadPlayerController.h index 12749f0..0c5e104 100644 --- a/Source/TurnBasedTutorial/ManageSquad/ManageSquadPlayerController.h +++ b/Source/TurnBasedTutorial/ManageSquad/ManageSquadPlayerController.h @@ -20,6 +20,8 @@ public: virtual void SetupInputComponent() override; + virtual void BeginPlay() override; + private: UPROPERTY() AManageSquadTrooper *SelectedTrooper; diff --git a/Source/TurnBasedTutorial/ManageSquad/ManageSquadTrooper.cpp b/Source/TurnBasedTutorial/ManageSquad/ManageSquadTrooper.cpp index 3e140f4..40bf7fe 100644 --- a/Source/TurnBasedTutorial/ManageSquad/ManageSquadTrooper.cpp +++ b/Source/TurnBasedTutorial/ManageSquad/ManageSquadTrooper.cpp @@ -29,3 +29,8 @@ ETrooperType AManageSquadTrooper::GetType() const { int AManageSquadTrooper::GetIndex() const { return Index; } + +void AManageSquadTrooper::Initialize(int TrooperIndex) { + Index = TrooperIndex; + Type = ETrooperType::TROOPER_IN_SQUAD; +} diff --git a/Source/TurnBasedTutorial/ManageSquad/ManageSquadTrooper.h b/Source/TurnBasedTutorial/ManageSquad/ManageSquadTrooper.h index 2da243b..783da94 100644 --- a/Source/TurnBasedTutorial/ManageSquad/ManageSquadTrooper.h +++ b/Source/TurnBasedTutorial/ManageSquad/ManageSquadTrooper.h @@ -40,4 +40,7 @@ public: UFUNCTION() int GetIndex() const; + + UFUNCTION() + void Initialize(int TrooperIndex); }; diff --git a/Source/TurnBasedTutorial/ManageSquad/ManageSquadWidget.cpp b/Source/TurnBasedTutorial/ManageSquad/ManageSquadWidget.cpp new file mode 100644 index 0000000..724860d --- /dev/null +++ b/Source/TurnBasedTutorial/ManageSquad/ManageSquadWidget.cpp @@ -0,0 +1,27 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#include "ManageSquadWidget.h" + +#include "ManageSquadGameState.h" +#include "SelectedTrooperSaveGame.h" +#include "Components/Button.h" +#include "Kismet/GameplayStatics.h" + + +void UManageSquadWidget::NativeConstruct() { + Super::NativeConstruct(); + BackButton->OnClicked.AddDynamic( + this, &ThisClass::UManageSquadWidget::OnBackButtonClicked); +} + +void UManageSquadWidget::OnBackButtonClicked() { + USelectedTrooperSaveGame *SaveGameInstance = Cast( + UGameplayStatics::CreateSaveGameObject( + USelectedTrooperSaveGame::StaticClass())); + SaveGameInstance->SelectedTroopers = GetWorld()->GetGameState< + AManageSquadGameState>()->GetSquad(); + UGameplayStatics::SaveGameToSlot( + SaveGameInstance,TEXT("Selected troopers"), 0); + UGameplayStatics::OpenLevel(GetWorld(), "MainMenuLevel"); + RemoveFromParent(); +} diff --git a/Source/TurnBasedTutorial/ManageSquad/ManageSquadWidget.h b/Source/TurnBasedTutorial/ManageSquad/ManageSquadWidget.h new file mode 100644 index 0000000..6fb284c --- /dev/null +++ b/Source/TurnBasedTutorial/ManageSquad/ManageSquadWidget.h @@ -0,0 +1,25 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Blueprint/UserWidget.h" +#include "ManageSquadWidget.generated.h" + +/** + * + */ +UCLASS() +class TURNBASEDTUTORIAL_API UManageSquadWidget : public UUserWidget { + GENERATED_BODY() + +public: + virtual void NativeConstruct() override; + +protected: + UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidget)) + class UButton *BackButton; + + UFUNCTION() + void OnBackButtonClicked(); +}; diff --git a/Source/TurnBasedTutorial/ManageSquad/SelectedTrooperSaveGame.cpp b/Source/TurnBasedTutorial/ManageSquad/SelectedTrooperSaveGame.cpp new file mode 100644 index 0000000..0d483c6 --- /dev/null +++ b/Source/TurnBasedTutorial/ManageSquad/SelectedTrooperSaveGame.cpp @@ -0,0 +1,8 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "SelectedTrooperSaveGame.h" + +USelectedTrooperSaveGame::USelectedTrooperSaveGame() + : Super() { +} diff --git a/Source/TurnBasedTutorial/ManageSquad/SelectedTrooperSaveGame.h b/Source/TurnBasedTutorial/ManageSquad/SelectedTrooperSaveGame.h new file mode 100644 index 0000000..1f533e9 --- /dev/null +++ b/Source/TurnBasedTutorial/ManageSquad/SelectedTrooperSaveGame.h @@ -0,0 +1,21 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/SaveGame.h" +#include "SelectedTrooperSaveGame.generated.h" + +/** + * + */ +UCLASS() +class TURNBASEDTUTORIAL_API USelectedTrooperSaveGame : public USaveGame { + GENERATED_BODY() + +public: + UPROPERTY(EditAnywhere, Category=Basic) + TArray SelectedTroopers; + + USelectedTrooperSaveGame(); +}; diff --git a/TurnBased.uproject b/TurnBased.uproject index 8485d6b..fd638db 100644 --- a/TurnBased.uproject +++ b/TurnBased.uproject @@ -1,6 +1,6 @@ { "FileVersion": 3, - "EngineAssociation": "4.27", + "EngineAssociation": "{B4FE6467-4579-3D84-B22A-558A3D607596}", "Category": "", "Description": "", "Modules": [