Added Supressor to Save System
This commit is contained in:
		
							parent
							
								
									d003fa5bfd
								
							
						
					
					
						commit
						82de8bea7d
					
				
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								EndlessVendetta/Content/Levels/TempLevels/NewTutorialMap.umap
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								EndlessVendetta/Content/Levels/TempLevels/NewTutorialMap.umap
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											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/Materials/M_Concrete_Poured.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								EndlessVendetta/Content/StarterContent/Materials/M_Concrete_Poured.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								EndlessVendetta/Content/StarterContent/Materials/M_Rock_Sandstone.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								EndlessVendetta/Content/StarterContent/Materials/M_Rock_Sandstone.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.
										
									
								
							| @ -55,4 +55,10 @@ public: | ||||
| 
 | ||||
| 	UPROPERTY() | ||||
| 	TArray<TSubclassOf<AOpenWorldCheckpoint>> OpenWorldCheckpointsClassesSave; | ||||
| 
 | ||||
| 	UPROPERTY() | ||||
| 	bool bPistolHasSupressor; | ||||
| 
 | ||||
| 	UPROPERTY() | ||||
| 	bool bAssaultSupressor; | ||||
| }; | ||||
|  | ||||
| @ -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); | ||||
| 			} | ||||
| 			 | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user