9#include "Components/WidgetComponent.h"
10#include "Net/UnrealNetwork.h"
17 PrimaryActorTick.bCanEverTick =
true;
19 Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT(
"Mesh"));
20 SetRootComponent(
Mesh);
22 FoodMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT(
"FoodMesh"));
23 FoodMesh->SetupAttachment(GetRootComponent());
25 CityName = CreateDefaultSubobject<UWidgetComponent>(TEXT(
"FoodName"));
27 InteractableComp = CreateDefaultSubobject<UInteractableComponent>(TEXT(
"Interactable"));
32 Mesh->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
33 Mesh->SetCollisionProfileName(TEXT(
"PhysicsActor"));
36 Mesh->SetIsReplicated(
true);
40 SetNetUpdateFrequency(100.0f);
41 SetMinNetUpdateFrequency(33.0f);
53 Mesh->SetSimulatePhysics(
true);
54 Mesh->SetEnableGravity(
true);
55 Mesh->SetMassOverrideInKg(NAME_None, 50.f,
true);
58 CityName->AttachToComponent(GetRootComponent(), FAttachmentTransformRules::KeepRelativeTransform);
59 CityName->SetRelativeLocation(FVector(0, 0, 0));
70 Super::GetLifetimeReplicatedProps(OutLifetimeProps);
80 Super::Tick(DeltaTime);
103 if (!IsInGameThread())
105 AsyncTask(ENamedThreads::GameThread, [
this]()
126 if (!IsInGameThread())
128 AsyncTask(ENamedThreads::GameThread, [
this]()
137 UE_LOG(LogTemp, Error, TEXT(
"[AFood::UpdateMesh] ListenDataTable is null!"));
143 UE_LOG(LogTemp, Error, TEXT(
"[AFood::UpdateMesh] FoodMesh component is null!"));
147 TArray<FListenData*> AllRows;
156 FoodMesh->SetStaticMesh(Row->FoodPath);
163 UE_LOG(LogTemp, Warning, TEXT(
"[AFood::UpdateMesh] No matching ListenData found for: %s"),
182 Mesh->SetRenderCustomDepth(bShouldShowOutline);
186 FoodMesh->SetRenderCustomDepth(bShouldShowOutline);
TObjectPtr< class UInteractableComponent > InteractableComp
void UpdateFoodWidget()
Widget에 음식 이름 업데이트
class UStaticMeshComponent * Mesh
void SetFoodMesh(FWordInfo InWord, UStaticMesh *InMesh)
void UpdateMesh()
음식 메시 업데이트 (DataTable에서 로드)
class UWidgetComponent * CityName
virtual void GetLifetimeReplicatedProps(TArray< class FLifetimeProperty > &OutLifetimeProps) const override
void OnOutlineStateChanged(bool bShouldShowOutline)
virtual void Tick(float DeltaTime) override
void OnRep_CurrentFoodData()
class UStaticMeshComponent * FoodMesh
FFoodCapsuleData CurrentFoodData
virtual void BeginPlay() override
void SetCityName(FWordInfo InWord)
class UDataTable * ListenDataTable
FWordInfo word1
시나리오 단어 정보