From cc12c074b0c6d3f763b6151a6f16b9dab67ef92e Mon Sep 17 00:00:00 2001 From: Jers Date: Sat, 13 Jan 2024 15:36:54 -0600 Subject: [PATCH] Added gameover and reset game --- Content/Blueprints/BP_GameState.uasset | 4 ++-- Content/Blueprints/BP_PlayerController.uasset | 4 ++-- .../UI/GameOver/WBP_GameOver.uasset | 3 +++ .../Blueprints/Units/Common/BP_Unit.uasset | 4 ++-- .../Private/StateMachineSubsystem.cpp | 23 ++++++++++++++++++- 5 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 Content/Blueprints/UI/GameOver/WBP_GameOver.uasset diff --git a/Content/Blueprints/BP_GameState.uasset b/Content/Blueprints/BP_GameState.uasset index d3a4393..14d3b43 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:dac78754f689f50a8de2004925f3dc8aee483da2265d658b269a2ca2e7a00e92 -size 227661 +oid sha256:7a0ce7b4595d91294ad342f0335d3112ad7e7fbd033ad3e077f25df184ffc6df +size 241770 diff --git a/Content/Blueprints/BP_PlayerController.uasset b/Content/Blueprints/BP_PlayerController.uasset index 7241f5d..fac24bc 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:9f03d94ac0052e3fc51a5ccac164c7c59c5685b3fad751ae81cbdfec17223c89 -size 382308 +oid sha256:da5c4f5ee60409aa4f25c82339bdd82b56b3654a37d13e2b7b990e6d69378aa8 +size 443303 diff --git a/Content/Blueprints/UI/GameOver/WBP_GameOver.uasset b/Content/Blueprints/UI/GameOver/WBP_GameOver.uasset new file mode 100644 index 0000000..51553d0 --- /dev/null +++ b/Content/Blueprints/UI/GameOver/WBP_GameOver.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d4b35bfe4ab96b01e2fc9136867af1596b0bd7c5d94dd49463b35ff869c368d5 +size 60777 diff --git a/Content/Blueprints/Units/Common/BP_Unit.uasset b/Content/Blueprints/Units/Common/BP_Unit.uasset index 450c8f5..00f2cda 100644 --- a/Content/Blueprints/Units/Common/BP_Unit.uasset +++ b/Content/Blueprints/Units/Common/BP_Unit.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a6c365e0d3cd0536b03a5217f1ba4d6f7e56bd72f7d402823a34b96cc2408c52 -size 524208 +oid sha256:89eeab0235778f5a7fd73c53ce573def7ff326392861779e06e63c2c89d6f933 +size 530429 diff --git a/Source/SpaceBattler/Private/StateMachineSubsystem.cpp b/Source/SpaceBattler/Private/StateMachineSubsystem.cpp index 3acc4bf..38e6d5a 100644 --- a/Source/SpaceBattler/Private/StateMachineSubsystem.cpp +++ b/Source/SpaceBattler/Private/StateMachineSubsystem.cpp @@ -50,13 +50,34 @@ bool UStateMachineSubsystem::ChangeState(const EGameState NewState) switch(NewState) { case EGameState::Battle: - UE_LOG(LogTemp, Error, TEXT("Entering BATTLE state from BATTLEMENU")) + UE_LOG(LogTemp, Display, TEXT("Entering BATTLE state from BATTLEMENU")) break; default: UE_LOG(LogTemp, Error, TEXT("NewState is invalid from BATTLEMENU state: %hhd"), NewState) return false; } break; + case EGameState::GameOver: + switch(NewState) + { + case EGameState::MainMenu: + UE_LOG(LogTemp, Display, TEXT("Entering MAINMENU state from GAMEOVER")) + break; + default: + UE_LOG(LogTemp, Error, TEXT("NewState is invalid from GAMEOVER: %hhd"), NewState) + return false; + } + break; + case EGameState::Victory: + switch(NewState) + { + case EGameState::MainMenu: + UE_LOG(LogTemp, Display, TEXT("Entering MAINMENU state from VICTORY")) + break; + default: + UE_LOG(LogTemp, Error, TEXT("NewState is invalid from VICTORY: %hhd"), NewState) + return false; + } default: UE_LOG(LogTemp, Error, TEXT("Leaving unknown state, this is a problem")) return false;