From ce4f3aff1f88b0aaa5a9ff83f76fbc04e2c95404 Mon Sep 17 00:00:00 2001 From: MARCEL HARA Date: Thu, 23 Feb 2023 16:03:10 +0000 Subject: [PATCH] Added SneakMechanicTesting level Added new level for sneak mechanic testing --- .../BlueprintAI/AI/AIControllerBruh.uasset | 4 ++-- .../Levels/Testing/SneakMechanicTesting.umap | 3 +++ .../PlayerTemp/TempCharacter.cpp | 22 ++++++++----------- 3 files changed, 14 insertions(+), 15 deletions(-) create mode 100644 Content/Levels/Testing/SneakMechanicTesting.umap diff --git a/Content/BlueprintAI/AI/AIControllerBruh.uasset b/Content/BlueprintAI/AI/AIControllerBruh.uasset index 80d88e1..9737754 100644 --- a/Content/BlueprintAI/AI/AIControllerBruh.uasset +++ b/Content/BlueprintAI/AI/AIControllerBruh.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b3bf037902c2aa1ed7ada853c5c16a27b948ee58bab4fec7dfc395a7003cd94c -size 97758 +oid sha256:c5fd648c575abc38b53e4d6f99f64a879b19c0672c2fa6a97e77cea008fad1dd +size 98856 diff --git a/Content/Levels/Testing/SneakMechanicTesting.umap b/Content/Levels/Testing/SneakMechanicTesting.umap new file mode 100644 index 0000000..e2cea40 --- /dev/null +++ b/Content/Levels/Testing/SneakMechanicTesting.umap @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d44e1d44549e6cd4deb70fd46d4a804ad1ca3081b495b51f9258da3d741d6ab6 +size 36264 diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index 4fb59cd..3b8e8c0 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -36,11 +36,13 @@ void ATempCharacter::BeginPlay() //MAKE SURE POST PROCESSING IS IN THE SCENE OR GAME WILL CRASH UGameplayStatics::GetAllActorsOfClass(GetWorld(), APostProcessVolume::StaticClass(), AllActorsInScene); - PostProcessVolume = Cast(AllActorsInScene[0]); - Enemy = TEXT("Enemy"); UGameplayStatics::GetAllActorsWithTag(GetWorld(), Enemy, AIActors); - + //stops crashing + if (ensureMsgf(AllActorsInScene.Num() > 0, TEXT("No Post Processing Volume in scene"))) + { + PostProcessVolume = Cast(AllActorsInScene[0]); + } Ammo = TEXT("Ammo"); } @@ -61,14 +63,11 @@ void ATempCharacter::Sneak() if (bIsCrouched) { UnCrouch(); - PostProcessVolume->Settings.VignetteIntensity = 0.0f; + if (PostProcessVolume != nullptr) PostProcessVolume->Settings.VignetteIntensity = 0.0f; for (AActor* Actor : AIActors) { USphereComponent* SphereComponent = Actor->FindComponentByClass(); - if (SphereComponent != nullptr) - { - SphereComponent->SetSphereRadius(40.0f); //default value - } + if (SphereComponent != nullptr) SphereComponent->SetSphereRadius(40.0f); //default value } } else @@ -77,12 +76,9 @@ void ATempCharacter::Sneak() for (AActor* Actor : AIActors) { USphereComponent* SphereComponent = Actor->FindComponentByClass(); - if (SphereComponent != nullptr) - { - SphereComponent->SetSphereRadius(15.0f); - } + if (SphereComponent != nullptr) SphereComponent->SetSphereRadius(15.0f); } - PostProcessVolume->Settings.VignetteIntensity = 0.8f; + if (PostProcessVolume != nullptr) PostProcessVolume->Settings.VignetteIntensity = 0.8f; } }