diff --git a/Content/Blueprints/Display_UI/WBP_Health.uasset b/Content/Blueprints/Display_UI/WBP_Health.uasset deleted file mode 100644 index 6d8ecc5..0000000 --- a/Content/Blueprints/Display_UI/WBP_Health.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:91f6f6a94de73f379df0167a9b2eaa6ff85dcefc020cd565f965d2003f31b389 -size 28963 diff --git a/Content/Blueprints/Player/BP_MyTempCharacter.uasset b/Content/Blueprints/Player/BP_MyTempCharacter.uasset index 3667ddf..450ac00 100644 --- a/Content/Blueprints/Player/BP_MyTempCharacter.uasset +++ b/Content/Blueprints/Player/BP_MyTempCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2a39b15f6e64703046d9cb9b437b04838acc10eb1f1465c94bd6d8b2c4395ed -size 55131 +oid sha256:a4556a6513b22a1171ff6da3cafd1c299282ca69777c492a5e263986a2f6fa89 +size 67253 diff --git a/Content/Levels/Top_layer_level.umap b/Content/Levels/Top_layer_level.umap index aa9063c..d032626 100644 --- a/Content/Levels/Top_layer_level.umap +++ b/Content/Levels/Top_layer_level.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b669fa5c78fb0e7924a4d8bd4e64f6764e093f9ac5a0a8575342fadb5d45fa47 -size 245297 +oid sha256:78fd1f0edde927e0417a321f0793839eb5532a2ef0e1111c3249caf7060c2b84 +size 245091 diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index 4cd5c2c..db50ee0 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -8,6 +8,8 @@ #include "GameFramework/CharacterMovementComponent.h" #include "the_twilight_abyss/MerchantInteraction/Interaction.h" #include + +#include "Components/PawnNoiseEmitterComponent.h" #include "Components/SphereComponent.h" #include "Kismet/KismetMathLibrary.h" @@ -19,8 +21,6 @@ ATempCharacter::ATempCharacter() PrimaryActorTick.bCanEverTick = true; Inventory = CreateDefaultSubobject("Inventory"); Inventory->MaxItemSlots = 10; - GoldBalance = GoldBalance; - Health = Health; this->GetCharacterMovement()->GetNavAgentPropertiesRef().bCanCrouch = true; } @@ -32,30 +32,34 @@ void ATempCharacter::BeginPlay() ThisCamera = Cast(this->FindComponentByClass()); PlayerCapsule = GetCapsuleComponent(); TArray AllActorsInScene; - //MAKE SURE POST PROCESSING IS IN THE SCENE OR GAME WILL CRASH UGameplayStatics::GetAllActorsOfClass(GetWorld(), APostProcessVolume::StaticClass(), AllActorsInScene); if (ensureMsgf(AllActorsInScene.Num() > 0, TEXT("No Post Processing Volume in scene"))) { PostProcessVolume = Cast(AllActorsInScene[0]); } - Enemy = TEXT("Enemy"); UGameplayStatics::GetAllActorsWithTag(GetWorld(), Enemy, AIActors); - Ammo = TEXT("Ammo"); + NoiseEmitter = Cast(this->FindComponentByClass(UPawnNoiseEmitterComponent::StaticClass())); + if (NoiseEmitter) + { + UE_LOG(LogTemp, Display, TEXT("Noise Emitter found")); + } } //Binds the input we made in the setup player component to the forward vector void ATempCharacter::ForwardInput(float Axis) { AddMovementInput(UKismetMathLibrary::GetForwardVector(FRotator(0, GetControlRotation().Yaw, 0)) * Axis); + if (isInStealth == false) MakeNoise(1.0f, this, GetActorLocation(), 1200.0f); } //Binds the input we made in the setup player component to the right vector void ATempCharacter::RightMoveInput(float Axis) { AddMovementInput(UKismetMathLibrary::GetRightVector(FRotator(0, GetControlRotation().Yaw, 0)) * Axis); + if (isInStealth == false) MakeNoise(1.0f, this, GetActorLocation(), 1200.0f); } void ATempCharacter::Sneak() @@ -64,6 +68,7 @@ void ATempCharacter::Sneak() if (bIsCrouched) { UnCrouch(); + isInStealth = false; if (PostProcessVolume != nullptr) PostProcessVolume->Settings.VignetteIntensity = 0.0f; for (AActor* Actor : AIActors) { @@ -77,12 +82,13 @@ void ATempCharacter::Sneak() else { Crouch(); + isInStealth = true; for (AActor* Actor : AIActors) { USphereComponent* SphereComponent = Actor->FindComponentByClass(); if (SphereComponent != nullptr) { - SphereComponent->SetSphereRadius(15.0f); + SphereComponent->SetSphereRadius(5.0f); } } if (PostProcessVolume != nullptr) PostProcessVolume->Settings.VignetteIntensity = 0.8f; diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h index f9d57fb..961cb21 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h @@ -52,8 +52,9 @@ public: void InputDisabler(); void LineTraceLogic(); + UPROPERTY() + class UPawnNoiseEmitterComponent* NoiseEmitter; - UPROPERTY(BlueprintReadWrite, EditAnywhere, Category= "Health") float Health; @@ -97,4 +98,6 @@ public: UPROPERTY(BlueprintReadWrite) float ReactionSpeed = 100.0f; + + bool isInStealth = false; };