[Style] 주석 추가

This commit is contained in:
HaeinLEE 2025-04-23 23:15:11 +09:00
parent ed02ca4c27
commit d2d474a84b
3 changed files with 30 additions and 34 deletions

View File

@ -13,13 +13,8 @@ public class InteractionController : MonoBehaviour
[Header("UI 연동")]
[SerializeField] HousingCanvasController housingCanvasController;
#region
private SuddenEventController _suddenEventController = new SuddenEventController();
#endregion
// 상호작용 가능한 사물 범위에 들어올 때
private void OnTriggerEnter(Collider other)
{
@ -51,7 +46,7 @@ public class InteractionController : MonoBehaviour
if (playerStats.CanPerformByHealth(interactionType))
{
playerStats.PerformAction(interactionType);
// 출근에 해당하는 돌발 이벤트 호출
// 출근에 해당하는 돌발 이벤트 호출
if (interactionType != ActionType.Work) return;
playerStats.OnWorked += SuddenAfterWorkEventHappen();
}
@ -83,7 +78,7 @@ public class InteractionController : MonoBehaviour
});
break;
case AfterWorkEvent.TeamGathering:
housingCanvasController.ShowSuddenEventPanel("갑자기 팀 회식이 잡혔다. 참석 해야 겠지?", () =>
housingCanvasController.ShowSuddenEventPanel("갑자기 팀 회식이 잡혔다. 참석 하러 가자", () =>
{
housingCanvasController.HideSuddenEventPanel();
});

View File

@ -6,6 +6,7 @@ using UnityEngine;
public class HousingCanvasController : MonoBehaviour
{
[Header("일상행동 상호작용")]
[SerializeField] GameObject interactionButton;
[SerializeField] TMP_Text actionText;
[SerializeField] TMP_Text descriptionText;
@ -19,10 +20,12 @@ public class HousingCanvasController : MonoBehaviour
void Awake()
{
InitTexts();
InitInteractionTexts();
interactionButton.SetActive(false);
suddenPanel.SetActive(false);
}
#region
//사물 이름 세팅
public void SetActionText(string text = "")
{
@ -34,7 +37,7 @@ public class HousingCanvasController : MonoBehaviour
descriptionText.text = text;
}
private void InitTexts()
private void InitInteractionTexts()
{
SetActionText();
SetDescriptionText();
@ -50,24 +53,6 @@ public class HousingCanvasController : MonoBehaviour
//각 행동 별로 실행되어야 할 이벤트 구독
OnInteractionButtonPressed = onInteractionButtonPressed;
}
public void ShowSuddenEventPanel(string actText, Action onSuddenButtonPressed)
{
suddenPanel.SetActive(true);
suddenText.text = actText;
OnSuddenButtonPressed += onSuddenButtonPressed;
}
public void HideSuddenEventPanel()
{
suddenPanel.SetActive(false);
suddenText.text = "";
OnSuddenButtonPressed -= OnSuddenButtonPressed;
}
public void OnSuddenConfirmButton()
{
OnSuddenButtonPressed?.Invoke();
}
//범위에서 벗어나면 상호작용 버튼 off
public void HideInteractionButton()
{
@ -85,4 +70,25 @@ public class HousingCanvasController : MonoBehaviour
OnInteractionButtonPressed?.Invoke();
HideInteractionButton();
}
#endregion
#region
public void ShowSuddenEventPanel(string actText, Action onSuddenButtonPressed)
{
suddenPanel.SetActive(true);
suddenText.text = actText;
OnSuddenButtonPressed += onSuddenButtonPressed;
}
public void HideSuddenEventPanel()
{
suddenPanel.SetActive(false);
suddenText.text = "";
OnSuddenButtonPressed -= OnSuddenButtonPressed;
}
public void OnSuddenConfirmButton()
{
OnSuddenButtonPressed?.Invoke();
}
#endregion
}

View File

@ -25,12 +25,7 @@ public static class HousingConstants
{ ActionType.Housework, new InteractionTexts("밀린 집안일을 처리할까?","체력 1을 사용하고 좋은일이 일어날지도 모른다","힘들어서 못해..")},
{ ActionType.Dungeon, new InteractionTexts("던전에 입장할까?","체력 3을 사용하고 3시간이 흐른다.","던전에 갈 체력이 되지 않아..")},
{ ActionType.Work, new InteractionTexts("출근한다.","체력 3을 사용하고 저녁 6시에나 돌아오겠지..", "도저히 출근할 체력이 안되는걸..?")}
};
#endregion
public struct InteractionTexts