Fix pickups starting from incorrect location
This commit is contained in:
		
							parent
							
								
									06a084e99e
								
							
						
					
					
						commit
						a35b1f0893
					
				| @ -73,8 +73,9 @@ void AEnemyCharacter::OnDeath(FDamageInfo damageInfo) | |||||||
| 
 | 
 | ||||||
| 				if (UKismetSystemLibrary::DoesImplementInterface(pickup, UPickupable::StaticClass())) | 				if (UKismetSystemLibrary::DoesImplementInterface(pickup, UPickupable::StaticClass())) | ||||||
| 				{ | 				{ | ||||||
| 					pickup->SetActorLocation(GetActorLocation()); | 					FVector pickupLocation = GetActorLocation(); | ||||||
| 					IPickupable::Execute_LoadDataFromDataAsset(pickup, PickupTemplate); | 					pickup->SetActorLocation(pickupLocation); | ||||||
|  | 					IPickupable::Execute_LoadDataFromDataAsset(pickup, PickupTemplate, pickupLocation); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -24,7 +24,7 @@ class VAMPIRES_API IPickupable | |||||||
| 	// Add interface functions to this class. This is the class that will be inherited to implement this interface.
 | 	// Add interface functions to this class. This is the class that will be inherited to implement this interface.
 | ||||||
| public: | public: | ||||||
| 	UFUNCTION(BlueprintNativeEvent) | 	UFUNCTION(BlueprintNativeEvent) | ||||||
| 	void LoadDataFromDataAsset(UPickupDataAsset* PickupDataAsset); | 	void LoadDataFromDataAsset(UPickupDataAsset* PickupDataAsset, FVector Location); | ||||||
| 
 | 
 | ||||||
| 	UFUNCTION(BlueprintNativeEvent) | 	UFUNCTION(BlueprintNativeEvent) | ||||||
| 	void ResetData(); | 	void ResetData(); | ||||||
|  | |||||||
| @ -60,7 +60,7 @@ void APickup::BeginPlay() | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void APickup::LoadDataFromDataAsset_Implementation(UPickupDataAsset* PickupDataAsset) | void APickup::LoadDataFromDataAsset_Implementation(UPickupDataAsset* PickupDataAsset, FVector Location) | ||||||
| { | { | ||||||
| 	if (PickupDataAsset != nullptr) | 	if (PickupDataAsset != nullptr) | ||||||
| 	{ | 	{ | ||||||
| @ -68,7 +68,7 @@ void APickup::LoadDataFromDataAsset_Implementation(UPickupDataAsset* PickupDataA | |||||||
| 		StaticMeshComponent->SetStaticMesh(PickupDataAsset->PickupStaticMesh); | 		StaticMeshComponent->SetStaticMesh(PickupDataAsset->PickupStaticMesh); | ||||||
| 		PickupSoundBase = PickupDataAsset->PickupSoundBase; | 		PickupSoundBase = PickupDataAsset->PickupSoundBase; | ||||||
| 		CurveFloat = PickupDataAsset->CurveFloat; | 		CurveFloat = PickupDataAsset->CurveFloat; | ||||||
| 		PickupLocation = GetActorLocation(); | 		PickupLocation = Location; | ||||||
| 		 | 		 | ||||||
| 		if (CurveFloat != nullptr) | 		if (CurveFloat != nullptr) | ||||||
| 		{ | 		{ | ||||||
|  | |||||||
| @ -53,7 +53,7 @@ protected: | |||||||
| 	// Called when the game starts or when spawned
 | 	// Called when the game starts or when spawned
 | ||||||
| 	virtual void BeginPlay() override; | 	virtual void BeginPlay() override; | ||||||
| 	 | 	 | ||||||
| 	virtual void LoadDataFromDataAsset_Implementation(UPickupDataAsset* PickupDataAsset) override; | 	virtual void LoadDataFromDataAsset_Implementation(UPickupDataAsset* PickupDataAsset, FVector Location) override; | ||||||
| 
 | 
 | ||||||
| 	virtual void ResetData_Implementation() override; | 	virtual void ResetData_Implementation() override; | ||||||
| 	 | 	 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user