// Fill out your copyright notice in the Description page of Project Settings.


#include "ShelfActor.h"

#include "Components/InteractionWidgetComponent.h"
#include "Faye/Components/ShelfComponent.h"
#include "Faye/Inventory/Inventory.h"

AShelfActor::AShelfActor()
{
	PrimaryActorTick.bCanEverTick = true;
}

void AShelfActor::BeginPlay()
{
	Inventory = NewObject<UInventory>(this);
	Super::BeginPlay();
	
	GenerateBookRow();
}

void AShelfActor::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
}

void AShelfActor::GenerateBookRow()
{
	for (auto Component : GetComponents())
	{
		if (UShelfComponent* ShelfComponent = Cast<UShelfComponent>(Component))
		{
			ShelfComponent->GenerateBookRow();
		}
	}
}

UInventory* AShelfActor::GetInventory_Implementation() const
{
	return Inventory;
}

