Add post process material instance to display damage on screen

This commit is contained in:
Emilie Schott 2025-03-09 03:00:07 +01:00
parent 2e2dc472d5
commit 89f514a0e4
11 changed files with 52 additions and 7 deletions

Binary file not shown.

BIN
Content/Legumix/Levels/LVL_GYM_00.umap (Stored with Git LFS)

Binary file not shown.

BIN
Content/Legumix/Player/BP_Play.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Legumix/Player/HUD/Greyscale.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Legumix/Player/HUD/M_Postprocess_Damage.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Legumix/Player/HUD/M_Postprocess_Damage_Inst.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Legumix/Player/HUD/T_LavaMat4_Emissive.uasset (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -6,6 +6,7 @@ ALMEnemy::ALMEnemy()
{
PrimaryActorTick.bCanEverTick = true;
EnemyState = EEnemyState::EES_Chasing;
AttackingRadius = 100.f;
AttackingDamage = 0.f;
}

View File

@ -27,6 +27,10 @@ ALMPlayer::ALMPlayer()
SpreadStream = FRandomStream(FMath::Rand());
HealthComponent = CreateDefaultSubobject<ULMHealthComponent>(TEXT("HealthComponent"));
HitPeriodLengthInSeconds = 0.f;
TimeElapsedSinceLastDamageInSeconds = 0.f;
CumulatedDamagesOnCurrentHitPeriod = 0.f;
}
void ALMPlayer::BeginPlay()

View File

@ -44,7 +44,7 @@ protected:
double GetDistanceToTarget(const AActor* TargetedActor);
/**
* Returns the distance between the enemy and a target.
* Performs an attack on the targeted pawn
* @param TargetedPawn
* @returns
*/

View File

@ -113,6 +113,34 @@ private:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true))
TObjectPtr<ULMHealthComponent> HealthComponent;
/**
* Length of the period in which the damages HUD will be displayed on player screen.
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta = (AllowPrivateAccess = true))
double HitPeriodLengthInSeconds;
/**
* Time elapsed since last damage taken.
* If it's superior to the HitPeriodLengthInSeconds variable, ends the Hit period
* and so the displaying of damages HUD on player screen
*/
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true))
double TimeElapsedSinceLastDamageInSeconds;
/**
* Cumulated damages taken by the player on the current hit period
* To calculate view occlusion percent for the damage HUD
*/
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true))
float CumulatedDamagesOnCurrentHitPeriod;
/**
* Player health at the current hit period beginning
* To calculate view occlusion percent for the damage HUD
*/
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true))
float HealthAtTheCurrentHitPeriodBeginning;
private:
#if WITH_EDITORONLY_DATA
/** If set, bullet debug will be drawn. */