Play Fire animation during OnFire
This commit is contained in:
		
							parent
							
								
									0644a807ba
								
							
						
					
					
						commit
						e26b66b7aa
					
				
							
								
								
									
										
											BIN
										
									
								
								Content/Animations/AnimStarterPack/AM/Fire_Rifle_Hip_Montage.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Animations/AnimStarterPack/AM/Fire_Rifle_Hip_Montage.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Content/Animations/AnimStarterPack/AM/Fire_Rifle_Ironsights_Montage.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Animations/AnimStarterPack/AM/Fire_Rifle_Ironsights_Montage.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Content/Enemy/Worker/C_Worker.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Enemy/Worker/C_Worker.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Content/Player/PlayerCharacter.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Player/PlayerCharacter.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -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<FHitResult>* hits) | ||||
| { | ||||
| 	// Set up randomness
 | ||||
|  | ||||
| @ -39,6 +39,8 @@ protected: | ||||
| 	virtual void BeginPlay() override; | ||||
| 
 | ||||
| private: | ||||
| 	virtual void PlayOnFireAnimations() override; | ||||
| 	 | ||||
| 	virtual void CalculateHits(TArray<FHitResult>* hits) override; | ||||
| 
 | ||||
| 	virtual void ProcessHits(TArray<FHitResult> hits) override; | ||||
|  | ||||
| @ -262,6 +262,14 @@ void ANakatomiCharacter::ProcessHits(TArray<FHitResult> hits) | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ANakatomiCharacter::PlayOnFireAnimations() | ||||
| { | ||||
| 	if (!GetCrouched()) | ||||
| 	{ | ||||
| 		PlayAnimMontage(FireWeaponAnimMontage); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void ANakatomiCharacter::OnDamaged() | ||||
| { | ||||
| } | ||||
|  | ||||
| @ -39,6 +39,9 @@ public: | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TArray<TSubclassOf<AThrowable>> ThrowableInventory; | ||||
| 
 | ||||
| 	UPROPERTY(EditDefaultsOnly) | ||||
| 	UAnimMontage* FireWeaponAnimMontage; | ||||
| 
 | ||||
| protected: | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Meta = (AllowPrivateAccess = "true")) | ||||
| 	UNakatomiCMC* NakatomiCMC; | ||||
| @ -114,6 +117,8 @@ protected: | ||||
| 
 | ||||
| 	virtual void ProcessHits(TArray<FHitResult> hits); | ||||
| 
 | ||||
| 	virtual void PlayOnFireAnimations();  | ||||
| 	 | ||||
| 	UFUNCTION() | ||||
| 	virtual void OnDamaged(); | ||||
| 
 | ||||
|  | ||||
| @ -440,6 +440,14 @@ void APlayerCharacter::ProcessHits(TArray<FHitResult> 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); | ||||
| 
 | ||||
|  | ||||
| @ -91,6 +91,9 @@ public: | ||||
| 
 | ||||
| 	UPROPERTY(EditDefaultsOnly) | ||||
| 	TArray<UAnimMontage*> OnDamagedHitAnimMontages; | ||||
| 	 | ||||
| 	UPROPERTY(EditDefaultsOnly) | ||||
| 	UAnimMontage* FireWeaponADSAnimMontage; | ||||
| 
 | ||||
| protected: | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| @ -246,6 +249,8 @@ protected: | ||||
| 	virtual void CalculateHits(TArray<FHitResult>* hits) override; | ||||
| 
 | ||||
| 	virtual void ProcessHits(TArray<FHitResult> hits) override; | ||||
| 
 | ||||
| 	virtual void PlayOnFireAnimations() override; | ||||
| 	 | ||||
| 	virtual void OnDamaged() override; | ||||
| 	 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user