Updated TempCharacter for sneaking vignette effect
Added a Vignette effect when crouching
This commit is contained in:
		
							parent
							
								
									5b4da1f02e
								
							
						
					
					
						commit
						36c18382a2
					
				
							
								
								
									
										
											BIN
										
									
								
								Content/Levels/Top_layer_level.umap
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Levels/Top_layer_level.umap
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							@ -8,6 +8,7 @@
 | 
				
			|||||||
#include "Components/CapsuleComponent.h"
 | 
					#include "Components/CapsuleComponent.h"
 | 
				
			||||||
#include "GameFramework/CharacterMovementComponent.h"
 | 
					#include "GameFramework/CharacterMovementComponent.h"
 | 
				
			||||||
#include "the_twilight_abyss/MerchantInteraction/Interaction.h"
 | 
					#include "the_twilight_abyss/MerchantInteraction/Interaction.h"
 | 
				
			||||||
 | 
					#include <Runtime/Engine/Classes/Kismet/GameplayStatics.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// CONSTRUCTOR
 | 
					// CONSTRUCTOR
 | 
				
			||||||
@ -20,6 +21,7 @@ ATempCharacter::ATempCharacter()
 | 
				
			|||||||
	GoldBalance = GoldBalance;
 | 
						GoldBalance = GoldBalance;
 | 
				
			||||||
	Health = Health;
 | 
						Health = Health;
 | 
				
			||||||
	this->GetCharacterMovement()->GetNavAgentPropertiesRef().bCanCrouch = true;
 | 
						this->GetCharacterMovement()->GetNavAgentPropertiesRef().bCanCrouch = true;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Called when the game starts or when spawned
 | 
					// Called when the game starts or when spawned
 | 
				
			||||||
@ -29,6 +31,10 @@ void ATempCharacter::BeginPlay()
 | 
				
			|||||||
	Health = 100;
 | 
						Health = 100;
 | 
				
			||||||
	ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
 | 
						ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
 | 
				
			||||||
	PlayerCapsule = GetCapsuleComponent();
 | 
						PlayerCapsule = GetCapsuleComponent();
 | 
				
			||||||
 | 
						TArray<AActor*> AllActorsInScene;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						UGameplayStatics::GetAllActorsOfClass(GetWorld(), APostProcessVolume::StaticClass(), AllActorsInScene);
 | 
				
			||||||
 | 
						PostProcessVolume = Cast<APostProcessVolume>(AllActorsInScene[0]);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//Binds the input we made in the setup player component to the forward vector
 | 
					//Binds the input we made in the setup player component to the forward vector
 | 
				
			||||||
@ -48,10 +54,12 @@ void ATempCharacter::Sneak()
 | 
				
			|||||||
	if (bIsCrouched)
 | 
						if (bIsCrouched)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		UnCrouch();
 | 
							UnCrouch();
 | 
				
			||||||
 | 
							PostProcessVolume->Settings.VignetteIntensity = 0.0f;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		Crouch();
 | 
							Crouch();
 | 
				
			||||||
 | 
							PostProcessVolume->Settings.VignetteIntensity = 0.8f;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -183,7 +191,6 @@ void ATempCharacter::InputDisabler()
 | 
				
			|||||||
		OriginalCameraLocation = ThisCamera->GetComponentLocation();
 | 
							OriginalCameraLocation = ThisCamera->GetComponentLocation();
 | 
				
			||||||
		OriginalCameraRotation = ThisCamera->GetComponentRotation();
 | 
							OriginalCameraRotation = ThisCamera->GetComponentRotation();
 | 
				
			||||||
		OriginalCameraFOV = ThisCamera->FieldOfView;
 | 
							OriginalCameraFOV = ThisCamera->FieldOfView;
 | 
				
			||||||
		//ulog the originalcameralocation value
 | 
					 | 
				
			||||||
		UE_LOG(LogTemp, Display, TEXT("Original Camera Location: %s"), *OriginalCameraLocation.ToString());
 | 
							UE_LOG(LogTemp, Display, TEXT("Original Camera Location: %s"), *OriginalCameraLocation.ToString());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -212,7 +219,6 @@ void ATempCharacter::InputEnabler()
 | 
				
			|||||||
		ThisCamera->SetWorldLocation(OriginalCameraLocation);
 | 
							ThisCamera->SetWorldLocation(OriginalCameraLocation);
 | 
				
			||||||
		ThisCamera->SetWorldRotation(OriginalCameraRotation);
 | 
							ThisCamera->SetWorldRotation(OriginalCameraRotation);
 | 
				
			||||||
		ThisCamera->FieldOfView = OriginalCameraFOV;
 | 
							ThisCamera->FieldOfView = OriginalCameraFOV;
 | 
				
			||||||
		//ulog the originalcameralocation value
 | 
					 | 
				
			||||||
		UE_LOG(LogTemp, Display, TEXT("Original Camera Location: %s"), *OriginalCameraLocation.ToString());
 | 
							UE_LOG(LogTemp, Display, TEXT("Original Camera Location: %s"), *OriginalCameraLocation.ToString());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -222,7 +228,7 @@ void ATempCharacter::UseItem(class UBaseItem* Item)
 | 
				
			|||||||
	if(Item)
 | 
						if(Item)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		Item->Use(this);
 | 
							Item->Use(this);
 | 
				
			||||||
		Item->OnUse(this); //Blueprint Version
 | 
							Item->OnUse(this); //OnUse is a Blueprint Version
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -7,6 +7,7 @@
 | 
				
			|||||||
#include "the_twilight_abyss/BaseItems/Items/BaseItem.h"
 | 
					#include "the_twilight_abyss/BaseItems/Items/BaseItem.h"
 | 
				
			||||||
#include "Camera/CameraComponent.h"
 | 
					#include "Camera/CameraComponent.h"
 | 
				
			||||||
#include "Kismet/KismetMathLibrary.h"
 | 
					#include "Kismet/KismetMathLibrary.h"
 | 
				
			||||||
 | 
					#include "Engine/PostProcessVolume.h"
 | 
				
			||||||
#include "TempCharacter.generated.h"
 | 
					#include "TempCharacter.generated.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
UCLASS()
 | 
					UCLASS()
 | 
				
			||||||
@ -87,5 +88,5 @@ public:
 | 
				
			|||||||
	UPROPERTY(BlueprintReadWrite)
 | 
						UPROPERTY(BlueprintReadWrite)
 | 
				
			||||||
	bool disableTab = false;
 | 
						bool disableTab = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
						APostProcessVolume* PostProcessVolume;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user