diff --git a/Source/Nakatomi/PlayerCharacter.cpp b/Source/Nakatomi/PlayerCharacter.cpp index fc53a93..923462c 100644 --- a/Source/Nakatomi/PlayerCharacter.cpp +++ b/Source/Nakatomi/PlayerCharacter.cpp @@ -3,7 +3,6 @@ #include "PlayerCharacter.h" // You can remove these, this is just to get intellisense to work -#include #include #include @@ -444,6 +443,14 @@ void APlayerCharacter::ProcessHits(TArray hits) void APlayerCharacter::OnDamaged() { Super::OnDamaged(); + + int32 randomAnimMontage = FMath::RandRange(0,OnDamagedHitAnimMontages.Num()-1); + + if (OnDamagedHitAnimMontages[randomAnimMontage] != nullptr) + { + //TODO: Disable movement while playing animation montage + PlayAnimMontage(OnDamagedHitAnimMontages[randomAnimMontage]); + } } void APlayerCharacter::OnDeath() diff --git a/Source/Nakatomi/PlayerCharacter.h b/Source/Nakatomi/PlayerCharacter.h index 690c7e2..968a2f5 100644 --- a/Source/Nakatomi/PlayerCharacter.h +++ b/Source/Nakatomi/PlayerCharacter.h @@ -89,6 +89,9 @@ public: UPROPERTY(EditDefaultsOnly) UAnimMontage* ThrowExplosiveAnimMontage; + UPROPERTY(EditDefaultsOnly) + TArray OnDamagedHitAnimMontages; + protected: UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) float SprintSpeedMultiplier = 2.0f;