diff --git a/Source/Nakatomi/NakatomiCharacter.cpp b/Source/Nakatomi/NakatomiCharacter.cpp index 536c469..0a1e68c 100644 --- a/Source/Nakatomi/NakatomiCharacter.cpp +++ b/Source/Nakatomi/NakatomiCharacter.cpp @@ -275,6 +275,13 @@ void ANakatomiCharacter::PlayOnFireAnimations() 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() diff --git a/Source/Nakatomi/NakatomiCharacter.h b/Source/Nakatomi/NakatomiCharacter.h index 648187c..dc47905 100644 --- a/Source/Nakatomi/NakatomiCharacter.h +++ b/Source/Nakatomi/NakatomiCharacter.h @@ -42,6 +42,9 @@ public: UPROPERTY(EditDefaultsOnly) UAnimMontage* FireWeaponAnimMontage; + UPROPERTY(EditDefaultsOnly) + TArray OnDamagedHitAnimMontages; + protected: UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Meta = (AllowPrivateAccess = "true")) UNakatomiCMC* NakatomiCMC; diff --git a/Source/Nakatomi/PlayerCharacter.cpp b/Source/Nakatomi/PlayerCharacter.cpp index 7de6840..2351d2d 100644 --- a/Source/Nakatomi/PlayerCharacter.cpp +++ b/Source/Nakatomi/PlayerCharacter.cpp @@ -460,14 +460,6 @@ void APlayerCharacter::PlayOnFireAnimations() 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 5e7f229..b4e9ace 100644 --- a/Source/Nakatomi/PlayerCharacter.h +++ b/Source/Nakatomi/PlayerCharacter.h @@ -88,9 +88,6 @@ public: UPROPERTY(EditDefaultsOnly) UAnimMontage* ThrowExplosiveAnimMontage; - - UPROPERTY(EditDefaultsOnly) - TArray OnDamagedHitAnimMontages; UPROPERTY(EditDefaultsOnly) UAnimMontage* FireWeaponADSAnimMontage;