From c4de187ebb5239c3b415d991261b63f31507c5ef Mon Sep 17 00:00:00 2001 From: Kingsmedia Date: Thu, 12 May 2022 01:43:28 +0200 Subject: [PATCH] reorg --- Source/Blaster/Character/BlasterAnimInstance.cpp | 4 ++-- Source/Blaster/Character/BlasterCharacter.cpp | 7 ++++--- .../PlayerController/BlasterPlayerController.cpp | 13 +------------ 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/Source/Blaster/Character/BlasterAnimInstance.cpp b/Source/Blaster/Character/BlasterAnimInstance.cpp index fb8c071..35cdae6 100644 --- a/Source/Blaster/Character/BlasterAnimInstance.cpp +++ b/Source/Blaster/Character/BlasterAnimInstance.cpp @@ -2,11 +2,11 @@ #include "BlasterAnimInstance.h" - #include "BlasterCharacter.h" -#include "Blaster/Weapon/Weapon.h" #include "GameFramework/CharacterMovementComponent.h" #include "Kismet/KismetMathLibrary.h" +#include "Blaster/Weapon/Weapon.h" +#include "Blaster/Types/CombatState.h" void UBlasterAnimInstance::NativeInitializeAnimation() { diff --git a/Source/Blaster/Character/BlasterCharacter.cpp b/Source/Blaster/Character/BlasterCharacter.cpp index 88f645e..0ac4a66 100644 --- a/Source/Blaster/Character/BlasterCharacter.cpp +++ b/Source/Blaster/Character/BlasterCharacter.cpp @@ -108,8 +108,6 @@ void ABlasterCharacter::MulticastEliminated_Implementation() StartDissolve(); // Disable character movement - GetCharacterMovement()->DisableMovement(); - GetCharacterMovement()->StopMovementImmediately(); bDisableGameplay = true; // Disable collision GetCapsuleComponent()->SetCollisionEnabled(ECollisionEnabled::NoCollision); @@ -153,7 +151,10 @@ void ABlasterCharacter::Destroyed() { EliminationBotComponent->DestroyComponent(); } - if (Combat && Combat->EquippedWeapon) + + ABlasterGameMode* BlasterGameMode = Cast(UGameplayStatics::GetGameMode(this)); + bool bMatchNotInProgress = BlasterGameMode && BlasterGameMode->GetMatchState() != MatchState::InProgress; + if (Combat && Combat->EquippedWeapon && bMatchNotInProgress) { Combat->EquippedWeapon->Destroy(); } diff --git a/Source/Blaster/PlayerController/BlasterPlayerController.cpp b/Source/Blaster/PlayerController/BlasterPlayerController.cpp index 7f71be1..44e9c88 100644 --- a/Source/Blaster/PlayerController/BlasterPlayerController.cpp +++ b/Source/Blaster/PlayerController/BlasterPlayerController.cpp @@ -268,18 +268,7 @@ void ABlasterPlayerController::SetHUDTime() if (MatchState == MatchState::WaitingToStart) TimeLeft = WarmupTime - GetServerTime() + LevelStartingTime; else if (MatchState == MatchState::InProgress) TimeLeft = WarmupTime + MatchTime - GetServerTime() + LevelStartingTime; else if (MatchState == MatchState::Cooldown) TimeLeft = CooldownTime + WarmupTime + MatchTime - GetServerTime() + LevelStartingTime; - uint32 SecondsLeft = FMath::CeilToInt(TimeLeft); - - if (HasAuthority()) - { - BlasterGameMode = BlasterGameMode == nullptr ? Cast(UGameplayStatics::GetGameMode(this)) : BlasterGameMode; - if (BlasterGameMode) - { - SecondsLeft = FMath::CeilToInt(BlasterGameMode->GetCountdownTime() + LevelStartingTime); - } - } - if (CountdownInt != SecondsLeft) { if (MatchState == MatchState::WaitingToStart || MatchState == MatchState::Cooldown) @@ -379,7 +368,7 @@ void ABlasterPlayerController::HandleMatchHasStarted() BlasterHUD = BlasterHUD == nullptr ? Cast(GetHUD()) : BlasterHUD; if (BlasterHUD) { - BlasterHUD->AddCharacterOverlay(); + if (BlasterHUD->CharacterOverlay == nullptr) BlasterHUD->AddCharacterOverlay(); if (BlasterHUD->Announcement) { BlasterHUD->Announcement->SetVisibility(ESlateVisibility::Hidden);