From 80f821dfaea5074fbc2a8f0937aa328e30c23d71 Mon Sep 17 00:00:00 2001 From: eyakm1 Date: Mon, 20 Mar 2023 16:47:12 +0300 Subject: [PATCH] Enable spawning of troopers --- Config/DefaultEngine.ini | 3 + Content/BP_MyGameMode.uasset | Bin 18154 -> 18328 bytes Content/BP_MyPawn.uasset | Bin 0 -> 20454 bytes Content/BP_MyPlayerController.uasset | Bin 0 -> 17924 bytes Content/BattleField/BattleFieldMap.umap | Bin 634586 -> 634586 bytes Source/TurnBasedTutorial/MyGameMode.cpp | 57 ++++++-- Source/TurnBasedTutorial/MyGameMode.h | 8 +- Source/TurnBasedTutorial/MyPawn.cpp | 58 ++++---- Source/TurnBasedTutorial/MyPawn.h | 32 ++--- .../TurnBasedTutorial/MyPlayerController.cpp | 132 ++++++++++-------- Source/TurnBasedTutorial/MyPlayerController.h | 33 +++-- Source/TurnBasedTutorial/Trooper.cpp | 71 ++++++---- Source/TurnBasedTutorial/Trooper.h | 23 ++- 13 files changed, 245 insertions(+), 172 deletions(-) create mode 100644 Content/BP_MyPawn.uasset create mode 100644 Content/BP_MyPlayerController.uasset diff --git a/Config/DefaultEngine.ini b/Config/DefaultEngine.ini index ac3dc22..0d2ee23 100644 --- a/Config/DefaultEngine.ini +++ b/Config/DefaultEngine.ini @@ -26,3 +26,6 @@ AppliedDefaultGraphicsPerformance=Maximum +ActiveGameNameRedirects=(OldGameName="/Script/TP_Blank",NewGameName="/Script/TurnBasedTutorial") +ActiveClassRedirects=(OldClassName="TP_BlankGameModeBase",NewClassName="TurnBasedTutorialGameModeBase") + +[CoreRedirects] ++PropertyRedirects=(OldName="/Script/TurnBasedTutorial.Trooper.OnPlayersSide",NewName="/Script/TurnBasedTutorial.Trooper.bOnPlayersSide") \ No newline at end of file diff --git a/Content/BP_MyGameMode.uasset b/Content/BP_MyGameMode.uasset index f27bd1b2d733160e79d404e4f376b282e1491a0e..aec131aa9663b371392550cc13b129a15d663a17 100644 GIT binary patch delta 4117 zcmcguYfM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z6?`iTWXpq>c3s-V{SJHNIFr8as&9-p&AhS_E&E z0k=Q+SaT#bHT)oH0Rm6b0swg-nML<~et-?10z*2>$jqyw$MVJQoKA()YtfC}7|=xO zRfvrd-e3(#6w9@ZEm}mg#E)n|PTmI!t6ChWMyuyVD({uO9C~H&$juXKe)Ii_Ki_iX zK3}QA=(Qm*T@~1+yi~z>LkFB7v0zgDSoV*QU~3mSCE`ql$Ss%)B(!2Dy`R4D_kU3d Bm{I@$ literal 0 HcmV?d00001 diff --git a/Content/BP_MyPlayerController.uasset b/Content/BP_MyPlayerController.uasset new file mode 100644 index 0000000000000000000000000000000000000000..ca2c84fc00157287addc28893871079a9578f8ff GIT binary patch literal 17924 zcmeHP37AyXmA<7Qi-2H2HkE4jX6dDRV^ip^s%C4tn_h@Wu)DhIRd+#ky`t(B*oXv( zaSVwPl^91BBatx%NMJx1M4iBwe3`_I7}0T*5gkQ7A(DxaL1mru-*@kOue+8mXp%4A z%-sH7-S^Ht_nzgRbMCos>4V=Iv-zvbmoL{}&sg{C7%w-_?|ZS2Ge?#F_=BZy^xkyp zKgJE~L$E0a?T)%tP}PYw)9-p4V;NLWa5#%66u2Dur6mQ$1v$kfj)KAo&WSm$qQb%g zSAHQQJod(ojP;^Aa1&$wsE+kuY#^PWZ7bC~==cpCn*-A-F8rXt`EvN|)DJSZpa1*X z!yj(!*QI=&w{+F=+Gj=pALD?5PHZr{jtyAb-}W`S8auYuoj7HgKyQH#iPD^Fb)1pM2YDkNy z!JrahuO51MyCXGDR^p!i`pJ9pucl|6lhuF8-t3RQ)!s-TtYw!3V@fy@2x-$Jo^TU8 zd31%Vucg_kMwHr$hDC~3V_(i3e<#g`(bXMl4AAsGIPKdr2U);1u}G+dRO+jVX=)_k z39^&F8*m(!Cu!D(B8n&I_OWrDe%KXeTI?lEHvaIi`OqrAD)TfbLH1n#NF8RcI1=%+ zR7TXW646@N%$*;>ELcNvFsLqb(F|$ab5BKMSC9+$xp%+#iei}y7K z9@5yhzbkwf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BasedTutorial/MyGameMode.cpp @@ -12,13 +12,48 @@ AMyGameMode::AMyGameMode() : Super() DefaultPawnClass = AMyPawn::StaticClass(); } +void AMyGameMode::BeginPlay() +{ + Super::BeginPlay(); + ATrooper::InitNumberOfTroopersForId(); + UE_LOG(LogTemp, Warning, TEXT("GameMode BeginPlay")); + if (GetWorld()->GetMapName().Contains("BattleFieldMap")) + { + UE_LOG(LogTemp, Warning, TEXT("Player Logined")); + InitializeBattleField(); + GetPlayerController()->StartTurn(); + } +} + +void AMyGameMode::InitializeBattleField() const +{ + FVector Location(2000.0f, -1000.0f, 0.0f); + FRotator Rotation(0.0f, 180.0f, 0.0f); + FActorSpawnParameters const SpawnInfo; + for (int i = 0; i < 5; ++i) + { + AActor* Spawned = GetWorld()->SpawnActor(Location, Rotation, SpawnInfo); + dynamic_cast(Spawned)->InitTrooper(Location, true); + Location += {0.f, 500.f, 0.0f}; + } + Location = {-2000.0f, -1000.0f, 0.0f}; + Rotation = {0.0f, 0.0f, 0.0f}; + for (int i = 0; i < 5; ++i) + { + AActor* Spawned = GetWorld()->SpawnActor(Location, Rotation, SpawnInfo); + dynamic_cast(Spawned)->InitTrooper(Location, false); + Location += {0.f, 500.f, 0.0f}; + } +} + + AActor* AMyGameMode::ChoosePlayerStart_Implementation(AController* Player) { UE_LOG(LogTemp, Warning, TEXT("GameMode ChoosePlayerStart %d"), GetNumPlayers()); InitializeSpawnPointsIfNeeded(Player); - auto ptr = *SpawnPoints.Find(GetNumPlayers()); - UE_LOG(LogTemp, Warning, TEXT("GameMode ChoosePlayerStart end %d"), ptr->GetPlayerIndex()); - return ptr; + const auto CurrentPlayerStart = *SpawnPoints.Find(GetNumPlayers()); + UE_LOG(LogTemp, Warning, TEXT("GameMode ChoosePlayerStart end %d"), CurrentPlayerStart->GetPlayerIndex()); + return CurrentPlayerStart; } void AMyGameMode::InitializeSpawnPointsIfNeeded(AController* Player) @@ -27,13 +62,13 @@ void AMyGameMode::InitializeSpawnPointsIfNeeded(AController* Player) { return; } - auto World = GetWorld(); + const auto World = GetWorld(); for (TActorIterator PlayerStartIterator(GetWorld()); PlayerStartIterator; ++PlayerStartIterator) { - auto PlayerStart = *PlayerStartIterator; - UClass* PawnClass = GetDefaultPawnClassForController(Player); - APawn* PawnToFit = PawnClass ? PawnClass->GetDefaultObject() : nullptr; - FVector ActorLocation = PlayerStart->GetActorLocation(); + const auto PlayerStart = *PlayerStartIterator; + const UClass* PawnClass = GetDefaultPawnClassForController(Player); + const APawn* PawnToFit = PawnClass ? PawnClass->GetDefaultObject() : nullptr; + const FVector ActorLocation = PlayerStart->GetActorLocation(); const FRotator ActorRotation = PlayerStart->GetActorRotation(); if (!World->EncroachingBlockingGeometry(PawnToFit, ActorLocation, ActorRotation)) { @@ -42,3 +77,9 @@ void AMyGameMode::InitializeSpawnPointsIfNeeded(AController* Player) } } } + + +AMyPlayerController* AMyGameMode::GetPlayerController() const +{ + return dynamic_cast(UGameplayStatics::GetPlayerController(GetWorld(), 0)); +} diff --git a/Source/TurnBasedTutorial/MyGameMode.h b/Source/TurnBasedTutorial/MyGameMode.h index a0bb877..9d0eb1b 100644 --- a/Source/TurnBasedTutorial/MyGameMode.h +++ b/Source/TurnBasedTutorial/MyGameMode.h @@ -22,8 +22,14 @@ public: virtual AActor* ChoosePlayerStart_Implementation(AController* Player) override; + virtual void BeginPlay() override; + private: - void InitializeSpawnPointsIfNeeded(AController *Player); + void InitializeSpawnPointsIfNeeded(AController* Player); + + void InitializeBattleField() const; TMap SpawnPoints; + + AMyPlayerController* GetPlayerController() const; }; diff --git a/Source/TurnBasedTutorial/MyPawn.cpp b/Source/TurnBasedTutorial/MyPawn.cpp index b250cbe..640053e 100644 --- a/Source/TurnBasedTutorial/MyPawn.cpp +++ b/Source/TurnBasedTutorial/MyPawn.cpp @@ -4,32 +4,32 @@ #include "MyPawn.h" -// // Sets default values -// AMyPawn::AMyPawn() -// { -// // Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it. -// PrimaryActorTick.bCanEverTick = true; -// -// } -// -// // Called when the game starts or when spawned -// void AMyPawn::BeginPlay() -// { -// Super::BeginPlay(); -// -// } -// -// // Called every frame -// void AMyPawn::Tick(float DeltaTime) -// { -// Super::Tick(DeltaTime); -// -// } -// -// // Called to bind functionality to input -// void AMyPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) -// { -// Super::SetupPlayerInputComponent(PlayerInputComponent); -// -// } -// +// Sets default values +AMyPawn::AMyPawn() +{ + // Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it. + PrimaryActorTick.bCanEverTick = true; + +} + +// Called when the game starts or when spawned +void AMyPawn::BeginPlay() +{ + Super::BeginPlay(); + +} + +// Called every frame +void AMyPawn::Tick(float DeltaTime) +{ + Super::Tick(DeltaTime); + +} + +// Called to bind functionality to input +void AMyPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) +{ + Super::SetupPlayerInputComponent(PlayerInputComponent); + +} + diff --git a/Source/TurnBasedTutorial/MyPawn.h b/Source/TurnBasedTutorial/MyPawn.h index 2049c14..40953df 100644 --- a/Source/TurnBasedTutorial/MyPawn.h +++ b/Source/TurnBasedTutorial/MyPawn.h @@ -11,21 +11,21 @@ class TURNBASEDTUTORIAL_API AMyPawn : public APawn { GENERATED_BODY() -// public: -// // Sets default values for this pawn's properties -// AMyPawn(); -// -// protected: -// // Called when the game starts or when spawned -// virtual void BeginPlay() override; -// -// public: -// // Called every frame -// virtual void Tick(float DeltaTime) override; -// -// // Called to bind functionality to input -// virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; -// -// +public: + // Sets default values for this pawn's properties + AMyPawn(); + +protected: + // Called when the game starts or when spawned + virtual void BeginPlay() override; + +public: + // Called every frame + virtual void Tick(float DeltaTime) override; + + // Called to bind functionality to input + virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; + + }; diff --git a/Source/TurnBasedTutorial/MyPlayerController.cpp b/Source/TurnBasedTutorial/MyPlayerController.cpp index 6504d78..76ee933 100644 --- a/Source/TurnBasedTutorial/MyPlayerController.cpp +++ b/Source/TurnBasedTutorial/MyPlayerController.cpp @@ -2,62 +2,76 @@ #include "MyPlayerController.h" -// AMyPlayerController::AMyPlayerController() : Super(), IsMyTurn(false), SelectedTrooper(nullptr) { -// UE_LOG(LogTemp, Warning, TEXT("Player controller created")); -// } -// -// void AMyPlayerController::SetupInputComponent() { -// Super::SetupInputComponent(); -// InputComponent->BindAction("MyAction", IE_Pressed, this, -// &AMyPlayerController::OnLeftMouseClick); -// } -// -// void AMyPlayerController::StartTurn() { -// IsMyTurn = true; -// UE_LOG(LogTemp, Warning, TEXT("Your turn")); -// } -// -// void AMyPlayerController::EndTurn() { -// IsMyTurn = false; -// UE_LOG(LogTemp, Warning, TEXT("Not your turn")); -// } -// -// void AMyPlayerController::SetTrooperIsMoving(bool isMoving) { -// IsThereTrooperMoving = isMoving; -// } -// -// void AMyPlayerController::OnLeftMouseClick() { -// if (IsThereTrooperMoving) { -// return; -// } -// UE_LOG(LogTemp, Warning, TEXT("Mouse clicked")); -// FHitResult HitResult; -// bool IsHitResult = GetHitResultUnderCursorByChannel(TraceTypeQuery1, false, HitResult); -// if (IsHitResult) { -// AActor *actor = HitResult.Actor.Get(); -// if (actor->ActorHasTag(FName("Trooper"))) { -// ATrooper* trooper = dynamic_cast(actor); -// if (trooper != nullptr && trooper != SelectedTrooper) { -// if (trooper->IsOnPlayersSide()) { -// UE_LOG(LogTemp, Warning, TEXT("Hitted trooper id: %d, on our side"), -// trooper->GetId()); -// SelectedTrooper = trooper; -// } -// else { -// UE_LOG(LogTemp, Warning, TEXT("Hitted trooper id: %d, enemy"), -// trooper->GetId()); -// UE_LOG(LogTemp, Warning, TEXT("Trooper #%d hit enemy trooper #%d"), -// SelectedTrooper->GetId(), trooper->GetId()); -// } -// } -// } -// else if (actor->ActorHasTag(FName("Floor"))) { -// UE_LOG(LogTemp, Warning, TEXT("Hitted floor: %f, %f, %f"), HitResult.Location.X, -// HitResult.Location.Y, HitResult.Location.Z); -// if (SelectedTrooper != nullptr) { -// SelectedTrooper->MoveTrooper(HitResult.Location); -// IsThereTrooperMoving = true; -// } -// } -// } -// } +AMyPlayerController::AMyPlayerController() : Super(), IsMyTurn(false), SelectedTrooper(nullptr) +{ + UE_LOG(LogTemp, Warning, TEXT("Player controller created")); +} + +void AMyPlayerController::SetupInputComponent() +{ + Super::SetupInputComponent(); + InputComponent->BindAction("MyAction", IE_Pressed, this, + &AMyPlayerController::OnLeftMouseClick); +} + +void AMyPlayerController::StartTurn() +{ + IsMyTurn = true; + UE_LOG(LogTemp, Warning, TEXT("Your turn")); +} + +void AMyPlayerController::EndTurn() +{ + IsMyTurn = false; + UE_LOG(LogTemp, Warning, TEXT("Not your turn")); +} + +void AMyPlayerController::SetTrooperIsMoving(bool isMoving) +{ + IsThereTrooperMoving = isMoving; +} + +void AMyPlayerController::OnLeftMouseClick() +{ + if (IsThereTrooperMoving) + { + return; + } + UE_LOG(LogTemp, Warning, TEXT("Mouse clicked")); + FHitResult HitResult; + bool const IsHitResult = GetHitResultUnderCursorByChannel(TraceTypeQuery1, false, HitResult); + if (IsHitResult) + { + AActor* Actor = HitResult.Actor.Get(); + if (Actor->ActorHasTag(FName("Trooper"))) + { + ATrooper* Trooper = dynamic_cast(Actor); + if (Trooper != nullptr && Trooper != SelectedTrooper) + { + if (Trooper->IsOnPlayersSide()) + { + UE_LOG(LogTemp, Warning, TEXT("Hitted trooper id: %d, on our side"), + Trooper->GetId()); + SelectedTrooper = Trooper; + } + else + { + UE_LOG(LogTemp, Warning, TEXT("Hitted trooper id: %d, enemy"), + Trooper->GetId()); + UE_LOG(LogTemp, Warning, TEXT("Trooper #%d hit enemy trooper #%d"), + SelectedTrooper->GetId(), Trooper->GetId()); + } + } + } + else if (Actor->ActorHasTag(FName("Floor"))) + { + UE_LOG(LogTemp, Warning, TEXT("Hitted floor: %f, %f, %f"), HitResult.Location.X, + HitResult.Location.Y, HitResult.Location.Z); + if (SelectedTrooper != nullptr) + { + SelectedTrooper->MoveTrooper(HitResult.Location); + IsThereTrooperMoving = true; + } + } + } +} diff --git a/Source/TurnBasedTutorial/MyPlayerController.h b/Source/TurnBasedTutorial/MyPlayerController.h index 17b9cda..357e164 100644 --- a/Source/TurnBasedTutorial/MyPlayerController.h +++ b/Source/TurnBasedTutorial/MyPlayerController.h @@ -13,25 +13,24 @@ UCLASS() class TURNBASEDTUTORIAL_API AMyPlayerController : public APlayerController { GENERATED_BODY() - + public: - // AMyPlayerController(); - // - // void StartTurn(); - // - // void EndTurn(); - // - // virtual void SetupInputComponent() override; - // - // void SetTrooperIsMoving(bool isMoving); + AMyPlayerController(); + + void StartTurn(); + + void EndTurn(); + + virtual void SetupInputComponent() override; + + void SetTrooperIsMoving(bool isMoving); private: - // bool IsMyTurn; - // - // bool IsThereTrooperMoving = false; - // - // ATrooper* SelectedTrooper; - // - // void OnLeftMouseClick(); + bool IsMyTurn; + + bool IsThereTrooperMoving = false; + + ATrooper* SelectedTrooper; + void OnLeftMouseClick(); }; diff --git a/Source/TurnBasedTutorial/Trooper.cpp b/Source/TurnBasedTutorial/Trooper.cpp index 92ee67c..eac1cf6 100644 --- a/Source/TurnBasedTutorial/Trooper.cpp +++ b/Source/TurnBasedTutorial/Trooper.cpp @@ -3,7 +3,8 @@ #include "MyPlayerController.h" // Sets default values -ATrooper::ATrooper() { +ATrooper::ATrooper() +{ PrimaryActorTick.bCanEverTick = true; Tags.Add(FName("Trooper")); Id = NumberOfTroopersForId++; @@ -25,49 +26,59 @@ void ATrooper::BeginPlay() Super::BeginPlay(); } -void ATrooper::Tick(float deltaTime) { - // if (IsMoving) { - // FVector vector = (MoveToVector - Position); - // vector.Normalize(); - // vector *= (Speed * deltaTime); - // if (vector.Size() >= (MoveToVector - Position).Size()) { - // Position = MoveToVector; - // IsMoving = false; - // dynamic_cast( - // UGameplayStatics::GetPlayerController(GetWorld(), 0) - // )->SetTrooperIsMoving(false); - // } - // else { - // Position += vector; - // } - // SetActorLocation(Position); - // } +void ATrooper::Tick(float const DeltaTime) +{ + if (bIsMoving) + { + FVector vector = (MoveToVector - Position); + vector.Normalize(); + vector *= (Speed * DeltaTime); + if (vector.Size() >= (MoveToVector - Position).Size()) + { + Position = MoveToVector; + bIsMoving = false; + dynamic_cast( + UGameplayStatics::GetPlayerController(GetWorld(), 0) + )->SetTrooperIsMoving(false); + } + else + { + Position += vector; + } + SetActorLocation(Position); + } } -void ATrooper::MoveTrooper(FVector newPos) { - MoveToVector = newPos; - IsMoving = true; +void ATrooper::MoveTrooper(FVector const NewPos) +{ + MoveToVector = NewPos; + bIsMoving = true; } -int ATrooper::NumberOfTroopersForId = 0; +uint8 ATrooper::NumberOfTroopersForId = 0; -void ATrooper::InitNumberOfTroopersForId() { +void ATrooper::InitNumberOfTroopersForId() +{ NumberOfTroopersForId = 0; } -FVector ATrooper::GetPosition() { +FVector ATrooper::GetPosition() const +{ return Position; } -bool ATrooper::IsOnPlayersSide() { - return OnPlayersSide; +bool ATrooper::IsOnPlayersSide() const +{ + return bOnPlayersSide; } -int ATrooper::GetId() { +uint8 ATrooper::GetId() const +{ return Id; } -void ATrooper::InitTrooper(FVector position, bool onPlayersSide) { - Position = position; - OnPlayersSide = onPlayersSide; +void ATrooper::InitTrooper(FVector const NewPosition, bool const bIsOnPlayersSide) +{ + Position = NewPosition; + bOnPlayersSide = bIsOnPlayersSide; } diff --git a/Source/TurnBasedTutorial/Trooper.h b/Source/TurnBasedTutorial/Trooper.h index c6d2b75..fc1ee7c 100644 --- a/Source/TurnBasedTutorial/Trooper.h +++ b/Source/TurnBasedTutorial/Trooper.h @@ -1,4 +1,3 @@ - #pragma once #include "CoreMinimal.h" @@ -11,25 +10,25 @@ class TURNBASEDTUTORIAL_API ATrooper : public AActor { GENERATED_BODY() -public: +public: // Sets default values for this actor's properties ATrooper(); protected: - static int NumberOfTroopersForId; + static uint8 NumberOfTroopersForId; virtual void BeginPlay() override; - virtual void Tick(float deltaTime) override; + virtual void Tick(float const DeltaTime) override; UPROPERTY() FVector Position; UPROPERTY() - bool OnPlayersSide; + bool bOnPlayersSide; UPROPERTY() - int Id; + uint8 Id; UPROPERTY(VisibleAnywhere, BlueprintReadOnly) UStaticMeshComponent* Mesh; @@ -37,20 +36,20 @@ protected: UPROPERTY() float Speed = 300.0f; - bool IsMoving = false; + bool bIsMoving = false; FVector MoveToVector; public: - void MoveTrooper(FVector newPos); + void MoveTrooper(FVector const NewPos); static void InitNumberOfTroopersForId(); - FVector GetPosition(); + FVector GetPosition() const; - bool IsOnPlayersSide(); + bool IsOnPlayersSide() const; - int GetId(); + uint8 GetId() const; - void InitTrooper(FVector position, bool onPlayersSide); + void InitTrooper(FVector const NewPosition, bool const bIsOnPlayersSide); };