From 09746d1a258348e376e520f0d8aabcd3dce356b0 Mon Sep 17 00:00:00 2001 From: Jers Date: Sun, 24 Dec 2023 13:25:41 -0600 Subject: [PATCH] Fixed some bugs with party spawning getting called twice, cleaned up the battle state machine start logic --- Content/Blueprints/BP_GameState.uasset | 4 ++-- Content/Blueprints/BP_PlayerController.uasset | 4 ++-- .../UI/BattleUI/WBP_BattleUI.uasset | 4 ++-- Content/Levels/BattleMap.umap | 4 ++-- .../SpaceBattler/Private/PartySubsystem.cpp | 23 +++++++++++++++++++ Source/SpaceBattler/Public/PartySubsystem.h | 6 +++++ 6 files changed, 37 insertions(+), 8 deletions(-) diff --git a/Content/Blueprints/BP_GameState.uasset b/Content/Blueprints/BP_GameState.uasset index 6609ee2..0d93423 100644 --- a/Content/Blueprints/BP_GameState.uasset +++ b/Content/Blueprints/BP_GameState.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ac7460057fb20db1e5bd17b2d2bff984457828858799afc7b9f59023e8455051 -size 228126 +oid sha256:5dbbeb319ea10df4eae18e869cc9a51405571afc8445c275c41ac443b9a0db48 +size 210515 diff --git a/Content/Blueprints/BP_PlayerController.uasset b/Content/Blueprints/BP_PlayerController.uasset index 9e15711..5198a8a 100644 --- a/Content/Blueprints/BP_PlayerController.uasset +++ b/Content/Blueprints/BP_PlayerController.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:75dbc10f37f6a9f09bbbddf8976157db4526e7d35d4f7bdcde97bf42c2f52e06 -size 301780 +oid sha256:476da3e0048d0cd03173bf4c610e572f648adbdf1c56d3c8f4b61ff4d63eac19 +size 300318 diff --git a/Content/Blueprints/UI/BattleUI/WBP_BattleUI.uasset b/Content/Blueprints/UI/BattleUI/WBP_BattleUI.uasset index a709903..9b28b97 100644 --- a/Content/Blueprints/UI/BattleUI/WBP_BattleUI.uasset +++ b/Content/Blueprints/UI/BattleUI/WBP_BattleUI.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:702fa607a88dd69350922bbf2bf31fdd6aa3e2257a371ffe7daaf43d64929d5f -size 53882 +oid sha256:65232ddbf4436f6aa70740af444fde5768d3c61b169185778ca75b0b69a51d56 +size 65761 diff --git a/Content/Levels/BattleMap.umap b/Content/Levels/BattleMap.umap index 46697f6..7c1db6e 100644 --- a/Content/Levels/BattleMap.umap +++ b/Content/Levels/BattleMap.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6f278e3f4ba451c4ebe57de0a37dcd6ec1548e66715eefcd762be4ca7dab50f9 -size 80306 +oid sha256:2e967a548da565ab1b5415d47b89a317595c731db748d3af061ce3c850acb07a +size 71930 diff --git a/Source/SpaceBattler/Private/PartySubsystem.cpp b/Source/SpaceBattler/Private/PartySubsystem.cpp index 2f038a7..57313ea 100644 --- a/Source/SpaceBattler/Private/PartySubsystem.cpp +++ b/Source/SpaceBattler/Private/PartySubsystem.cpp @@ -61,6 +61,7 @@ void UPartySubsystem::SpawnUnits() if(i + LastSpawnIndex >= SpawnQueue.Num()) { GetWorld()->GetTimerManager().ClearTimer(SpawnTimerHandle); + LastSpawnIndex += i; return; } @@ -153,4 +154,26 @@ void UPartySubsystem::SetMemberUnitInfo(FPartyMember& Member, UUnitInfo* InUnitI UUnitInfo* UPartySubsystem::GetMemberUnitInfo(FPartyMember& Member) const { return Member.UnitInfo; +} + +int32 UPartySubsystem::GetTotalAvailablePartyMembers() +{ + int32 Total = 0; + for(auto const Member : Members) + { + Total += Member.Available; + } + + return Total; +} + +int32 UPartySubsystem::GetTotalAllocatedPartyMembers() +{ + int32 Total = 0; + for(auto const Member : Members) + { + Total += Member.Allocated; + } + + return Total; } \ No newline at end of file diff --git a/Source/SpaceBattler/Public/PartySubsystem.h b/Source/SpaceBattler/Public/PartySubsystem.h index ba94322..65fad56 100644 --- a/Source/SpaceBattler/Public/PartySubsystem.h +++ b/Source/SpaceBattler/Public/PartySubsystem.h @@ -57,6 +57,12 @@ public: UFUNCTION(BlueprintCallable) UUnitInfo* GetMemberUnitInfo(UPARAM(ref) FPartyMember& Member) const; + + UFUNCTION(BlueprintCallable) + int32 GetTotalAvailablePartyMembers(); + + UFUNCTION(BlueprintCallable) + int32 GetTotalAllocatedPartyMembers(); protected: void SpawnUnits();