[Style] 주석 추가
This commit is contained in:
parent
ed02ca4c27
commit
d2d474a84b
@ -12,13 +12,8 @@ public class InteractionController : MonoBehaviour
|
|||||||
[FormerlySerializedAs("housingCanvasManager")]
|
[FormerlySerializedAs("housingCanvasManager")]
|
||||||
[Header("UI 연동")]
|
[Header("UI 연동")]
|
||||||
[SerializeField] HousingCanvasController housingCanvasController;
|
[SerializeField] HousingCanvasController housingCanvasController;
|
||||||
|
|
||||||
|
|
||||||
#region 돌발 이벤트
|
|
||||||
private SuddenEventController _suddenEventController = new SuddenEventController();
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
private SuddenEventController _suddenEventController = new SuddenEventController();
|
||||||
|
|
||||||
// 상호작용 가능한 사물 범위에 들어올 때
|
// 상호작용 가능한 사물 범위에 들어올 때
|
||||||
private void OnTriggerEnter(Collider other)
|
private void OnTriggerEnter(Collider other)
|
||||||
@ -51,7 +46,7 @@ public class InteractionController : MonoBehaviour
|
|||||||
if (playerStats.CanPerformByHealth(interactionType))
|
if (playerStats.CanPerformByHealth(interactionType))
|
||||||
{
|
{
|
||||||
playerStats.PerformAction(interactionType);
|
playerStats.PerformAction(interactionType);
|
||||||
// 출근에 해당하는 돌발 이벤트 호출
|
// 출퇴근에 해당하는 돌발 이벤트 호출
|
||||||
if (interactionType != ActionType.Work) return;
|
if (interactionType != ActionType.Work) return;
|
||||||
playerStats.OnWorked += SuddenAfterWorkEventHappen();
|
playerStats.OnWorked += SuddenAfterWorkEventHappen();
|
||||||
}
|
}
|
||||||
@ -83,7 +78,7 @@ public class InteractionController : MonoBehaviour
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case AfterWorkEvent.TeamGathering:
|
case AfterWorkEvent.TeamGathering:
|
||||||
housingCanvasController.ShowSuddenEventPanel("갑자기 팀 회식이 잡혔다. 참석 해야 겠지?", () =>
|
housingCanvasController.ShowSuddenEventPanel("갑자기 팀 회식이 잡혔다. 참석 하러 가자", () =>
|
||||||
{
|
{
|
||||||
housingCanvasController.HideSuddenEventPanel();
|
housingCanvasController.HideSuddenEventPanel();
|
||||||
});
|
});
|
||||||
|
@ -6,6 +6,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class HousingCanvasController : MonoBehaviour
|
public class HousingCanvasController : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
[Header("일상행동 상호작용")]
|
||||||
[SerializeField] GameObject interactionButton;
|
[SerializeField] GameObject interactionButton;
|
||||||
[SerializeField] TMP_Text actionText;
|
[SerializeField] TMP_Text actionText;
|
||||||
[SerializeField] TMP_Text descriptionText;
|
[SerializeField] TMP_Text descriptionText;
|
||||||
@ -13,16 +14,18 @@ public class HousingCanvasController : MonoBehaviour
|
|||||||
[Header("돌발 이벤트")]
|
[Header("돌발 이벤트")]
|
||||||
[SerializeField] private GameObject suddenPanel;
|
[SerializeField] private GameObject suddenPanel;
|
||||||
[SerializeField] private TMP_Text suddenText;
|
[SerializeField] private TMP_Text suddenText;
|
||||||
|
|
||||||
public Action OnInteractionButtonPressed;
|
public Action OnInteractionButtonPressed;
|
||||||
public Action OnSuddenButtonPressed;
|
public Action OnSuddenButtonPressed;
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
InitTexts();
|
InitInteractionTexts();
|
||||||
interactionButton.SetActive(false);
|
interactionButton.SetActive(false);
|
||||||
|
suddenPanel.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region 상호작용 일상 행동
|
||||||
//사물 이름 세팅
|
//사물 이름 세팅
|
||||||
public void SetActionText(string text = "")
|
public void SetActionText(string text = "")
|
||||||
{
|
{
|
||||||
@ -34,7 +37,7 @@ public class HousingCanvasController : MonoBehaviour
|
|||||||
descriptionText.text = text;
|
descriptionText.text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitTexts()
|
private void InitInteractionTexts()
|
||||||
{
|
{
|
||||||
SetActionText();
|
SetActionText();
|
||||||
SetDescriptionText();
|
SetDescriptionText();
|
||||||
@ -50,24 +53,6 @@ public class HousingCanvasController : MonoBehaviour
|
|||||||
//각 행동 별로 실행되어야 할 이벤트 구독
|
//각 행동 별로 실행되어야 할 이벤트 구독
|
||||||
OnInteractionButtonPressed = onInteractionButtonPressed;
|
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
|
//범위에서 벗어나면 상호작용 버튼 off
|
||||||
public void HideInteractionButton()
|
public void HideInteractionButton()
|
||||||
{
|
{
|
||||||
@ -85,4 +70,25 @@ public class HousingCanvasController : MonoBehaviour
|
|||||||
OnInteractionButtonPressed?.Invoke();
|
OnInteractionButtonPressed?.Invoke();
|
||||||
HideInteractionButton();
|
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.Housework, new InteractionTexts("밀린 집안일을 처리할까?","체력 1을 사용하고 좋은일이 일어날지도 모른다","힘들어서 못해..")},
|
||||||
{ ActionType.Dungeon, new InteractionTexts("던전에 입장할까?","체력 3을 사용하고 3시간이 흐른다.","던전에 갈 체력이 되지 않아..")},
|
{ ActionType.Dungeon, new InteractionTexts("던전에 입장할까?","체력 3을 사용하고 3시간이 흐른다.","던전에 갈 체력이 되지 않아..")},
|
||||||
{ ActionType.Work, new InteractionTexts("출근한다.","체력 3을 사용하고 저녁 6시에나 돌아오겠지..", "도저히 출근할 체력이 안되는걸..?")}
|
{ ActionType.Work, new InteractionTexts("출근한다.","체력 3을 사용하고 저녁 6시에나 돌아오겠지..", "도저히 출근할 체력이 안되는걸..?")}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public struct InteractionTexts
|
public struct InteractionTexts
|
||||||
|
Loading…
x
Reference in New Issue
Block a user