Updated Merchant to fix buttons not working
This commit is contained in:
		
							parent
							
								
									9e55e8f930
								
							
						
					
					
						commit
						d8a4603651
					
				| @ -76,7 +76,7 @@ public: | ||||
| 	class UInventoryComponent* StoredItems; | ||||
| 
 | ||||
| 	//The buy class to purchase the item
 | ||||
| 	virtual void Buy(class ATempCharacter* PurchaseItem) PURE_VIRTUAL(UBaseItem); // WILL SET THIS UP LATER
 | ||||
| 	virtual void Buy(class ATempCharacter* BuyItem) PURE_VIRTUAL(UBaseItem); // WILL SET THIS UP LATER
 | ||||
| 
 | ||||
| 	//The use Item class to use the item in the player Inventory
 | ||||
| 	virtual void Use(class ATempCharacter* Character); | ||||
|  | ||||
| @ -25,8 +25,8 @@ void AInteraction::BeginPlay() | ||||
| 	Super::BeginPlay(); | ||||
| 	 | ||||
| 	//Character & Camera refs
 | ||||
| 	if (TempCharacterRef != nullptr) TempCharacterRef = Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetCharacter()); | ||||
| 	if (MainCamera != nullptr) MainCamera = Cast<UCameraComponent>(TempCharacterRef->FindComponentByClass<UCameraComponent>()); | ||||
| 	TempCharacterRef = Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetCharacter()); | ||||
| 	MainCamera = Cast<UCameraComponent>(TempCharacterRef->FindComponentByClass<UCameraComponent>()); | ||||
| 	//Item refs
 | ||||
| 	 | ||||
| 	TargetHealingLocation = HealingItem->GetActorLocation(); | ||||
| @ -130,7 +130,14 @@ void AInteraction::CameraLeftMover() | ||||
| 	UE_LOG(LogTemp, Display, TEXT("Button Left is being pressed")); | ||||
| 	if (TempCharacterRef == nullptr || BuyHealingProperty == nullptr) | ||||
| 	{ | ||||
| 		UE_LOG(LogTemp, Display, TEXT("Character not found in Interaction.cpp")); | ||||
| 		if (TempCharacterRef == nullptr) | ||||
| 		{ | ||||
| 			UE_LOG(LogTemp, Display, TEXT("Character not found in Interaction.cpp")); | ||||
| 		} | ||||
| 		else if (BuyHealingProperty == nullptr) | ||||
| 		{ | ||||
| 			UE_LOG(LogTemp, Display, TEXT("HealingItem Not Found")); | ||||
| 		} | ||||
| 		return; | ||||
| 	} | ||||
| 	else | ||||
|  | ||||
| @ -272,7 +272,7 @@ void ATempCharacter::UseItem(class UBaseItem* Item) | ||||
| void ATempCharacter::BuyItem(AActor* Item) | ||||
| { | ||||
| 	UE_LOG(LogTemp, Display, TEXT("Hit Merchant")); | ||||
| 	auto ItemArray = Item->FindComponentByClass<UInventoryComponent>()->GetItem(0); | ||||
| 	UBaseItem* ItemArray = Item->FindComponentByClass<UInventoryComponent>()->GetItem(0); | ||||
| 	if (GoldBalance <= 0) | ||||
| 	{ | ||||
| 		UE_LOG(LogTemp, Display, TEXT("Not Enough Gold")); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user