Merge remote-tracking branch 'origin/dev'

This commit is contained in:
Philip W 2024-05-14 12:49:03 +01:00
commit 2989ad0da6
10 changed files with 58 additions and 16 deletions

Binary file not shown.

View File

@ -55,4 +55,10 @@ public:
UPROPERTY()
TArray<TSubclassOf<AOpenWorldCheckpoint>> OpenWorldCheckpointsClassesSave;
UPROPERTY()
bool bPistolHasSupressor;
UPROPERTY()
bool bAssaultSupressor;
};

View File

@ -12,6 +12,8 @@
#include "EndlessVendetta/AI/EnemyCharacter.h"
#include <EndlessVendetta/EndlessVendettaGameMode.h>
#include "PistolClass.h"
#include "ShotgunClass.h"
#include "EndlessVendetta/BountySystem/ControlsTraining/TargetDummy.h"
#include "EndlessVendetta/Workbench&Attachments/ExtendedMagAttachmentClass.h"
#include "EndlessVendetta/Workbench&Attachments/GripAttachmentClass.h"
@ -49,8 +51,9 @@ void ABaseWeaponClass::BeginPlay()
if (!IsValid(endlessVendettaChar)) return;
for (UActorComponent* actorComp : playerInWorld->GetComponentsByTag(UArrowComponent::StaticClass(),
FName("GunStart")))
for (UActorComponent* actorComp : playerInWorld->GetComponentsByTag(UArrowComponent::StaticClass(),FName("GunStart")))
{
GunStartArrow = Cast<UArrowComponent>(actorComp);
break;
@ -60,6 +63,21 @@ void ABaseWeaponClass::BeginPlay()
{
playerControllerRef = UGameplayStatics::GetPlayerController(GetWorld(), 0);
}
UEVGameInstance* EV = Cast<UEVGameInstance>(GetGameInstance());
if (!IsValid(EV->MainSaveGameInstanceRef)) return;
if (IsA(APistolClass::StaticClass()) && EV->MainSaveGameInstanceRef->bPistolHasSupressor)
{
FTransform EmptyTransform = FTransform();
//auto Supressor = Cast<UStaticMesh>(GetWorld()->SpawnActor(SupressorMesh));
SetupSilencerAttachment(SupressorMesh);
}
else if (EV->MainSaveGameInstanceRef->bPistolHasSupressor)
{
FTransform EmptyTransform = FTransform();
//auto Supressor = Cast<UStaticMesh>(GetWorld()->SpawnActor(SupressorMesh));
SetupSilencerAttachment(SupressorMesh);
}
}
@ -324,6 +342,19 @@ void ABaseWeaponClass::SetupSilencerAttachment(UStaticMesh* SilencerMesh)
StaticMeshComp->CreationMethod = EComponentCreationMethod::Instance;
StaticMeshComp->RegisterComponent();
}
UEVGameInstance* EV = Cast<UEVGameInstance>(GetGameInstance());
if (!IsValid(EV->MainSaveGameInstanceRef)) return;
if (IsA(APistolClass::StaticClass()))
{
EV->MainSaveGameInstanceRef->bPistolHasSupressor = true;
UGameplayStatics::SaveGameToSlot(EV->MainSaveGameInstanceRef, "MainSave", 0);
}
else
{
EV->MainSaveGameInstanceRef->bAssaultSupressor = true;
UGameplayStatics::SaveGameToSlot(EV->MainSaveGameInstanceRef, "MainSave", 0);
}
}
}
}

View File

@ -23,6 +23,11 @@ public:
// Sets default values for this actor's properties
ABaseWeaponClass();
UPROPERTY(EditDefaultsOnly, Category = "Marcel")
UStaticMesh* SupressorMesh;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;