diff --git a/Content/Animations/AnimStarterPack/AM/Fire_Rifle_Hip_Montage.uasset b/Content/Animations/AnimStarterPack/AM/Fire_Rifle_Hip_Montage.uasset new file mode 100644 index 0000000..dffa503 --- /dev/null +++ b/Content/Animations/AnimStarterPack/AM/Fire_Rifle_Hip_Montage.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:284e4c17328e884d5d33d750ced327a1363aeb3ae66237aa79793b3bcabc76e4 +size 9592 diff --git a/Content/Animations/AnimStarterPack/AM/Fire_Rifle_Ironsights_Montage.uasset b/Content/Animations/AnimStarterPack/AM/Fire_Rifle_Ironsights_Montage.uasset new file mode 100644 index 0000000..d8af963 --- /dev/null +++ b/Content/Animations/AnimStarterPack/AM/Fire_Rifle_Ironsights_Montage.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ccf9a9fed481077c87d091f2d2df5162d205b9ec78f83932707c74f13569f34c +size 9470 diff --git a/Content/Enemy/Worker/C_Worker.uasset b/Content/Enemy/Worker/C_Worker.uasset index 530f70b..e71b57e 100644 --- a/Content/Enemy/Worker/C_Worker.uasset +++ b/Content/Enemy/Worker/C_Worker.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ef08405389490116c643ab10720e17c61301cacf4ba3bea32148ef53bb281fb8 -size 37740 +oid sha256:eec7e34d8b3c407673df8980dcad42104058ceb44c4e98812ba722e4f5713972 +size 38011 diff --git a/Content/Player/PlayerCharacter.uasset b/Content/Player/PlayerCharacter.uasset index e600a20..0ac2684 100644 --- a/Content/Player/PlayerCharacter.uasset +++ b/Content/Player/PlayerCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9b7a9f060fd6ff725513d3b3c26ca5e4a708e4cbadf7c4fdf3ab13a405ccee09 -size 44182 +oid sha256:4815bd57ad23afeb7f5864bd0c0bf0844a73939acb3acd7a6d6be20393fff0dd +size 44763 diff --git a/Source/Nakatomi/EnemyCharacter.cpp b/Source/Nakatomi/EnemyCharacter.cpp index 4a90cc3..41bf8bb 100644 --- a/Source/Nakatomi/EnemyCharacter.cpp +++ b/Source/Nakatomi/EnemyCharacter.cpp @@ -2,6 +2,7 @@ #include "EnemyCharacter.h" #include "EnemyAIController.h" +#include "InteractableComponent.h" #define COLLISION_WEAPON ECC_GameTraceChannel1 @@ -29,7 +30,7 @@ void AEnemyCharacter::OnFire() CurrentWeapon->PlayFireSoundAtLocation(GetActorLocation()); - // TODO: Play some animation here + PlayOnFireAnimations(); CurrentWeapon->SetCurrentWeaponStatus(Cooldown); @@ -50,6 +51,11 @@ void AEnemyCharacter::BeginPlay() Super::BeginPlay(); } +void AEnemyCharacter::PlayOnFireAnimations() +{ + Super::PlayOnFireAnimations(); +} + void AEnemyCharacter::CalculateHits(TArray* hits) { // Set up randomness diff --git a/Source/Nakatomi/EnemyCharacter.h b/Source/Nakatomi/EnemyCharacter.h index 4f32743..d998214 100644 --- a/Source/Nakatomi/EnemyCharacter.h +++ b/Source/Nakatomi/EnemyCharacter.h @@ -39,6 +39,8 @@ protected: virtual void BeginPlay() override; private: + virtual void PlayOnFireAnimations() override; + virtual void CalculateHits(TArray* hits) override; virtual void ProcessHits(TArray hits) override; diff --git a/Source/Nakatomi/NakatomiCharacter.cpp b/Source/Nakatomi/NakatomiCharacter.cpp index dd1ccb2..ec54fda 100644 --- a/Source/Nakatomi/NakatomiCharacter.cpp +++ b/Source/Nakatomi/NakatomiCharacter.cpp @@ -262,6 +262,14 @@ void ANakatomiCharacter::ProcessHits(TArray hits) { } +void ANakatomiCharacter::PlayOnFireAnimations() +{ + if (!GetCrouched()) + { + PlayAnimMontage(FireWeaponAnimMontage); + } +} + void ANakatomiCharacter::OnDamaged() { } diff --git a/Source/Nakatomi/NakatomiCharacter.h b/Source/Nakatomi/NakatomiCharacter.h index 7f0c531..648187c 100644 --- a/Source/Nakatomi/NakatomiCharacter.h +++ b/Source/Nakatomi/NakatomiCharacter.h @@ -39,6 +39,9 @@ public: UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) TArray> ThrowableInventory; + UPROPERTY(EditDefaultsOnly) + UAnimMontage* FireWeaponAnimMontage; + protected: UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Meta = (AllowPrivateAccess = "true")) UNakatomiCMC* NakatomiCMC; @@ -114,6 +117,8 @@ protected: virtual void ProcessHits(TArray hits); + virtual void PlayOnFireAnimations(); + UFUNCTION() virtual void OnDamaged(); diff --git a/Source/Nakatomi/PlayerCharacter.cpp b/Source/Nakatomi/PlayerCharacter.cpp index 84cf25a..5cdc4b0 100644 --- a/Source/Nakatomi/PlayerCharacter.cpp +++ b/Source/Nakatomi/PlayerCharacter.cpp @@ -440,6 +440,14 @@ void APlayerCharacter::ProcessHits(TArray hits) } } +void APlayerCharacter::PlayOnFireAnimations() +{ + if (!GetCrouched()) + { + PlayAnimMontage(IsADS ? FireWeaponADSAnimMontage : FireWeaponAnimMontage); + } +} + void APlayerCharacter::OnDamaged() { Super::OnDamaged(); @@ -631,7 +639,7 @@ void APlayerCharacter::OnFire() CurrentWeapon->PlayFireSoundAtLocation(this->GetTransform().GetLocation()); - // TODO: Play some animation here + PlayOnFireAnimations(); CurrentWeapon->SetCurrentWeaponStatus(Cooldown); diff --git a/Source/Nakatomi/PlayerCharacter.h b/Source/Nakatomi/PlayerCharacter.h index c9b0e3d..5e7f229 100644 --- a/Source/Nakatomi/PlayerCharacter.h +++ b/Source/Nakatomi/PlayerCharacter.h @@ -91,6 +91,9 @@ public: UPROPERTY(EditDefaultsOnly) TArray OnDamagedHitAnimMontages; + + UPROPERTY(EditDefaultsOnly) + UAnimMontage* FireWeaponADSAnimMontage; protected: UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) @@ -246,6 +249,8 @@ protected: virtual void CalculateHits(TArray* hits) override; virtual void ProcessHits(TArray hits) override; + + virtual void PlayOnFireAnimations() override; virtual void OnDamaged() override;