Add random pickups
This commit is contained in:
		
							parent
							
								
									af60880d17
								
							
						
					
					
						commit
						c50d32c3bd
					
				
							
								
								
									
										
											BIN
										
									
								
								Content/Enemy/DA_Enemy.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Enemy/DA_Enemy.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Content/Materials/M_EXPGlow.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Materials/M_EXPGlow.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Content/Materials/M_EXPGlowBlue.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Materials/M_EXPGlowBlue.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Content/Materials/M_EXPGlowGreen.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Materials/M_EXPGlowGreen.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Content/Materials/M_EXPGlowRed.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Materials/M_EXPGlowRed.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Content/Meshes/SM_EXP.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Meshes/SM_EXP.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Content/Meshes/SM_EXPBlue.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Meshes/SM_EXPBlue.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Content/Meshes/SM_EXPGreen.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Meshes/SM_EXPGreen.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Content/Meshes/SM_EXPRed.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Meshes/SM_EXPRed.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Content/Pickups/EXP/DA_BlueEXPPickup.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Pickups/EXP/DA_BlueEXPPickup.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Content/Pickups/EXP/DA_GreenEXPPickup.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Pickups/EXP/DA_GreenEXPPickup.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Content/Pickups/EXP/DA_RedEXPPickup.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Pickups/EXP/DA_RedEXPPickup.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -62,7 +62,7 @@ void AEnemyCharacter::OnDamaged(FDamageInfo DamageInfo) | |||||||
| 
 | 
 | ||||||
