Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9340da5

Browse files
committed
feat: 대화 액션 완료
1 parent 6617024 commit 9340da5

File tree

13 files changed

+112
-65
lines changed

13 files changed

+112
-65
lines changed

‎Assets/App/Scenes/MainSence.unity‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -708,11 +708,9 @@ MonoBehaviour:
708708
m_Name:
709709
m_EditorClassIdentifier:
710710
_chatBubblePanel: {fileID: 2017944365}
711+
_chracterManager: {fileID: 873552998}
711712
_characterId: 44444444-4444-4444-4444-444444444444
712713
_userId: bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb
713-
_enableMessageQueue: 1
714-
_maxQueueSize: 100
715-
_enableLive2DIntegration: 1
716714
--- !u!4 &829067253
717715
Transform:
718716
m_ObjectHideFlags: 0

‎Assets/Domain/Character/Script/Service/CharacterActionController.cs‎ renamed to ‎Assets/Domain/Character/Script/CharacterActionController.cs‎

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@
44

55
namespace ProjectVG.Domain.Character.Service
66
{
7-
/// <summary>
8-
/// 캐릭터 액션 실행을 관리하는 서비스 구현체
9-
/// </summary>
7+
8+
public enum CharacterActionType
9+
{
10+
Idle,
11+
Listen,
12+
Talk
13+
}
14+
1015
public class CharacterActionController : MonoBehaviour
1116
{
1217
private Animator? _animator;
1318
private bool _isPlaying = false;
19+
private CharacterActionType _currentAction = CharacterActionType.Idle;
1420

1521
/// <summary>
1622
/// 서비스를 초기화한다.
@@ -20,31 +26,48 @@ public void Initialize(Animator animator)
2026
{
2127
_animator = animator;
2228
_isPlaying = false;
29+
_currentAction = CharacterActionType.Idle;
2330
}
2431

2532
/// <summary>
2633
/// 액션을 실행한다.
2734
/// </summary>
28-
/// <param name="actionData">액션 데이터</param>
29-
public void PlayAction(CharacterActionDataactionData)
35+
/// <param name="actionType">액션 타입</param>
36+
public void PlayAction(CharacterActionTypeactionType)
3037
{
3138
if (_animator == null)
3239
{
3340
Debug.LogWarning("[CharacterActionController] Animator가 초기화되지 않았습니다.");
3441
return;
3542
}
3643

37-
if (!actionData.HasAction())
38-
{
39-
Debug.LogWarning("[CharacterActionController] 액션 데이터가 비어있습니다.");
40-
return;
41-
}
42-
4344
try
4445
{
45-
_isPlaying = true;
46-
_animator.SetTrigger(actionData.Action);
47-
Debug.Log($"[CharacterActionController] 액션 재생: {actionData.Action}");
46+
_currentAction = actionType;
47+
48+
Debug.Log(actionType);
49+
50+
switch (actionType)
51+
{
52+
case CharacterActionType.Idle:
53+
_animator.SetTrigger("Idle");
54+
_animator.SetBool("Talk", false);
55+
_isPlaying = false;
56+
break;
57+
58+
case CharacterActionType.Listen:
59+
_animator.SetTrigger("Listen");
60+
_animator.SetBool("Talk", false);
61+
_isPlaying = true;
62+
break;
63+
64+
case CharacterActionType.Talk:
65+
_animator.SetBool("Talk", true);
66+
_isPlaying = true;
67+
break;
68+
}
69+
70+
Debug.Log($"[CharacterActionController] 액션 재생: {actionType}");
4871
}
4972
catch (System.Exception ex)
5073
{
@@ -61,7 +84,9 @@ public void StopCurrentAction()
6184
if (_animator == null) return;
6285

6386
_animator.SetTrigger("Idle");
87+
_animator.SetBool("Talk", false);
6488
_isPlaying = false;
89+
_currentAction = CharacterActionType.Idle;
6590
Debug.Log("[CharacterActionController] 액션 중지");
6691
}
6792

@@ -73,5 +98,14 @@ public bool IsPlaying()
7398
{
7499
return _isPlaying && _animator != null;
75100
}
101+
102+
/// <summary>
103+
/// 현재 액션 타입을 반환한다.
104+
/// </summary>
105+
/// <returns>현재 액션 타입</returns>
106+
public CharacterActionType GetCurrentAction()
107+
{
108+
return _currentAction;
109+
}
76110
}
77111
}

‎Assets/Domain/Character/Script/Manager/CharacterManager.cs‎ renamed to ‎Assets/Domain/Character/Script/CharacterManager.cs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,11 @@ public void UnloadCurrentCharacter()
101101
/// <param name="actionData">액션 데이터</param>
102102
public void PlayAction(CharacterActionData actionData)
103103
{
104-
if (_currentActionService != null)
104+
Debug.Log(_currentActionService != null && actionData.HasAction());
105+
Debug.Log(actionData.HasAction());
106+
if (_currentActionService != null && actionData.HasAction())
105107
{
106-
_currentActionService.PlayAction(actionData);
108+
_currentActionService.PlayAction(actionData.ActionType);
107109
}
108110
}
109111

‎Assets/Domain/Character/Script/Manager/CharacterModelLoader.cs‎ renamed to ‎Assets/Domain/Character/Script/CharacterModelLoader.cs‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ private void SetupModelComponents(GameObject modelInstance, Live2DModelConfig co
9494
{
9595
SetupLipSync(modelInstance, config);
9696
SetupAutoEyeBlink(modelInstance, config);
97-
SetupActionService(modelInstance);
97+
SetupActionController(modelInstance);
9898
}
9999

100100
/// <summary>
@@ -164,21 +164,21 @@ private void SetupAutoEyeBlink(GameObject modelInstance, Live2DModelConfig confi
164164
/// <summary>
165165
/// 액션 서비스를 설정한다
166166
/// </summary>
167-
private void SetupActionService(GameObject modelInstance)
167+
private void SetupActionController(GameObject modelInstance)
168168
{
169169
var actionService = modelInstance.GetComponent<CharacterActionController>();
170170
if (actionService == null) {
171171
actionService = modelInstance.AddComponent<CharacterActionController>();
172172
}
173173

174174
var animator = modelInstance.GetComponent<Animator>();
175-
if (animator != null) {
176-
actionService.Initialize(animator);
177-
Debug.Log($"[CharacterModelLoader] CharacterActionController 초기화 완료: {modelInstance.name}");
178-
}else{
179-
Debug.LogWarning($"[CharacterModelLoader] Animator를 찾을 수 없습니다: {modelInstance.name}");
180-
}
181-
}
175+
if (animator == null) {
176+
Debug.LogWarning($"[CharacterModelLoader] Animator를 찾을 수 없습니다: {modelInstance.name}");
177+
return;
178+
}
179+
actionService.Initialize(animator);
180+
Debug.Log($"[CharacterModelLoader] CharacterActionController 초기화 완료: {modelInstance.name}");
181+
}
182182

183183
#endregion
184184
}

‎Assets/Domain/Character/Script/Controller.meta‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎Assets/Domain/Character/Script/Facade.meta‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎Assets/Domain/Character/Script/Manager.meta‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /