From 134883273ec8dbf392681ec9a5a597d4d36f739b Mon Sep 17 00:00:00 2001 From: CatChow0 Date: Thu, 16 Oct 2025 16:30:33 +0200 Subject: [PATCH] Minor - Ajoute des fonctions de score et pv - V01.09.00 Ajoute la gestion du score, des vies et des limites de mouvement du joueur. --- Source/M4_CPP/public/M4_Gamemode.h | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Source/M4_CPP/public/M4_Gamemode.h b/Source/M4_CPP/public/M4_Gamemode.h index a81d4fb..43ff7ad 100644 --- a/Source/M4_CPP/public/M4_Gamemode.h +++ b/Source/M4_CPP/public/M4_Gamemode.h @@ -20,6 +20,40 @@ public: virtual void BeginPlay() override; + /** + * The movement bounds for the player pawn + */ UPROPERTY(EditAnywhere) FBox2D Bounds = FBox2D(FVector2D(-400.0f, -750.0f), FVector2D(-200.0f, 750.0f)); + + /** + * Add to the player's score + * @param Amount + */ + UFUNCTION(BlueprintCallable) + void AddScore(int Amount) { Score += Amount; } + + /** + * Get the player's current score + * @return Current score + */ + UFUNCTION(BlueprintCallable) + int GetScore() const { return Score; } + + /** + * Decrease the player's lives by 1, but not below 0 + */ + UFUNCTION(BlueprintCallable) + void LoseLife() { Lives = FMath::Max(0, Lives - 1); } + + /** + * Get the player's current lives + * @return Current lives + */ + UFUNCTION(BlueprintCallable) + int GetLives() const { return Lives; } + +private: + int Score = 0; + int Lives = 3; };