Move OnDamagedAnimationMontages to NakatomiCharacter

This commit is contained in:
baz 2024-03-05 17:00:53 +00:00
parent ad2034b15d
commit 3c69fc2289
4 changed files with 10 additions and 11 deletions

View File

@ -275,6 +275,13 @@ void ANakatomiCharacter::PlayOnFireAnimations()
void ANakatomiCharacter::OnDamaged() void ANakatomiCharacter::OnDamaged()
{ {
int32 randomAnimMontage = FMath::RandRange(0,OnDamagedHitAnimMontages.Num()-1);
if (OnDamagedHitAnimMontages[randomAnimMontage] != nullptr)
{
//TODO: Disable movement while playing animation montage
PlayAnimMontage(OnDamagedHitAnimMontages[randomAnimMontage]);
}
} }
void ANakatomiCharacter::OnDeath() void ANakatomiCharacter::OnDeath()

View File

@ -42,6 +42,9 @@ public:
UPROPERTY(EditDefaultsOnly) UPROPERTY(EditDefaultsOnly)
UAnimMontage* FireWeaponAnimMontage; UAnimMontage* FireWeaponAnimMontage;
UPROPERTY(EditDefaultsOnly)
TArray<UAnimMontage*> OnDamagedHitAnimMontages;
protected: protected:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Meta = (AllowPrivateAccess = "true")) UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Meta = (AllowPrivateAccess = "true"))
UNakatomiCMC* NakatomiCMC; UNakatomiCMC* NakatomiCMC;

View File

@ -460,14 +460,6 @@ void APlayerCharacter::PlayOnFireAnimations()
void APlayerCharacter::OnDamaged() void APlayerCharacter::OnDamaged()
{ {
Super::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() void APlayerCharacter::OnDeath()

View File

@ -88,9 +88,6 @@ public:
UPROPERTY(EditDefaultsOnly) UPROPERTY(EditDefaultsOnly)
UAnimMontage* ThrowExplosiveAnimMontage; UAnimMontage* ThrowExplosiveAnimMontage;
UPROPERTY(EditDefaultsOnly)
TArray<UAnimMontage*> OnDamagedHitAnimMontages;
UPROPERTY(EditDefaultsOnly) UPROPERTY(EditDefaultsOnly)
UAnimMontage* FireWeaponADSAnimMontage; UAnimMontage* FireWeaponADSAnimMontage;