[Style] 주석 추가
This commit is contained in:
parent
ed02ca4c27
commit
d2d474a84b
@ -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();
|
||||
});
|
||||
|
@ -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
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user