Compare commits
No commits in common. "c262b9e2f703308c5410167f14f0878ab32cac55" and "2ebeccfa69738ffbcc07f45c66d67c5d6d047568" have entirely different histories.
c262b9e2f7
...
2ebeccfa69
13
.idea/.idea.Degulleo3D116Rework/.idea/.gitignore
generated
vendored
13
.idea/.idea.Degulleo3D116Rework/.idea/.gitignore
generated
vendored
@ -1,13 +0,0 @@
|
|||||||
# 디폴트 무시된 파일
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Rider에서 무시된 파일
|
|
||||||
/contentModel.xml
|
|
||||||
/projectSettingsUpdater.xml
|
|
||||||
/modules.xml
|
|
||||||
/.idea.Degulleo3D116Rework.iml
|
|
||||||
# 에디터 기반 HTTP 클라이언트 요청
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="UserContentModel">
|
|
||||||
<attachedFolders />
|
|
||||||
<explicitIncludes />
|
|
||||||
<explicitExcludes />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
6
.idea/.idea.Degulleo3D116Rework/.idea/vcs.xml
generated
6
.idea/.idea.Degulleo3D116Rework/.idea/vcs.xml
generated
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -12,7 +12,6 @@ public class InteractionController : MonoBehaviour
|
|||||||
[FormerlySerializedAs("housingCanvasManager")]
|
[FormerlySerializedAs("housingCanvasManager")]
|
||||||
[Header("UI 연동")]
|
[Header("UI 연동")]
|
||||||
[SerializeField] HousingCanvasController housingCanvasController;
|
[SerializeField] HousingCanvasController housingCanvasController;
|
||||||
[SerializeField] private InteractionAnimationPanelController interactionAnimationPanelController;
|
|
||||||
|
|
||||||
private SuddenEventController _suddenEventController = new SuddenEventController();
|
private SuddenEventController _suddenEventController = new SuddenEventController();
|
||||||
|
|
||||||
@ -39,7 +38,6 @@ public class InteractionController : MonoBehaviour
|
|||||||
if (interactionLayerMask == (interactionLayerMask | (1 << other.gameObject.layer)))
|
if (interactionLayerMask == (interactionLayerMask | (1 << other.gameObject.layer)))
|
||||||
{
|
{
|
||||||
housingCanvasController.HideInteractionButton();
|
housingCanvasController.HideInteractionButton();
|
||||||
housingCanvasController.interactionTextsController.InitInteractionTexts();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,12 +51,11 @@ public class InteractionController : MonoBehaviour
|
|||||||
if (playerStats.CanPerformByHealth(interactionType))
|
if (playerStats.CanPerformByHealth(interactionType))
|
||||||
{
|
{
|
||||||
playerStats.PerformAction(interactionType);
|
playerStats.PerformAction(interactionType);
|
||||||
interactionAnimationPanelController.ShowAnimationPanel(interactionType,interactionTexts.AnimationText);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
housingCanvasController.interactionTextsController.ActiveTexts(interactionTexts.LackOfHealth);
|
housingCanvasController.SetActionText(interactionTexts.LackOfHealth);
|
||||||
|
housingCanvasController.SetDescriptionText();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
BIN
Assets/LIN/Housing Copy.unity
(Stored with Git LFS)
BIN
Assets/LIN/Housing Copy.unity
(Stored with Git LFS)
Binary file not shown.
@ -3,14 +3,14 @@ using System.Collections;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
public class HousingCanvasController : MonoBehaviour
|
public class HousingCanvasController : MonoBehaviour
|
||||||
{
|
{
|
||||||
[Header("일상행동 상호작용")]
|
[Header("일상행동 상호작용")]
|
||||||
[SerializeField] private GameObject interactionButton;
|
[SerializeField] GameObject interactionButton;
|
||||||
public InteractionTextsContoller interactionTextsController;
|
[SerializeField] TMP_Text actionText;
|
||||||
|
[SerializeField] TMP_Text descriptionText;
|
||||||
|
|
||||||
[Header("돌발 이벤트")]
|
[Header("돌발 이벤트")]
|
||||||
[SerializeField] private GameObject suddenPanel;
|
[SerializeField] private GameObject suddenPanel;
|
||||||
[SerializeField] private TMP_Text suddenText;
|
[SerializeField] private TMP_Text suddenText;
|
||||||
@ -20,16 +20,34 @@ public class HousingCanvasController : MonoBehaviour
|
|||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
interactionTextsController.InitInteractionTexts();
|
InitInteractionTexts();
|
||||||
interactionButton.SetActive(false);
|
interactionButton.SetActive(false);
|
||||||
suddenPanel.SetActive(false);
|
suddenPanel.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 상호작용 일상 행동
|
#region 상호작용 일상 행동
|
||||||
|
//사물 이름 세팅
|
||||||
|
public void SetActionText(string text = "")
|
||||||
|
{
|
||||||
|
actionText.text = text;
|
||||||
|
}
|
||||||
|
//사물 상호작용 내용 설명
|
||||||
|
public void SetDescriptionText(string text = "")
|
||||||
|
{
|
||||||
|
descriptionText.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitInteractionTexts()
|
||||||
|
{
|
||||||
|
SetActionText();
|
||||||
|
SetDescriptionText();
|
||||||
|
}
|
||||||
|
|
||||||
// 상호작용 가능한 사물에 가까이 갔을 때 화면에 텍스트, 버튼 표시
|
// 상호작용 가능한 사물에 가까이 갔을 때 화면에 텍스트, 버튼 표시
|
||||||
public void ShowInteractionButton(string actText, string descText,Action onInteractionButtonPressed)
|
public void ShowInteractionButton(string actText, string descText,Action onInteractionButtonPressed)
|
||||||
{
|
{
|
||||||
interactionTextsController.ActiveTexts(actText, descText);
|
SetActionText(actText);
|
||||||
|
SetDescriptionText(descText);
|
||||||
interactionButton.SetActive(true);
|
interactionButton.SetActive(true);
|
||||||
|
|
||||||
//각 행동 별로 실행되어야 할 이벤트 구독
|
//각 행동 별로 실행되어야 할 이벤트 구독
|
||||||
@ -38,6 +56,8 @@ public class HousingCanvasController : MonoBehaviour
|
|||||||
//범위에서 벗어나면 상호작용 버튼 off
|
//범위에서 벗어나면 상호작용 버튼 off
|
||||||
public void HideInteractionButton()
|
public void HideInteractionButton()
|
||||||
{
|
{
|
||||||
|
SetActionText();
|
||||||
|
SetDescriptionText();
|
||||||
interactionButton.SetActive(false);
|
interactionButton.SetActive(false);
|
||||||
|
|
||||||
//구독해놓은 이벤트 해제
|
//구독해놓은 이벤트 해제
|
||||||
@ -47,13 +67,8 @@ public class HousingCanvasController : MonoBehaviour
|
|||||||
//상호작용 버튼 눌렀을 때
|
//상호작용 버튼 눌렀을 때
|
||||||
public void OnClickInteractionButton()
|
public void OnClickInteractionButton()
|
||||||
{
|
{
|
||||||
//상호작용 별 행동 수행
|
|
||||||
OnInteractionButtonPressed?.Invoke();
|
OnInteractionButtonPressed?.Invoke();
|
||||||
OnInteractionButtonPressed = null;
|
|
||||||
|
|
||||||
//상호작용 버튼과 텍스트 숨김
|
|
||||||
HideInteractionButton();
|
HideInteractionButton();
|
||||||
interactionTextsController.InitInteractionTexts();
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -20,15 +20,10 @@ public static class HousingConstants
|
|||||||
public static readonly Dictionary<ActionType, InteractionTexts> interactions =
|
public static readonly Dictionary<ActionType, InteractionTexts> interactions =
|
||||||
new Dictionary<ActionType, InteractionTexts>
|
new Dictionary<ActionType, InteractionTexts>
|
||||||
{
|
{
|
||||||
{ ActionType.Sleep, new InteractionTexts("침대에서 잘까?","숙면으로 시간 당 체력 1을 회복한다.",
|
{ ActionType.Sleep, new InteractionTexts("침대에서 잘까?","숙면으로 시간 당 체력 1을 회복한다.", ".")},
|
||||||
".","쿨쿨 자는 중")},
|
{ ActionType.Housework, new InteractionTexts("밀린 집안일을 처리할까?","체력 1을 사용하고 좋은일이 일어날지도 모른다","힘들어서 못해..")},
|
||||||
{ ActionType.Housework, new InteractionTexts("밀린 집안일을 처리할까?","체력 1을 사용하고 좋은일이 일어날지도 모른다",
|
{ ActionType.Dungeon, new InteractionTexts("던전에 입장할까?","체력 3을 사용하고 3시간이 흐른다.","던전에 갈 체력이 되지 않아..")},
|
||||||
"힘들어서 못해..","세탁하는 중")},
|
{ ActionType.Work, new InteractionTexts("출근한다.","체력 3을 사용하고 저녁 6시에나 돌아오겠지..", "도저히 출근할 체력이 안되는걸..?")}
|
||||||
{ ActionType.Dungeon, new InteractionTexts("던전에 입장할까?","체력 3을 사용하고 3시간이 흐른다.",
|
|
||||||
"던전에 갈 체력이 되지 않아..","던전 진입하는 중")},
|
|
||||||
{ ActionType.Work, new InteractionTexts("출근한다.","체력 3을 사용하고 저녁 6시에나 돌아오겠지..",
|
|
||||||
"도저히 출근할 체력이 안되는걸..?","출근하는 중")},
|
|
||||||
{ActionType.Eat, new InteractionTexts("식사를 하자","1시간 동안 체력 1을 회복한다.","밥 먹는 중")}
|
|
||||||
};
|
};
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -37,14 +32,12 @@ public static class HousingConstants
|
|||||||
public string ActionText { get; private set; }
|
public string ActionText { get; private set; }
|
||||||
public string DescriptionText { get; private set; }
|
public string DescriptionText { get; private set; }
|
||||||
public string LackOfHealth { get; private set; }
|
public string LackOfHealth { get; private set; }
|
||||||
public string AnimationText { get; private set; }
|
|
||||||
|
|
||||||
public InteractionTexts(string actionText, string descriptionText, string lackOfHealth, string animationText = "")
|
public InteractionTexts(string actionText, string descriptionText, string lackOfHealth)
|
||||||
{
|
{
|
||||||
ActionText = actionText;
|
ActionText = actionText;
|
||||||
DescriptionText = descriptionText;
|
DescriptionText = descriptionText;
|
||||||
LackOfHealth = lackOfHealth;
|
LackOfHealth = lackOfHealth;
|
||||||
AnimationText = animationText;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 94531ff12d388974a9a50a9e33997d6e
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: b5a9f238e478db241bcae4cd9192a195
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using TMPro;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
public class InteractionAnimationPanelController : MonoBehaviour
|
|
||||||
{
|
|
||||||
[SerializeField] private GameObject panel;
|
|
||||||
[SerializeField] private Image doingImage;
|
|
||||||
[SerializeField] private TMP_Text doingText;
|
|
||||||
[SerializeField] private Animator animator;
|
|
||||||
[SerializeField] private float animationDuration = 2.0f;
|
|
||||||
|
|
||||||
private Coroutine _textAnimCoroutine;
|
|
||||||
private Coroutine _autoHideCoroutine;
|
|
||||||
|
|
||||||
public void SetDoingText(string text)
|
|
||||||
{
|
|
||||||
doingText.text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ShowAnimationPanel(ActionType actionType, string animationText)
|
|
||||||
{
|
|
||||||
// 1) 패널 활성화
|
|
||||||
panel.SetActive(true);
|
|
||||||
// 2) 기존 코루틴 정리
|
|
||||||
if (_textAnimCoroutine != null) StopCoroutine(_textAnimCoroutine);
|
|
||||||
if (_autoHideCoroutine != null) StopCoroutine(_autoHideCoroutine);
|
|
||||||
|
|
||||||
// 3) 텍스트 및 애니메이션 세팅
|
|
||||||
doingText.text = animationText;
|
|
||||||
switch (actionType)
|
|
||||||
{
|
|
||||||
case ActionType.Sleep:
|
|
||||||
break;
|
|
||||||
case ActionType.Work:
|
|
||||||
break;
|
|
||||||
case ActionType.Eat:
|
|
||||||
break;
|
|
||||||
case ActionType.Dungeon:
|
|
||||||
break;
|
|
||||||
case ActionType.Housework:
|
|
||||||
animator.Play("Laundry");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
_textAnimCoroutine = StartCoroutine(TextDotsAnimation());
|
|
||||||
_autoHideCoroutine = StartCoroutine(AutoHidePanel());
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerator TextDotsAnimation()
|
|
||||||
{
|
|
||||||
var tempText = doingText.text;
|
|
||||||
float startTime = Time.time;
|
|
||||||
while (Time.time - startTime < 3)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 3; i++)
|
|
||||||
{
|
|
||||||
yield return new WaitForSeconds(0.3f);
|
|
||||||
doingText.text = tempText + new string('.', i + 1);
|
|
||||||
}
|
|
||||||
yield return new WaitForSeconds(0.3f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: a67d1bf02c4a3d34cb1b9709d9930fa1
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,41 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using TMPro;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class InteractionTextsContoller : MonoBehaviour
|
|
||||||
{
|
|
||||||
[SerializeField] private GameObject textsPanel;
|
|
||||||
[SerializeField] TMP_Text actionText;
|
|
||||||
[SerializeField] TMP_Text _descriptionText;
|
|
||||||
|
|
||||||
public void SetActionText(string text)
|
|
||||||
{
|
|
||||||
actionText.text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Panel 활성화를 끄고 텍스트들을 초기화 합니다.
|
|
||||||
/// </summary>
|
|
||||||
public void InitInteractionTexts()
|
|
||||||
{
|
|
||||||
textsPanel.SetActive(false);
|
|
||||||
SetActionText("");
|
|
||||||
_descriptionText.text = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 특정 범위 안에 상호작용 물체가 들어왔을 때, 상호작용 텍스트 패널을 활성화시킴
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="actionText">상호작용할 내용</param>
|
|
||||||
/// <param name="_descriptionText">스테이터스 변경에 대한 설명</param>
|
|
||||||
public void ActiveTexts(string actionText, string descriptionText = "")
|
|
||||||
{
|
|
||||||
SetActionText(actionText);
|
|
||||||
_descriptionText.text = descriptionText;
|
|
||||||
textsPanel.SetActive(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 1a9631c7b5512cc4ab41bbca8c17b945
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user