diff --git a/EndlessVendetta/Content/Levels/OpenWorldRework.umap b/EndlessVendetta/Content/Levels/OpenWorldRework.umap index f110ac57..121a3715 100644 --- a/EndlessVendetta/Content/Levels/OpenWorldRework.umap +++ b/EndlessVendetta/Content/Levels/OpenWorldRework.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d1fe8753cbf4cb8d4ccdbde7885427e393a412d7fe9d39e79a1d7c7c3796a8ca +oid sha256:9e59392db5fd5045bcfe2fb2139c9e339553b58188bdbc99c924d491a0605798 size 46806902 diff --git a/EndlessVendetta/Content/NPC/BP_NPC_Manager.uasset b/EndlessVendetta/Content/NPC/BP_NPC_Manager.uasset index 9eb6279f..65f6cfaf 100644 --- a/EndlessVendetta/Content/NPC/BP_NPC_Manager.uasset +++ b/EndlessVendetta/Content/NPC/BP_NPC_Manager.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7d3227179ef89b449bb02c5689f2f7fe83b18556ed8cf7aa0e4c58f0ed084683 -size 26278 +oid sha256:77d4780ef0539e816895024e6968ff8e5585607f4736bc541f86a29e590f416f +size 29343 diff --git a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset index c2a34afc..27021c8e 100644 --- a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset +++ b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c0ecf0ac0702cc2bd355ec050232a61c49e10f102448efbeb735a51824adef6 -size 14948 +oid sha256:0dce59d8261130a8962f5139df862d78a2fcf02623b0766915a6a30bd39b26ec +size 14831 diff --git a/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset b/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset index 23ab79b7..c5c3b84e 100644 --- a/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset +++ b/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:42f0c52e2c4c7389d520930da00589a206b1c5715de6903eff24277a3bd64e96 -size 43745 +oid sha256:4a60a29ad596546d481e43dfb8698842a78cc07f4a4b1000fa397cfba4e72331 +size 158206 diff --git a/EndlessVendetta/Source/EndlessVendetta/NPC/NPC_Manager.cpp b/EndlessVendetta/Source/EndlessVendetta/NPC/NPC_Manager.cpp index 57484afe..c37402b6 100644 --- a/EndlessVendetta/Source/EndlessVendetta/NPC/NPC_Manager.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/NPC/NPC_Manager.cpp @@ -43,6 +43,9 @@ void ANPC_Manager::SpawnNPC_Walkers() FRotator Rot = WalkersSpawnTransform.GetRotation().Rotator(); ANPC_WalkerClass* SpawnedWalker = GetWorld()->SpawnActor(NPC_Walker, Loc, Rot); NPC_Walkers.Add(SpawnedWalker); + if (VoiceLinesCollection.IsEmpty()) continue; + int i = FMath::RandRange(0, VoiceLinesCollection.Num() - 1); + SpawnedWalker->SetVoiceline(VoiceLinesCollection[i]); } } diff --git a/EndlessVendetta/Source/EndlessVendetta/NPC/NPC_Manager.h b/EndlessVendetta/Source/EndlessVendetta/NPC/NPC_Manager.h index baf6036b..8cd00f46 100644 --- a/EndlessVendetta/Source/EndlessVendetta/NPC/NPC_Manager.h +++ b/EndlessVendetta/Source/EndlessVendetta/NPC/NPC_Manager.h @@ -8,6 +8,7 @@ #include "GameFramework/Actor.h" #include "NPC_Manager.generated.h" + UCLASS() class ENDLESSVENDETTA_API ANPC_Manager : public AActor { @@ -48,6 +49,10 @@ protected: // Spawn points for NPC Stations UPROPERTY(EditAnywhere, Category = "NPC", meta = (MakeEditWidget = "true")) TArray StationPoints; + + // VoiceLines used for randomly distributing amongst walking NPCs + UPROPERTY(EditDefaultsOnly, Category = "NPC") + TArray VoiceLinesCollection; // Called when the game starts or when spawned virtual void BeginPlay() override; diff --git a/EndlessVendetta/Source/EndlessVendetta/NPC/NPC_WalkerClass.cpp b/EndlessVendetta/Source/EndlessVendetta/NPC/NPC_WalkerClass.cpp index 085a6bc4..22f756fe 100644 --- a/EndlessVendetta/Source/EndlessVendetta/NPC/NPC_WalkerClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/NPC/NPC_WalkerClass.cpp @@ -3,6 +3,8 @@ #include "NPC_WalkerClass.h" +#include "Components/AudioComponent.h" + // Sets default values ANPC_WalkerClass::ANPC_WalkerClass() { @@ -33,5 +35,16 @@ void ANPC_WalkerClass::DisableNPC() bIsEnabled = false; } +void ANPC_WalkerClass::Interact() +{ + if (VoiceLines.IsEmpty()) return; + UAudioComponent* Audio = Cast(GetComponentByClass(UAudioComponent::StaticClass()));; + if (!IsValid(Audio)) return; + int i = FMath::RandRange(0, VoiceLines.Num() - 1); + if (!IsValid(VoiceLines[i])) return; + Audio->Sound = VoiceLines[i]; + Audio->Play(); +} + diff --git a/EndlessVendetta/Source/EndlessVendetta/NPC/NPC_WalkerClass.h b/EndlessVendetta/Source/EndlessVendetta/NPC/NPC_WalkerClass.h index ef58edde..a21cb415 100644 --- a/EndlessVendetta/Source/EndlessVendetta/NPC/NPC_WalkerClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/NPC/NPC_WalkerClass.h @@ -3,17 +3,20 @@ #pragma once #include "CoreMinimal.h" +#include "VoicelinesStruct.h" +#include "EndlessVendetta/InteractionInterface.h" #include "GameFramework/Character.h" #include "NPC_WalkerClass.generated.h" UCLASS() -class ENDLESSVENDETTA_API ANPC_WalkerClass : public ACharacter +class ENDLESSVENDETTA_API ANPC_WalkerClass : public ACharacter, public IInteractionInterface { GENERATED_BODY() int WalkingSpotIndex = 0; int Polarity = 1; bool bIsEnabled = true; + TArray VoiceLines; protected: UPROPERTY(EditAnywhere, Category = "NPC", meta = (MakeEditWidget = "true")) @@ -33,4 +36,11 @@ public: void DisableNPC(); + void SetVoiceline(FVoiceLines VL) + { + VoiceLines = VL.Voices; + } + + void Interact() override; + }; diff --git a/EndlessVendetta/Source/EndlessVendetta/NPC/VoicelinesStruct.cpp b/EndlessVendetta/Source/EndlessVendetta/NPC/VoicelinesStruct.cpp new file mode 100644 index 00000000..baff825d --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/NPC/VoicelinesStruct.cpp @@ -0,0 +1 @@ +#include "VoicelinesStruct.h" diff --git a/EndlessVendetta/Source/EndlessVendetta/NPC/VoicelinesStruct.h b/EndlessVendetta/Source/EndlessVendetta/NPC/VoicelinesStruct.h new file mode 100644 index 00000000..ad087378 --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/NPC/VoicelinesStruct.h @@ -0,0 +1,12 @@ +#pragma once + +#include "VoicelinesStruct.generated.h" + +USTRUCT(BlueprintType) +struct FVoiceLines +{ + GENERATED_BODY(); + + UPROPERTY(EditAnywhere, Category = "NPC") + TArray Voices; +}; \ No newline at end of file