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


#include "Items/ThrowableBase.h"

#include "Characters/Components/ShootingComponent.h"

AThrowableBase::AThrowableBase()
{
	PrimaryActorTick.bCanEverTick = true;

	RootSceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
	SetRootComponent(RootSceneComponent);
	Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
	Mesh->SetupAttachment(GetRootComponent());
	Mesh->SetSimulatePhysics(true);

}

void AThrowableBase::Interact_Implementation(AExoPlayerCharacter* PlayerCharacter)
{
	if (PlayerCharacter->ShootingComponent->PickUpThrow(this))
	{
		Destroy();
	}

}

void AThrowableBase::EffectActivate()
{
	if (ThrowableType == ThrowableType::Hit)
	{
		UE_LOG(LogTemp, Display, TEXT("Throwable Hit"));
	}
	if (ThrowableType == ThrowableType::Explode)
	{
		UE_LOG(LogTemp, Display, TEXT("Throwable Explode"));
	}
	if (ThrowableType == ThrowableType::Area)
	{
		UE_LOG(LogTemp, Display, TEXT("Throwable Area"));
	}
}


