From 929c4fa0f3829ef9f76d1d512573c299927e7956 Mon Sep 17 00:00:00 2001 From: baz Date: Sun, 17 Nov 2024 21:45:29 +0000 Subject: [PATCH] Clear timer in OnUnPossess --- Source/vampires/VampirePlayerController.cpp | 7 +++++++ Source/vampires/VampirePlayerController.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/Source/vampires/VampirePlayerController.cpp b/Source/vampires/VampirePlayerController.cpp index ff004a8..210bd0a 100644 --- a/Source/vampires/VampirePlayerController.cpp +++ b/Source/vampires/VampirePlayerController.cpp @@ -42,6 +42,13 @@ void AVampirePlayerController::OnPossess(APawn* aPawn) } } +void AVampirePlayerController::OnUnPossess() +{ + Super::OnUnPossess(); + + GetWorld()->GetTimerManager().ClearTimer(pawnLifeTimeHandle); +} + void AVampirePlayerController::UpdatePlayerEXPHUD(int exp, float currentLevelPercent) { if (currentPlayerHUD) diff --git a/Source/vampires/VampirePlayerController.h b/Source/vampires/VampirePlayerController.h index 17a1385..a0fcc41 100644 --- a/Source/vampires/VampirePlayerController.h +++ b/Source/vampires/VampirePlayerController.h @@ -29,6 +29,8 @@ private: protected: virtual void OnPossess(APawn* aPawn) override; + virtual void OnUnPossess() override; + UFUNCTION() void UpdatePlayerEXPHUD(int exp, float currentLevelPercent);