| void AEnemyCharacter::OnDeath(FDamageInfo DamageInfo) | void AEnemyCharacter::OnDeath(FDamageInfo DamageInfo) | ||||||
| { | { | ||||||
| 	if (PickupTemplate) | 	if (PickupArray.Num() > 0) | ||||||
| 	{ | 	{ | ||||||
| 		AGameModeBase* Gamemode = UGameplayStatics::GetGameMode(GetWorld()); | 		AGameModeBase* Gamemode = UGameplayStatics::GetGameMode(GetWorld()); | ||||||
| 		if (UKismetSystemLibrary::DoesImplementInterface(Gamemode, UPools::StaticClass())) | 		if (UKismetSystemLibrary::DoesImplementInterface(Gamemode, UPools::StaticClass())) | ||||||
| @ -75,7 +75,20 @@ void AEnemyCharacter::OnDeath(FDamageInfo DamageInfo) | |||||||
| 				{ | 				{ | ||||||
| 					FVector PickupLocation = GetActorLocation(); | 					FVector PickupLocation = GetActorLocation(); | ||||||
| 					Pickup->SetActorLocation(PickupLocation); | 					Pickup->SetActorLocation(PickupLocation); | ||||||
| 					IPickupable::Execute_LoadDataFromDataAsset(Pickup, PickupTemplate, PickupLocation); | 
 | ||||||
|  | 					int32 Rand = FMath::Rand() % 100; | ||||||
|  | 					if (Rand < 60 && PickupArray[0]) | ||||||
|  | 					{ | ||||||
|  | 						IPickupable::Execute_LoadDataFromDataAsset(Pickup, PickupArray[0], PickupLocation); | ||||||
|  | 					} | ||||||
|  | 					else if (Rand < 90 && PickupArray[1]) | ||||||
|  | 					{ | ||||||
|  | 						IPickupable::Execute_LoadDataFromDataAsset(Pickup, PickupArray[1], PickupLocation); | ||||||
|  | 					} | ||||||
|  | 					else if (PickupArray[2]) | ||||||
|  | 					{ | ||||||
|  | 						IPickupable::Execute_LoadDataFromDataAsset(Pickup, PickupArray[2], PickupLocation); | ||||||
|  | 					} | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| @ -98,11 +111,14 @@ void AEnemyCharacter::LoadDataFromDataAsset_Implementation(UEnemyDataAsset* Enem | |||||||
| 	{ | 	{ | ||||||
| 		StaticMeshComponent->SetStaticMesh(EnemyDataAsset->StaticMesh); | 		StaticMeshComponent->SetStaticMesh(EnemyDataAsset->StaticMesh); | ||||||
| 		BehaviorTree = EnemyDataAsset->BehaviorTree; | 		BehaviorTree = EnemyDataAsset->BehaviorTree; | ||||||
| 		PickupTemplate = EnemyDataAsset->PickupDataAsset; |  | ||||||
| 		OnDamagedSound = EnemyDataAsset->OnDamagedSoundBase; | 		OnDamagedSound = EnemyDataAsset->OnDamagedSoundBase; | ||||||
| 		OnDeathSound = EnemyDataAsset->OnDeathSoundBase; | 		OnDeathSound = EnemyDataAsset->OnDeathSoundBase; | ||||||
| 		OnDamagedNiagaraSystem = EnemyDataAsset->OnDamagedNiagaraSystem; | 		OnDamagedNiagaraSystem = EnemyDataAsset->OnDamagedNiagaraSystem; | ||||||
| 		OnDeathNiagaraSystem = EnemyDataAsset->OnDeathNiagaraSystem; | 		OnDeathNiagaraSystem = EnemyDataAsset->OnDeathNiagaraSystem; | ||||||
|  | 
 | ||||||
|  | 		PickupArray.Add(EnemyDataAsset->CommonPickupDataAsset); | ||||||
|  | 		PickupArray.Add(EnemyDataAsset->UncommonPickupDataAsset); | ||||||
|  | 		PickupArray.Add(EnemyDataAsset->RarePickupDataAsset); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -110,7 +126,7 @@ void AEnemyCharacter::ResetData_Implementation() | |||||||
| { | { | ||||||
| 	StaticMeshComponent->SetStaticMesh(nullptr); | 	StaticMeshComponent->SetStaticMesh(nullptr); | ||||||
| 	BehaviorTree = nullptr; | 	BehaviorTree = nullptr; | ||||||
| 	PickupTemplate = nullptr; | 	PickupArray.Empty(); | ||||||
| 	OnDamagedSound = nullptr; | 	OnDamagedSound = nullptr; | ||||||
| 	OnDeathSound = nullptr; | 	OnDeathSound = nullptr; | ||||||
| 	OnDamagedNiagaraSystem = nullptr; | 	OnDamagedNiagaraSystem = nullptr; | ||||||
|  | |||||||
| @ -42,7 +42,7 @@ private: | |||||||
| 	TObjectPtr<UObjectPoolComponent> ObjectPoolComponent = nullptr; | 	TObjectPtr<UObjectPoolComponent> ObjectPoolComponent = nullptr; | ||||||
| 
 | 
 | ||||||
| 	UPROPERTY() | 	UPROPERTY() | ||||||
| 	TObjectPtr<UPickupDataAsset> PickupTemplate = nullptr; | 	TArray<TObjectPtr<UPickupDataAsset>> PickupArray; | ||||||
| 
 | 
 | ||||||
| 	TArray<TObjectPtr<AActor>> Player; | 	TArray<TObjectPtr<AActor>> Player; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -26,7 +26,13 @@ public: | |||||||
| 	TObjectPtr<UBehaviorTree> BehaviorTree = nullptr; | 	TObjectPtr<UBehaviorTree> BehaviorTree = nullptr; | ||||||
| 
 | 
 | ||||||
| 	UPROPERTY(EditDefaultsOnly) | 	UPROPERTY(EditDefaultsOnly) | ||||||
| 	TObjectPtr<UPickupDataAsset> PickupDataAsset = nullptr; | 	TObjectPtr<UPickupDataAsset> CommonPickupDataAsset = nullptr; | ||||||
|  | 
 | ||||||
|  | 	UPROPERTY(EditDefaultsOnly) | ||||||
|  | 	TObjectPtr<UPickupDataAsset> UncommonPickupDataAsset = nullptr; | ||||||
|  | 
 | ||||||
|  | 	UPROPERTY(EditDefaultsOnly) | ||||||
|  | 	TObjectPtr<UPickupDataAsset> RarePickupDataAsset = nullptr; | ||||||
| 
 | 
 | ||||||
| 	UPROPERTY(EditDefaultsOnly) | 	UPROPERTY(EditDefaultsOnly) | ||||||
| 	TObjectPtr<USoundBase> OnDamagedSoundBase = nullptr; | 	TObjectPtr<USoundBase> OnDamagedSoundBase = nullptr; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user