DEG-116-액션과-컷씬-연동-재작업 #2
BIN
Assets/LIN/Housing Copy.unity
(Stored with Git LFS)
BIN
Assets/LIN/Housing Copy.unity
(Stored with Git LFS)
Binary file not shown.
@ -47,9 +47,13 @@ public class HousingCanvasController : MonoBehaviour
|
|||||||
//상호작용 버튼 눌렀을 때
|
//상호작용 버튼 눌렀을 때
|
||||||
public void OnClickInteractionButton()
|
public void OnClickInteractionButton()
|
||||||
{
|
{
|
||||||
|
//상호작용 별 행동 수행
|
||||||
OnInteractionButtonPressed?.Invoke();
|
OnInteractionButtonPressed?.Invoke();
|
||||||
OnInteractionButtonPressed = null;
|
OnInteractionButtonPressed = null;
|
||||||
|
|
||||||
|
//상호작용 버튼과 텍스트 숨김
|
||||||
HideInteractionButton();
|
HideInteractionButton();
|
||||||
|
interactionTextsController.InitInteractionTexts();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -27,7 +27,8 @@ public static class HousingConstants
|
|||||||
{ ActionType.Dungeon, new InteractionTexts("던전에 입장할까?","체력 3을 사용하고 3시간이 흐른다.",
|
{ ActionType.Dungeon, new InteractionTexts("던전에 입장할까?","체력 3을 사용하고 3시간이 흐른다.",
|
||||||
"던전에 갈 체력이 되지 않아..","던전 진입하는 중")},
|
"던전에 갈 체력이 되지 않아..","던전 진입하는 중")},
|
||||||
{ ActionType.Work, new InteractionTexts("출근한다.","체력 3을 사용하고 저녁 6시에나 돌아오겠지..",
|
{ ActionType.Work, new InteractionTexts("출근한다.","체력 3을 사용하고 저녁 6시에나 돌아오겠지..",
|
||||||
"도저히 출근할 체력이 안되는걸..?","출근하는 중")}
|
"도저히 출근할 체력이 안되는걸..?","출근하는 중")},
|
||||||
|
{ActionType.Eat, new InteractionTexts("식사를 하자","1시간 동안 체력 1을 회복한다.","밥 먹는 중")}
|
||||||
};
|
};
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -12,13 +12,11 @@ public class InteractionAnimationPanelController : MonoBehaviour
|
|||||||
[SerializeField] private Image doingImage;
|
[SerializeField] private Image doingImage;
|
||||||
[SerializeField] private TMP_Text doingText;
|
[SerializeField] private TMP_Text doingText;
|
||||||
[SerializeField] private Animator animator;
|
[SerializeField] private Animator animator;
|
||||||
|
[SerializeField] private float animationDuration = 2.0f;
|
||||||
|
|
||||||
private Coroutine _textAnimCoroutine;
|
private Coroutine _textAnimCoroutine;
|
||||||
|
private Coroutine _autoHideCoroutine;
|
||||||
|
|
||||||
// private void Start()
|
|
||||||
// {
|
|
||||||
// ShowAnimationPanel(LoadingState.Housework);
|
|
||||||
// }
|
|
||||||
public void SetDoingText(string text)
|
public void SetDoingText(string text)
|
||||||
{
|
{
|
||||||
doingText.text = text;
|
doingText.text = text;
|
||||||
@ -26,11 +24,13 @@ public class InteractionAnimationPanelController : MonoBehaviour
|
|||||||
|
|
||||||
public void ShowAnimationPanel(ActionType actionType, string animationText)
|
public void ShowAnimationPanel(ActionType actionType, string animationText)
|
||||||
{
|
{
|
||||||
|
// 1) 패널 활성화
|
||||||
panel.SetActive(true);
|
panel.SetActive(true);
|
||||||
if (_textAnimCoroutine != null)
|
// 2) 기존 코루틴 정리
|
||||||
{
|
if (_textAnimCoroutine != null) StopCoroutine(_textAnimCoroutine);
|
||||||
StopCoroutine(_textAnimCoroutine);
|
if (_autoHideCoroutine != null) StopCoroutine(_autoHideCoroutine);
|
||||||
}
|
|
||||||
|
// 3) 텍스트 및 애니메이션 세팅
|
||||||
doingText.text = animationText;
|
doingText.text = animationText;
|
||||||
switch (actionType)
|
switch (actionType)
|
||||||
{
|
{
|
||||||
@ -39,7 +39,6 @@ public class InteractionAnimationPanelController : MonoBehaviour
|
|||||||
case ActionType.Work:
|
case ActionType.Work:
|
||||||
break;
|
break;
|
||||||
case ActionType.Eat:
|
case ActionType.Eat:
|
||||||
doingText.text = "식사하는 중";
|
|
||||||
break;
|
break;
|
||||||
case ActionType.Dungeon:
|
case ActionType.Dungeon:
|
||||||
break;
|
break;
|
||||||
@ -48,6 +47,7 @@ public class InteractionAnimationPanelController : MonoBehaviour
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_textAnimCoroutine = StartCoroutine(TextDotsAnimation());
|
_textAnimCoroutine = StartCoroutine(TextDotsAnimation());
|
||||||
|
_autoHideCoroutine = StartCoroutine(AutoHidePanel());
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator TextDotsAnimation()
|
private IEnumerator TextDotsAnimation()
|
||||||
@ -63,7 +63,44 @@ public class InteractionAnimationPanelController : MonoBehaviour
|
|||||||
}
|
}
|
||||||
yield return new WaitForSeconds(0.3f);
|
yield return new WaitForSeconds(0.3f);
|
||||||
}
|
}
|
||||||
_textAnimCoroutine = null;
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 패널이 2초후 자동으로 닫히거나 터치시 닫히도록 합니다.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private IEnumerator AutoHidePanel()
|
||||||
|
{
|
||||||
|
float startTime = Time.time;
|
||||||
|
while (Time.time - startTime < animationDuration)
|
||||||
|
{
|
||||||
|
if (Input.touchCount > 0 || Input.GetMouseButtonDown(0))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//패널 닫고 애니메이션 null처리
|
||||||
|
HidePanel();
|
||||||
|
_autoHideCoroutine = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HidePanel()
|
||||||
|
{
|
||||||
|
panel.SetActive(false);
|
||||||
|
|
||||||
|
if (_textAnimCoroutine != null)
|
||||||
|
{
|
||||||
|
StopCoroutine(_textAnimCoroutine);
|
||||||
|
_textAnimCoroutine = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_autoHideCoroutine != null)
|
||||||
|
{
|
||||||
|
StopCoroutine(_autoHideCoroutine);
|
||||||
|
_autoHideCoroutine = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user