// Fill out your copyright notice in the Description page of Project Settings. #include "Item.h" #include "JournalWidget.h" #include "Kismet/GameplayStatics.h" // Sets default values AItem::AItem() { // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. PrimaryActorTick.bCanEverTick = false; } // Called when the game starts or when spawned void AItem::BeginPlay() { Super::BeginPlay(); } // Called every frame void AItem::Tick(float DeltaTime) { Super::Tick(DeltaTime); } FString AItem::get_item_name(){ return item_name; } FString AItem::get_item_description(){ return item_description; } void AItem::set_item_name(FString new_name){ item_name = new_name; } void AItem::set_item_description(FString new_description){ item_description = new_description; } void AItem::send_item_to_journal(){ TArray FoundActors; UGameplayStatics::GetAllActorsOfClass(GetWorld(), UJournalWidget::StaticClass(), FoundActors); if (FoundActors.Num() > 0){ UJournalWidget* journal_widget = Cast(FoundActors[0]); journal_widget->add_to_journal(item_name, item_description); } }