KLingo Project Documentation
1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
LuggageManager.cpp
이 파일의 문서화 페이지로 가기
1
// Copyright (c) 2025 Doppleddiggong. All rights reserved. Unauthorized copying, modification, or distribution of this file, via any medium is strictly prohibited. Proprietary and confidential.
2
3
4
#include "
LuggageManager.h
"
5
6
#include "
ALingoGameState.h
"
7
#include "
ALuggageHolder.h
"
8
#include "EngineUtils.h"
9
#include "
luggage.h
"
10
#include "
NetworkData.h
"
11
#include "
UGameDataManager.h
"
12
13
14
// Sets default values
15
ALuggageManager::ALuggageManager
()
16
{
17
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
18
PrimaryActorTick.bCanEverTick =
false
;
19
}
20
21
void
ALuggageManager::StartSpawning
()
22
{
23
if
(!HasAuthority())
return
;
24
25
CurrentSpawnIndex
= 0;
26
27
// 첫 번째 luggage는 즉시 스폰
28
SpawnLuggage
();
29
30
// 나머지는 타이머로 스폰
31
GetWorldTimerManager().SetTimer(
32
SpawnTimerHandle
,
33
this
,
34
&
ALuggageManager::SpawnLuggage
,
35
SpawnTime
,
36
true
// 반복
37
);
38
}
39
40
void
ALuggageManager::SpawnLuggage
()
41
{
42
ALingoGameState
* GS = Cast<ALingoGameState>(GetWorld()->GetGameState());
43
if
(!GS)
return
;
44
45
const
TArray<FScenarioTargetData>& ScenarioData = GS->
GetReadScenarioData
().
target_data
;
46
47
// 모두 스폰했으면 타이머 중지
48
if
(
CurrentSpawnIndex
>= ScenarioData.Num())
49
{
50
GetWorldTimerManager().ClearTimer(
SpawnTimerHandle
);
51
return
;
52
}
53
54
// 현재 인덱스의 luggage 스폰
55
auto
SD = ScenarioData[
CurrentSpawnIndex
];
56
Aluggage
* NewLuggage = GetWorld()->SpawnActor<
Aluggage
>(
57
LuggageClass
,
58
GetActorLocation(),
59
FRotator::ZeroRotator
60
);
61
62
if
(NewLuggage)
63
{
64
// 상자 정보 지정
65
NewLuggage->
SetLuggageInfo
(
CurrentSpawnIndex
, SD.word2.name, SD.word1.name);
66
67
// 인덱스로 상자 색&무늬 지정
68
int32 ColorIdx = FCString::Atoi(*SD.word2.code);
69
NewLuggage->
ApplyColorToMesh
(ColorIdx);
70
71
int32 PatternIdx = FCString::Atoi(*SD.word1.code);
72
NewLuggage->
ApplyPatternToMesh
(PatternIdx);
73
}
74
75
CurrentSpawnIndex
++;
76
}
77
78
// void ALuggageManager::InitHolder(FResponseReadScenario& ResponseData)
79
// {
80
// // {
81
// // "word1": { "name": "닭", "code": "6" },
82
// // "word2": { "name": "빨강", "code": "1" }
83
// // }
84
//
85
// const FScenarioTargetData& CorrectAnswer = ResponseData.target_data[ResponseData.correct_answer_index];
86
// const int32 PatternIdx = FCString::Atoi(*CorrectAnswer.word1.code);
87
// const int32 ColorIdx = FCString::Atoi(*CorrectAnswer.word2.code);
88
//
89
// for (TActorIterator<ALuggageHolder> It(GetWorld()); It; ++It)
90
// {
91
// ALuggageHolder* Holder = *It;
92
// if (Holder)
93
// {
94
// Holder->SetAnswerData(ColorIdx, PatternIdx);
95
// break;
96
// }
97
// }
98
// }
ALingoGameState.h
ALuggageHolder.h
LuggageManager.h
NetworkData.h
네트워크 요청과 응답에 사용되는 구조체 및 설정을 정의합니다.
UGameDataManager.h
UGameDataManager 클래스를 선언합니다.
ALingoGameState
Definition
ALingoGameState.h:29
ALingoGameState::GetReadScenarioData
FORCEINLINE const FResponseReadScenario & GetReadScenarioData() const
Definition
ALingoGameState.h:48
ALuggageManager::ALuggageManager
ALuggageManager()
Definition
LuggageManager.cpp:15
ALuggageManager::SpawnTimerHandle
FTimerHandle SpawnTimerHandle
Definition
LuggageManager.h:31
ALuggageManager::LuggageClass
TSubclassOf< class Aluggage > LuggageClass
Definition
LuggageManager.h:26
ALuggageManager::SpawnLuggage
void SpawnLuggage()
Definition
LuggageManager.cpp:40
ALuggageManager::SpawnTime
float SpawnTime
Definition
LuggageManager.h:29
ALuggageManager::CurrentSpawnIndex
int32 CurrentSpawnIndex
Definition
LuggageManager.h:33
ALuggageManager::StartSpawning
void StartSpawning()
Definition
LuggageManager.cpp:21
Aluggage
상호작용 가능한 수하물 액터
Definition
luggage.h:15
Aluggage::ApplyPatternToMesh
void ApplyPatternToMesh(int32 InPatternIdx)
Definition
luggage.cpp:232
Aluggage::ApplyColorToMesh
void ApplyColorToMesh(int32 InColorIdx)
Definition
luggage.cpp:199
Aluggage::SetLuggageInfo
void SetLuggageInfo(int32 InIdx, FString InColor, FString InPattern)
Definition
luggage.cpp:155
luggage.h
FResponseReadScenario::target_data
TArray< FScenarioTargetData > target_data
Definition
NetworkData.h:924
Source
Onepiece
Interactable
Private
LuggageManager.cpp
생성시간 : 금 1월 9 2026 00:25:57, 프로젝트명 : KLingo Project Documentation, 생성자 :
1.9.8