Fix damage flash implementation

This commit is contained in:
2025-04-16 22:44:01 +05:30
parent 7f08808b71
commit 44aee655de
4 changed files with 57 additions and 27 deletions

View File

@@ -176,6 +176,14 @@ protected:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Effects")
FLinearColor DamageFlashColor = FLinearColor(1.0f, 0.0f, 0.0f, 0.5f);
// Store the original material
UPROPERTY()
UMaterialInterface* OriginalMaterial;
// Store the dynamic material instance
UPROPERTY()
UMaterialInstanceDynamic* DynamicMaterialInstance;
private:
// Movement state
float CurrentThrottleInput;
@@ -213,6 +221,9 @@ private:
FTimerHandle DamageFlashTimerHandle;
float LastDamageTime;
// Initialize dynamic material
void InitializeDynamicMaterial();
void StartShieldRecharge();
void RechargeShield();
bool IsDead() const { return CurrentHealth <= 0.0f; }