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 "GameFramework/CharacterMovementComponent.h"
|
||||
#include "the_twilight_abyss/MerchantInteraction/Interaction.h"
|
||||
#include <Runtime/Engine/Classes/Kismet/GameplayStatics.h>
|
||||
|
||||
|
||||
// CONSTRUCTOR
|
||||
@ -20,6 +21,7 @@ ATempCharacter::ATempCharacter()
|
||||
GoldBalance = GoldBalance;
|
||||
Health = Health;
|
||||
this->GetCharacterMovement()->GetNavAgentPropertiesRef().bCanCrouch = true;
|
||||
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
@ -29,6 +31,10 @@ void ATempCharacter::BeginPlay()
|
||||
Health = 100;
|
||||
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
|
||||
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
|
||||
@ -48,10 +54,12 @@ void ATempCharacter::Sneak()
|
||||
if (bIsCrouched)
|
||||
{
|
||||
UnCrouch();
|
||||
PostProcessVolume->Settings.VignetteIntensity = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
Crouch();
|
||||
PostProcessVolume->Settings.VignetteIntensity = 0.8f;
|
||||
}
|
||||
|
||||
}
|
||||
@ -183,7 +191,6 @@ void ATempCharacter::InputDisabler()
|
||||
OriginalCameraLocation = ThisCamera->GetComponentLocation();
|
||||
OriginalCameraRotation = ThisCamera->GetComponentRotation();
|
||||
OriginalCameraFOV = ThisCamera->FieldOfView;
|
||||
//ulog the originalcameralocation value
|
||||
UE_LOG(LogTemp, Display, TEXT("Original Camera Location: %s"), *OriginalCameraLocation.ToString());
|
||||
}
|
||||
}
|
||||
@ -212,7 +219,6 @@ void ATempCharacter::InputEnabler()
|
||||
ThisCamera->SetWorldLocation(OriginalCameraLocation);
|
||||
ThisCamera->SetWorldRotation(OriginalCameraRotation);
|
||||
ThisCamera->FieldOfView = OriginalCameraFOV;
|
||||
//ulog the originalcameralocation value
|
||||
UE_LOG(LogTemp, Display, TEXT("Original Camera Location: %s"), *OriginalCameraLocation.ToString());
|
||||
}
|
||||
}
|
||||
@ -222,7 +228,7 @@ void ATempCharacter::UseItem(class UBaseItem* Item)
|
||||
if(Item)
|
||||
{
|
||||
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 "Camera/CameraComponent.h"
|
||||
#include "Kismet/KismetMathLibrary.h"
|
||||
#include "Engine/PostProcessVolume.h"
|
||||
#include "TempCharacter.generated.h"
|
||||
|
||||
UCLASS()
|
||||
@ -87,5 +88,5 @@ public:
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
bool disableTab = false;
|
||||
|
||||
|
||||
APostProcessVolume* PostProcessVolume;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user