Added Gadgets to Save System
This commit is contained in:
parent
6b6492592b
commit
3c1ff4412d
@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:fefcf738250bf6a56a7db4d81597125201e4312a07f1c8e271bdc3f0a1a1e772
|
oid sha256:bf4779b18c437907cd404cdc3f0b34f086a1fd3a2fed88b6941a6b18993a00a5
|
||||||
size 3338717
|
size 3341693
|
||||||
|
BIN
EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset
(Stored with Git LFS)
Binary file not shown.
@ -759,6 +759,10 @@ void AEndlessVendettaCharacter::HoldInteract()
|
|||||||
ExitShip(GetActorTransform());
|
ExitShip(GetActorTransform());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GadgetManager->IsValidReconGadget() && GadgetManager->IsReconEquipped() && !GadgetManager->TryToUnequipRecon()) return;
|
||||||
|
if (GadgetManager->IsValidCombatGadget() && GadgetManager->IsCombatEquipped() && !GadgetManager->TryToUnequipCombat()) return;
|
||||||
|
|
||||||
FTransform TakeOffTransform = GetActorTransform();
|
FTransform TakeOffTransform = GetActorTransform();
|
||||||
FVector NewLoc = TakeOffTransform.GetLocation();
|
FVector NewLoc = TakeOffTransform.GetLocation();
|
||||||
NewLoc.Z += BikeRideHeight;
|
NewLoc.Z += BikeRideHeight;
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
|
|
||||||
#include "GadgetManager.h"
|
#include "GadgetManager.h"
|
||||||
|
|
||||||
|
#include "EndlessVendetta/EVGameInstance.h"
|
||||||
|
#include "Kismet/GameplayStatics.h"
|
||||||
|
|
||||||
// Sets default values
|
// Sets default values
|
||||||
AGadgetManager::AGadgetManager()
|
AGadgetManager::AGadgetManager()
|
||||||
{
|
{
|
||||||
@ -27,6 +30,12 @@ void AGadgetManager::Tick(float DeltaTime)
|
|||||||
|
|
||||||
void AGadgetManager::SpawnGadgetsOnBeginPlay(USceneComponent* PlayersCameraComponent)
|
void AGadgetManager::SpawnGadgetsOnBeginPlay(USceneComponent* PlayersCameraComponent)
|
||||||
{
|
{
|
||||||
|
UEVGameInstance* GI = Cast<UEVGameInstance>(GetGameInstance());
|
||||||
|
if (IsValid(GI->MainSaveGameInstanceRef))
|
||||||
|
{
|
||||||
|
ReconClass = GI->MainSaveGameInstanceRef->ReconClassSave;
|
||||||
|
CombatClass = GI->MainSaveGameInstanceRef->CombatClassSave;
|
||||||
|
}
|
||||||
if (IsValid(ReconClass)) SpawnGadget(ReconClass, PlayersCameraComponent);
|
if (IsValid(ReconClass)) SpawnGadget(ReconClass, PlayersCameraComponent);
|
||||||
if (IsValid(CombatClass)) SpawnGadget(CombatClass, PlayersCameraComponent);
|
if (IsValid(CombatClass)) SpawnGadget(CombatClass, PlayersCameraComponent);
|
||||||
}
|
}
|
||||||
@ -36,6 +45,8 @@ void AGadgetManager::SpawnGadget(TSubclassOf<AGadgetBase> GadgetClass, USceneCom
|
|||||||
FActorSpawnParameters SpawnParams;
|
FActorSpawnParameters SpawnParams;
|
||||||
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||||
const FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true);
|
const FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true);
|
||||||
|
UEVGameInstance* GI = Cast<UEVGameInstance>(GetGameInstance());
|
||||||
|
|
||||||
|
|
||||||
AActor* SpawnedActor = GetWorld()->SpawnActor<AActor>(GadgetClass, GetActorLocation(), GetActorRotation(), SpawnParams);
|
AActor* SpawnedActor = GetWorld()->SpawnActor<AActor>(GadgetClass, GetActorLocation(), GetActorRotation(), SpawnParams);
|
||||||
|
|
||||||
@ -43,14 +54,18 @@ void AGadgetManager::SpawnGadget(TSubclassOf<AGadgetBase> GadgetClass, USceneCom
|
|||||||
{
|
{
|
||||||
if (IsValid(ReconGadget)) ReconGadget->Destroy();
|
if (IsValid(ReconGadget)) ReconGadget->Destroy();
|
||||||
ReconGadget = Cast<AReconGadget>(SpawnedActor);
|
ReconGadget = Cast<AReconGadget>(SpawnedActor);
|
||||||
|
if (IsValid(GI->MainSaveGameInstanceRef)) GI->MainSaveGameInstanceRef->ReconClassSave = GadgetClass;
|
||||||
}
|
}
|
||||||
else if (SpawnedActor->IsA(ACombatGadget::StaticClass()))
|
else if (SpawnedActor->IsA(ACombatGadget::StaticClass()))
|
||||||
{
|
{
|
||||||
if (IsValid(CombatGadget)) CombatGadget->Destroy();
|
if (IsValid(CombatGadget)) CombatGadget->Destroy();
|
||||||
CombatGadget = Cast<ACombatGadget>(SpawnedActor);
|
CombatGadget = Cast<ACombatGadget>(SpawnedActor);
|
||||||
|
if (IsValid(GI->MainSaveGameInstanceRef)) GI->MainSaveGameInstanceRef->CombatClassSave = GadgetClass;
|
||||||
}
|
}
|
||||||
else UE_LOG(LogTemp, Fatal, TEXT("Passed sub class of gadget base is neither a combat or recon gadget, check the gadget class you're passing through or contact Rafal"));
|
else UE_LOG(LogTemp, Fatal, TEXT("Passed sub class of gadget base is neither a combat or recon gadget, check the gadget class you're passing through or contact Rafal"));
|
||||||
|
|
||||||
|
UGameplayStatics::SaveGameToSlot(GI->MainSaveGameInstanceRef, "MainSave", 0);
|
||||||
|
|
||||||
AGadgetBase* BaseGadget = Cast<AGadgetBase>(SpawnedActor);
|
AGadgetBase* BaseGadget = Cast<AGadgetBase>(SpawnedActor);
|
||||||
BaseGadget->AttachToComponent(PlayersCameraComponent, AttachmentRules);
|
BaseGadget->AttachToComponent(PlayersCameraComponent, AttachmentRules);
|
||||||
BaseGadget->SetActorRelativeLocation(BaseGadget->GetUnequippedOffset());
|
BaseGadget->SetActorRelativeLocation(BaseGadget->GetUnequippedOffset());
|
||||||
|
@ -40,4 +40,10 @@ public:
|
|||||||
|
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
TArray<TSubclassOf<ASideBountyClass>> SideBountiesToSpawnSave;
|
TArray<TSubclassOf<ASideBountyClass>> SideBountiesToSpawnSave;
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
TSubclassOf<AReconGadget> ReconClassSave;
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
TSubclassOf<ACombatGadget> CombatClassSave;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user