Compare commits

..

2 Commits

Author SHA1 Message Date
baz ff5c28ad05 Add On Damaged Hit Animation Montages 2024-02-04 19:21:18 +00:00
baz 3134e269f7 Play Hit Animation Montage when OnDamaged is called 2024-02-04 19:20:16 +00:00
7 changed files with 25 additions and 3 deletions

BIN
Content/AnimStarterPack/Hit_React_1_Montage.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/AnimStarterPack/Hit_React_2_Montage.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/AnimStarterPack/Hit_React_3_Montage.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/AnimStarterPack/Hit_React_4_Montage.uasset (Stored with Git LFS) Normal file

Binary file not shown.

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

Binary file not shown.

View File

@ -3,7 +3,6 @@
#include "PlayerCharacter.h"
// You can remove these, this is just to get intellisense to work
#include <string>
#include <Components/CapsuleComponent.h>
#include <Kismet/GameplayStatics.h>
@ -444,6 +443,14 @@ void APlayerCharacter::ProcessHits(TArray<FHitResult> 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()

View File

@ -89,6 +89,9 @@ public:
UPROPERTY(EditDefaultsOnly)
UAnimMontage* ThrowExplosiveAnimMontage;
UPROPERTY(EditDefaultsOnly)
TArray<UAnimMontage*> OnDamagedHitAnimMontages;
protected:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
float SprintSpeedMultiplier = 2.0f;