From 4ae48da9505275b82a3e7d7828390ed3e9b96856 Mon Sep 17 00:00:00 2001 From: HaeinLEE Date: Sat, 10 May 2025 01:44:58 +0900 Subject: [PATCH 1/5] =?UTF-8?q?[Feat]=20=EB=8F=8C=EB=B0=9C=20=EC=9D=B4?= =?UTF-8?q?=EB=B2=A4=ED=8A=B8=20=EC=BB=B7=EC=94=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/LIN/Housing Copy.unity | 3 - Assets/LIN/ReHousing Copy.unity | 3 + ...y.unity.meta => ReHousing Copy.unity.meta} | 2 +- Assets/LIN/Resources.meta | 8 ++ .../DailyRoutine/InteractionController.cs | 92 +++++++------- Assets/LIN/Scripts/SuddenEventController.cs | 24 ---- .../LIN/Scripts/SuddenEventController.cs.meta | 3 - .../LIN/Scripts/UI/HousingCanvasController.cs | 42 +++++++ Assets/LIN/Scripts/UI/HousingConstants.cs | 14 ++- .../Scripts/UI/SuddenEventPanelController.cs | 0 .../UI/SuddenEventPanelController.cs.meta | 11 ++ Assets/LIN/Sprites/LateWork.PNG | 3 + Assets/LIN/Sprites/LateWork.PNG.meta | 114 ++++++++++++++++++ Assets/LIN/Sprites/TeamGathering.png | 3 + Assets/LIN/Sprites/TeamGathering.png.meta | 114 ++++++++++++++++++ 15 files changed, 362 insertions(+), 74 deletions(-) delete mode 100644 Assets/LIN/Housing Copy.unity create mode 100644 Assets/LIN/ReHousing Copy.unity rename Assets/LIN/{Housing Copy.unity.meta => ReHousing Copy.unity.meta} (74%) create mode 100644 Assets/LIN/Resources.meta delete mode 100644 Assets/LIN/Scripts/SuddenEventController.cs delete mode 100644 Assets/LIN/Scripts/SuddenEventController.cs.meta create mode 100644 Assets/LIN/Scripts/UI/SuddenEventPanelController.cs create mode 100644 Assets/LIN/Scripts/UI/SuddenEventPanelController.cs.meta create mode 100644 Assets/LIN/Sprites/LateWork.PNG create mode 100644 Assets/LIN/Sprites/LateWork.PNG.meta create mode 100644 Assets/LIN/Sprites/TeamGathering.png create mode 100644 Assets/LIN/Sprites/TeamGathering.png.meta diff --git a/Assets/LIN/Housing Copy.unity b/Assets/LIN/Housing Copy.unity deleted file mode 100644 index b9596720..00000000 --- a/Assets/LIN/Housing Copy.unity +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:243765a59e3126abd17abc02258bff6f2428294a5d373dacfe09c3ba123b5b96 -size 338192 diff --git a/Assets/LIN/ReHousing Copy.unity b/Assets/LIN/ReHousing Copy.unity new file mode 100644 index 00000000..e9025304 --- /dev/null +++ b/Assets/LIN/ReHousing Copy.unity @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b3f305cf446df76596f25e4ba247f35283cfba1441d7b2da7bfc3dcce6811e0a +size 607385 diff --git a/Assets/LIN/Housing Copy.unity.meta b/Assets/LIN/ReHousing Copy.unity.meta similarity index 74% rename from Assets/LIN/Housing Copy.unity.meta rename to Assets/LIN/ReHousing Copy.unity.meta index 221d7670..35a662c6 100644 --- a/Assets/LIN/Housing Copy.unity.meta +++ b/Assets/LIN/ReHousing Copy.unity.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 86c6ebc5f9b48c345bd9d6f402bdc848 +guid: 5324096d5b520144d873395ac6861fe5 DefaultImporter: externalObjects: {} userData: diff --git a/Assets/LIN/Resources.meta b/Assets/LIN/Resources.meta new file mode 100644 index 00000000..c8032f4f --- /dev/null +++ b/Assets/LIN/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0e2ae75cada1f20448baf1ac68f1a31d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs b/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs index 1814305a..8efea623 100644 --- a/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs +++ b/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs @@ -3,17 +3,17 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Serialization; +using Random = UnityEngine.Random; [RequireComponent(typeof(Rigidbody))] public class InteractionController : MonoBehaviour { [SerializeField] LayerMask interactionLayerMask; - [FormerlySerializedAs("housingCanvasManager")] - [Header("UI 연동")] - [SerializeField] HousingCanvasController housingCanvasController; + + [FormerlySerializedAs("housingCanvasManager")] [Header("UI 연동")] [SerializeField] + HousingCanvasController housingCanvasController; + [SerializeField] private InteractionAnimationPanelController interactionAnimationPanelController; - - private SuddenEventController _suddenEventController = new SuddenEventController(); private void Start() { @@ -23,88 +23,98 @@ public class InteractionController : MonoBehaviour // 상호작용 가능한 사물 범위에 들어올 때 private void OnTriggerEnter(Collider other) { - if(other.gameObject.layer == LayerMask.NameToLayer("NPC")) + if (other.gameObject.layer == LayerMask.NameToLayer("NPC")) { housingCanvasController.ShowNpcInteractionButton(() => { GameManager.Instance.StartNPCDialogue(GamePhase.Gameplay); }); } - + if (interactionLayerMask == (interactionLayerMask | (1 << other.gameObject.layer))) { ActionType interactionType = other.gameObject.GetComponent().RoutineEnter(); - if( interactionType != null ) + if (interactionType != null) { PopActionOnScreen(interactionType); } } } + // 사물에서 벗어날 때 UI 정리 private void OnTriggerExit(Collider other) { - if(other.gameObject.layer == LayerMask.NameToLayer("NPC")) housingCanvasController.HideInteractionButton(); - + if (other.gameObject.layer == LayerMask.NameToLayer("NPC")) housingCanvasController.HideInteractionButton(); + if (interactionLayerMask == (interactionLayerMask | (1 << other.gameObject.layer))) { housingCanvasController.HideInteractionButton(); housingCanvasController.interactionTextsController.InitInteractionTexts(); } } - + // ActionType 별로 화면에 상호작용 내용 표시, 상호작용 버튼에 이벤트 작성 private void PopActionOnScreen(ActionType interactionType) { HousingConstants.interactions.TryGetValue(interactionType, out var interactionTexts); - - housingCanvasController.ShowInteractionButton(interactionTexts.ActionText,interactionTexts.DescriptionText,()=> - { - if (PlayerStats.Instance.CanPerformByHealth(interactionType)) - { - PlayerStats.Instance.PerformAction(interactionType); - if (interactionType == ActionType.Dungeon) + housingCanvasController.ShowInteractionButton(interactionTexts.ActionText, interactionTexts.DescriptionText, + () => + { + if (PlayerStats.Instance.CanPerformByHealth(interactionType)) { - GameManager.Instance.ChangeToGameScene(); + PlayerStats.Instance.PerformAction(interactionType); + + if (interactionType == ActionType.Dungeon) + { + GameManager.Instance.ChangeToGameScene(); + } + else + { + GameManager.Instance.PlayInteractionSound(interactionType); + interactionAnimationPanelController.ShowAnimationPanel(interactionType, + interactionTexts.AnimationText); + } } else { - GameManager.Instance.PlayInteractionSound(interactionType); - interactionAnimationPanelController.ShowAnimationPanel(interactionType,interactionTexts.AnimationText); + housingCanvasController.interactionTextsController.ActiveTexts(interactionTexts.LackOfHealth); } - } - else - { - housingCanvasController.interactionTextsController.ActiveTexts(interactionTexts.LackOfHealth); - } - }); + }); } public Action SuddenEventHappen() { return null; } - - public void SuddenAfterWorkEventHappen() + + //퇴근 후 돌발 이벤트 + private AfterWorkEventType SuddenEventCalculator() { - AfterWorkEvent afterWorkEvent = _suddenEventController.SuddenEventCalculator(); - if (afterWorkEvent == AfterWorkEvent.None) - return; - switch (afterWorkEvent) + var index = Random.Range(0, HousingConstants.AFTER_WORK_DENOMINATOR); + return HousingConstants.AfterWorkEvents.GetValueOrDefault(index, AfterWorkEventType.None); + } + + private void SuddenAfterWorkEventHappen() + { + AfterWorkEventType afterWorkEventType = SuddenEventCalculator(); + Debug.Log(afterWorkEventType); + + if (afterWorkEventType == AfterWorkEventType.None) return; + switch (afterWorkEventType) { - case AfterWorkEvent.OvertimeWork: + case AfterWorkEventType.OvertimeWork: housingCanvasController.ShowSuddenEventPanel("부장님이 퇴근을 안하셔.. 야근할까?", () => { - //Todo: 컷씬과 스테이터스 변경 - housingCanvasController.HideSuddenEventPanel(); + housingCanvasController.ShowSuddenEventImage(0); + //Todo: 스테이터스 변경 }); break; - case AfterWorkEvent.TeamGathering: - housingCanvasController.ShowSuddenEventPanel("갑자기 팀 회식이 잡혔다. 참석 하러 가자", () => - { - housingCanvasController.HideSuddenEventPanel(); - }); + case AfterWorkEventType.TeamGathering: + housingCanvasController.ShowSuddenEventPanel("갑자기 팀 회식이 잡혔다. 참석 하러 가자", + () => { housingCanvasController.ShowSuddenEventImage(1); }); break; } + } } diff --git a/Assets/LIN/Scripts/SuddenEventController.cs b/Assets/LIN/Scripts/SuddenEventController.cs deleted file mode 100644 index f334803b..00000000 --- a/Assets/LIN/Scripts/SuddenEventController.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using Random = UnityEngine.Random; - -public class SuddenEventController -{ - // 랜덤 값에 일치하는 함수를 리턴하기 위한 딕셔너리 - // AFTER_WORK_DENOMINATOR 값 확정 후에 키 값 수정 - private Dictionary afterWorkEvents = new Dictionary(); - public SuddenEventController() - { - afterWorkEvents.Add(0, AfterWorkEvent.OvertimeWork); - afterWorkEvents.Add(1, AfterWorkEvent.TeamGathering); - } - - //퇴근 후 돌발 이벤트 - public AfterWorkEvent SuddenEventCalculator() - { - var index = Random.Range(0,HousingConstants.AFTER_WORK_DENOMINATOR); - return afterWorkEvents.GetValueOrDefault(index, AfterWorkEvent.None); - } - -} diff --git a/Assets/LIN/Scripts/SuddenEventController.cs.meta b/Assets/LIN/Scripts/SuddenEventController.cs.meta deleted file mode 100644 index 9645366a..00000000 --- a/Assets/LIN/Scripts/SuddenEventController.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 26ce8577425c4630903173b182839514 -timeCreated: 1745306651 \ No newline at end of file diff --git a/Assets/LIN/Scripts/UI/HousingCanvasController.cs b/Assets/LIN/Scripts/UI/HousingCanvasController.cs index 5259ac73..a97366ee 100644 --- a/Assets/LIN/Scripts/UI/HousingCanvasController.cs +++ b/Assets/LIN/Scripts/UI/HousingCanvasController.cs @@ -14,7 +14,10 @@ public class HousingCanvasController : MonoBehaviour [Header("돌발 이벤트")] [SerializeField] private GameObject suddenPanel; [SerializeField] private TMP_Text suddenText; + [SerializeField] private GameObject[] suddenEventImages; + private Coroutine _autoHideCoroutine; + public Action OnInteractionButtonPressed; public Action OnSuddenButtonPressed; @@ -72,6 +75,7 @@ public class HousingCanvasController : MonoBehaviour #region 돌발 이벤트 public void ShowSuddenEventPanel(string actText, Action onSuddenButtonPressed) { + Debug.Log("call evenet panel show"); suddenPanel.SetActive(true); suddenText.text = actText; OnSuddenButtonPressed += onSuddenButtonPressed; @@ -84,8 +88,46 @@ public class HousingCanvasController : MonoBehaviour } public void OnSuddenConfirmButton() { + suddenText.text = ""; OnSuddenButtonPressed?.Invoke(); } + + public void ShowSuddenEventImage(int index) + { + if (_autoHideCoroutine != null) StopCoroutine(_autoHideCoroutine); + + suddenEventImages[index].SetActive(true); + //사운드 재생 + + _autoHideCoroutine = StartCoroutine(AutoHideSuddenImage()); + + } + + public void HideSuddenEventImage() + { + foreach (var image in suddenEventImages) + { + image.SetActive(false); + } + } + private IEnumerator AutoHideSuddenImage() + { + float startTime = Time.time; + while (Time.time - startTime < 2.0f) + { + if (Input.touchCount > 0 || Input.GetMouseButtonDown(0)) + { + break; + } + yield return null; + } + + //패널 닫고 애니메이션 null처리 + HideSuddenEventImage(); + HideSuddenEventPanel(); + + _autoHideCoroutine = null; + } #endregion } diff --git a/Assets/LIN/Scripts/UI/HousingConstants.cs b/Assets/LIN/Scripts/UI/HousingConstants.cs index 4ff9d56c..88ad2c0b 100644 --- a/Assets/LIN/Scripts/UI/HousingConstants.cs +++ b/Assets/LIN/Scripts/UI/HousingConstants.cs @@ -2,7 +2,8 @@ using System.Collections.Generic; -public enum AfterWorkEvent + +public enum AfterWorkEventType { None, TeamGathering, @@ -12,7 +13,9 @@ public enum AfterWorkEvent public static class HousingConstants { //돌발 이벤트 확률 계산 - public static int AFTER_WORK_DENOMINATOR = 4; + public static int AFTER_WORK_DENOMINATOR = 2; + //돌발 이벤트 보여줄 시간 + public static float SUDDENEVENT_IAMGE_SHOW_TIME = 3.0f; #region 상호작용 멘트 @@ -47,4 +50,11 @@ public static class HousingConstants AnimationText = animationText; } } + + // 랜덤 값에 일치하는 함수를 리턴하기 위한 딕셔너리 + // AFTER_WORK_DENOMINATOR 값 확정 후에 키 값 수정 + public static readonly Dictionary AfterWorkEvents = new Dictionary { + {0, AfterWorkEventType.OvertimeWork}, + {1, AfterWorkEventType.TeamGathering} + }; } diff --git a/Assets/LIN/Scripts/UI/SuddenEventPanelController.cs b/Assets/LIN/Scripts/UI/SuddenEventPanelController.cs new file mode 100644 index 00000000..e69de29b diff --git a/Assets/LIN/Scripts/UI/SuddenEventPanelController.cs.meta b/Assets/LIN/Scripts/UI/SuddenEventPanelController.cs.meta new file mode 100644 index 00000000..3efc0576 --- /dev/null +++ b/Assets/LIN/Scripts/UI/SuddenEventPanelController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 82021c35b93bcfb4885be342e5ddd363 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LIN/Sprites/LateWork.PNG b/Assets/LIN/Sprites/LateWork.PNG new file mode 100644 index 00000000..fe42c53c --- /dev/null +++ b/Assets/LIN/Sprites/LateWork.PNG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e694da398fd95078615b05a4466907f7e05c8750afda731653babf85cf9b690 +size 443788 diff --git a/Assets/LIN/Sprites/LateWork.PNG.meta b/Assets/LIN/Sprites/LateWork.PNG.meta new file mode 100644 index 00000000..4036a83c --- /dev/null +++ b/Assets/LIN/Sprites/LateWork.PNG.meta @@ -0,0 +1,114 @@ +fileFormatVersion: 2 +guid: ccfd5bb6682e8484d8088d1a70dc9ccb +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LIN/Sprites/TeamGathering.png b/Assets/LIN/Sprites/TeamGathering.png new file mode 100644 index 00000000..9a146f3c --- /dev/null +++ b/Assets/LIN/Sprites/TeamGathering.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b226758da91494d86f71fdb18cd28ac8d06908c609ed4499c3fadb13218ddb95 +size 488518 diff --git a/Assets/LIN/Sprites/TeamGathering.png.meta b/Assets/LIN/Sprites/TeamGathering.png.meta new file mode 100644 index 00000000..eae074f3 --- /dev/null +++ b/Assets/LIN/Sprites/TeamGathering.png.meta @@ -0,0 +1,114 @@ +fileFormatVersion: 2 +guid: 516de2d9e0014d74bbec3c4a248d927c +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: From c17ec2c0a91a70dae74ff18425efeace7ef95f01 Mon Sep 17 00:00:00 2001 From: HaeinLEE Date: Sat, 10 May 2025 02:40:09 +0900 Subject: [PATCH 2/5] =?UTF-8?q?[Feat]=20=EB=8F=8C=EB=B0=9C=20=EC=9D=B4?= =?UTF-8?q?=EB=B2=A4=ED=8A=B8=20=EC=82=AC=EC=9A=B4=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EA=B7=B8=EB=A6=AC=EA=B3=A0=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/JAY/Scripts/PlayerController.cs | 2 +- Assets/LIN/Resources/OvertimeWork.mp3 | 3 + Assets/LIN/Resources/OvertimeWork.mp3.meta | 23 ++++++++ Assets/LIN/Resources/TeamGathering.mp3 | 3 + Assets/LIN/Resources/TeamGathering.mp3.meta | 23 ++++++++ .../DailyRoutine/InteractionController.cs | 31 +++++------ .../LIN/Scripts/UI/HousingCanvasController.cs | 24 +++++--- Assets/LIN/Scripts/UI/HousingConstants.cs | 29 +++++++++- .../Scripts/Common/GameUtility/GameSound.cs | 55 +++++++++++++++++++ 9 files changed, 164 insertions(+), 29 deletions(-) create mode 100644 Assets/LIN/Resources/OvertimeWork.mp3 create mode 100644 Assets/LIN/Resources/OvertimeWork.mp3.meta create mode 100644 Assets/LIN/Resources/TeamGathering.mp3 create mode 100644 Assets/LIN/Resources/TeamGathering.mp3.meta diff --git a/Assets/JAY/Scripts/PlayerController.cs b/Assets/JAY/Scripts/PlayerController.cs index 14b2319b..086d0b03 100644 --- a/Assets/JAY/Scripts/PlayerController.cs +++ b/Assets/JAY/Scripts/PlayerController.cs @@ -73,7 +73,7 @@ public class PlayerController : CharacterBase, IObserver _isBattle = !isHousingScene; Debug.Log("_isBattle: " + _isBattle);*/ - SwitchBattleMode(); + // SwitchBattleMode(); } private void Update() diff --git a/Assets/LIN/Resources/OvertimeWork.mp3 b/Assets/LIN/Resources/OvertimeWork.mp3 new file mode 100644 index 00000000..dcef9bd1 --- /dev/null +++ b/Assets/LIN/Resources/OvertimeWork.mp3 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4310396c1e8d49034500e133404bd740e2025fbc0351269a640c3300f489b47a +size 169272 diff --git a/Assets/LIN/Resources/OvertimeWork.mp3.meta b/Assets/LIN/Resources/OvertimeWork.mp3.meta new file mode 100644 index 00000000..f46cf0ea --- /dev/null +++ b/Assets/LIN/Resources/OvertimeWork.mp3.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 6142a6977f91d604d98880bdda758192 +AudioImporter: + externalObjects: {} + serializedVersion: 7 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + preloadAudioData: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LIN/Resources/TeamGathering.mp3 b/Assets/LIN/Resources/TeamGathering.mp3 new file mode 100644 index 00000000..0c09ff6c --- /dev/null +++ b/Assets/LIN/Resources/TeamGathering.mp3 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47138572c5bc5e2a2237c08408b5c2a26f57d719caf5342df71f41501f637a7c +size 446336 diff --git a/Assets/LIN/Resources/TeamGathering.mp3.meta b/Assets/LIN/Resources/TeamGathering.mp3.meta new file mode 100644 index 00000000..93cb2e64 --- /dev/null +++ b/Assets/LIN/Resources/TeamGathering.mp3.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 59471df5d383e88478a567ac9b1e83d4 +AudioImporter: + externalObjects: {} + serializedVersion: 7 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + preloadAudioData: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs b/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs index 8efea623..d9217d97 100644 --- a/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs +++ b/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs @@ -88,33 +88,30 @@ public class InteractionController : MonoBehaviour return null; } - //퇴근 후 돌발 이벤트 + #region 퇴근 후 돌발 이벤트 + + //이벤트 발생 확률 계산기 private AfterWorkEventType SuddenEventCalculator() { var index = Random.Range(0, HousingConstants.AFTER_WORK_DENOMINATOR); return HousingConstants.AfterWorkEvents.GetValueOrDefault(index, AfterWorkEventType.None); } + // Interaction Controller와 같은 방식으로 작동됩니다. private void SuddenAfterWorkEventHappen() { AfterWorkEventType afterWorkEventType = SuddenEventCalculator(); - Debug.Log(afterWorkEventType); - if (afterWorkEventType == AfterWorkEventType.None) return; - switch (afterWorkEventType) - { - case AfterWorkEventType.OvertimeWork: - housingCanvasController.ShowSuddenEventPanel("부장님이 퇴근을 안하셔.. 야근할까?", () => - { - housingCanvasController.ShowSuddenEventImage(0); - //Todo: 스테이터스 변경 - }); - break; - case AfterWorkEventType.TeamGathering: - housingCanvasController.ShowSuddenEventPanel("갑자기 팀 회식이 잡혔다. 참석 하러 가자", - () => { housingCanvasController.ShowSuddenEventImage(1); }); - break; - } + HousingConstants.SuddenEventTexts.TryGetValue(afterWorkEventType, out string suddenEventText); + + housingCanvasController.ShowSuddenEventPanel(suddenEventText, () => + { + housingCanvasController.ShowSuddenEventImage(afterWorkEventType); + GameManager.Instance.PlaySuddenEventSound(afterWorkEventType); + }); } + + #endregion + } diff --git a/Assets/LIN/Scripts/UI/HousingCanvasController.cs b/Assets/LIN/Scripts/UI/HousingCanvasController.cs index a97366ee..d93c78a0 100644 --- a/Assets/LIN/Scripts/UI/HousingCanvasController.cs +++ b/Assets/LIN/Scripts/UI/HousingCanvasController.cs @@ -92,15 +92,22 @@ public class HousingCanvasController : MonoBehaviour OnSuddenButtonPressed?.Invoke(); } - public void ShowSuddenEventImage(int index) + public void ShowSuddenEventImage(AfterWorkEventType afterWorkEventType) { if (_autoHideCoroutine != null) StopCoroutine(_autoHideCoroutine); - - suddenEventImages[index].SetActive(true); + + switch (afterWorkEventType) + { + case AfterWorkEventType.OvertimeWork: + suddenEventImages[0].SetActive(true); + break; + case AfterWorkEventType.TeamGathering: + suddenEventImages[1].SetActive(true); + break; + } //사운드 재생 - _autoHideCoroutine = StartCoroutine(AutoHideSuddenImage()); - + _autoHideCoroutine = StartCoroutine(AutoHideSuddenImage(afterWorkEventType)); } public void HideSuddenEventImage() @@ -110,10 +117,10 @@ public class HousingCanvasController : MonoBehaviour image.SetActive(false); } } - private IEnumerator AutoHideSuddenImage() + private IEnumerator AutoHideSuddenImage(AfterWorkEventType afterWorkEventType) { float startTime = Time.time; - while (Time.time - startTime < 2.0f) + while (Time.time - startTime < HousingConstants.SUDDENEVENT_IAMGE_SHOW_TIME) { if (Input.touchCount > 0 || Input.GetMouseButtonDown(0)) { @@ -122,9 +129,10 @@ public class HousingCanvasController : MonoBehaviour yield return null; } - //패널 닫고 애니메이션 null처리 + //패널 닫고 효과음 끄기 HideSuddenEventImage(); HideSuddenEventPanel(); + GameManager.Instance.StopSuddenEventSound(afterWorkEventType); _autoHideCoroutine = null; } diff --git a/Assets/LIN/Scripts/UI/HousingConstants.cs b/Assets/LIN/Scripts/UI/HousingConstants.cs index 88ad2c0b..6f1e189d 100644 --- a/Assets/LIN/Scripts/UI/HousingConstants.cs +++ b/Assets/LIN/Scripts/UI/HousingConstants.cs @@ -15,7 +15,7 @@ public static class HousingConstants //돌발 이벤트 확률 계산 public static int AFTER_WORK_DENOMINATOR = 2; //돌발 이벤트 보여줄 시간 - public static float SUDDENEVENT_IAMGE_SHOW_TIME = 3.0f; + public static float SUDDENEVENT_IAMGE_SHOW_TIME = 4.0f; #region 상호작용 멘트 @@ -33,7 +33,6 @@ public static class HousingConstants "도저히 출근할 체력이 안되는걸..?","출근하는 중")}, { ActionType.Eat, new InteractionTexts("식사를 하자","1시간 동안 체력 1을 회복한다.","밥 먹는 중") } }; - #endregion public struct InteractionTexts { @@ -50,9 +49,33 @@ public static class HousingConstants AnimationText = animationText; } } + #endregion + + #region 돌발 이벤트 + + public static readonly Dictionary SuddenEventTexts = + new Dictionary + { + { AfterWorkEventType.OvertimeWork, "부장님이 퇴근을 안하셔.. 야근할까?" }, + { AfterWorkEventType.TeamGathering, "갑자기 팀 회식이 잡혔다. 참석 하러 가자"} + }; + + public struct SuddenEventTypes + { + public AfterWorkEventType AfterWorkEvent { get; private set; } + public string AfterWorkEventText { get; private set; } + + public SuddenEventTypes(AfterWorkEventType afterWorkEvent, string afterWorkEventText) + { + AfterWorkEvent = afterWorkEvent; + AfterWorkEventText = afterWorkEventText; + } + } + + #endregion // 랜덤 값에 일치하는 함수를 리턴하기 위한 딕셔너리 - // AFTER_WORK_DENOMINATOR 값 확정 후에 키 값 수정 + // TODO: AFTER_WORK_DENOMINATOR 값 확정 후에 키 값 수정 public static readonly Dictionary AfterWorkEvents = new Dictionary { {0, AfterWorkEventType.OvertimeWork}, {1, AfterWorkEventType.TeamGathering} diff --git a/Assets/Scripts/Common/GameUtility/GameSound.cs b/Assets/Scripts/Common/GameUtility/GameSound.cs index ff3e9f02..b4423a26 100644 --- a/Assets/Scripts/Common/GameUtility/GameSound.cs +++ b/Assets/Scripts/Common/GameUtility/GameSound.cs @@ -27,6 +27,10 @@ public partial class GameManager [SerializeField] private AudioClip eatingSFX; [SerializeField] private AudioClip sleepingSFX; + [Header("돌발 이벤트 효과음")] + [SerializeField] private AudioClip overtimeWorkSFX; + [SerializeField] private AudioClip teamGatheringSFX; + [Header("게임 결과 효과음")] [SerializeField] private AudioClip gameOverSFX; [SerializeField] private AudioClip victorySFX; @@ -83,6 +87,10 @@ public partial class GameManager if (goToDungeonSFX != null) SafeSoundManager?.LoadAudioClip("Dungeon", goToDungeonSFX); if (eatingSFX != null) SafeSoundManager?.LoadAudioClip("Eating", eatingSFX); if (sleepingSFX != null) SafeSoundManager?.LoadAudioClip("Sleeping", sleepingSFX); + + // 돌발 이벤트 효과음 등록 + if(overtimeWorkSFX != null) SafeSoundManager?.LoadAudioClip("OvertimeWork", overtimeWorkSFX); + if(teamGatheringSFX != null) SafeSoundManager?.LoadAudioClip("TeamGathering", teamGatheringSFX); // 플레이어 전투 효과음 등록 if (housingFootstepSFX != null) SafeSoundManager?.LoadAudioClip("HousingFootstep", housingFootstepSFX); @@ -297,6 +305,53 @@ public partial class GameManager } } + #endregion + + #region 돌발 이벤트 + public void PlaySuddenEventSound(AfterWorkEventType afterWorkEventType) + { + // 배경음 중지 (페이드아웃) + SafeSoundManager?.StopBGM(true, 0.5f); + + // 효과음 재생 + switch (afterWorkEventType) + { + case AfterWorkEventType.TeamGathering: + SafeSoundManager?.PlaySFX("TeamGathering"); + break; + case AfterWorkEventType.OvertimeWork: + SafeSoundManager?.PlaySFX("OvertimeWork"); + break; + } + } + + // 상호작용 효과음 종료 + public void StopSuddenEventSound(AfterWorkEventType afterWorkEventType, float fadeTime = 0.5f) + { + string sfxName = ""; + + switch (afterWorkEventType) + { + case AfterWorkEventType.TeamGathering: + sfxName = "TeamGathering"; + break; + case AfterWorkEventType.OvertimeWork: + sfxName = "OvertimeWork"; + break; + } + + if (!string.IsNullOrEmpty(sfxName)) + { + SafeSoundManager?.FadeOutSFXByName(sfxName, fadeTime); + + // 배경음 재개 + if (wasPlayingBGM && previousBGMClip != null) + { + StartCoroutine(FadeOutAndPlayBGM(sfxName, fadeTime)); + } + } + } + #endregion #region 플레이어 전투 효과음 제어 From 4a8e62c8beec25da21308a5377b5c445afa5fb93 Mon Sep 17 00:00:00 2001 From: HaeinLEE Date: Mon, 12 May 2025 09:21:32 +0900 Subject: [PATCH 3/5] =?UTF-8?q?[Test]=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EC=9A=A9=20=EC=A3=BC=EC=84=9D=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/JAY/Scripts/PlayerController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/JAY/Scripts/PlayerController.cs b/Assets/JAY/Scripts/PlayerController.cs index 086d0b03..41113e14 100644 --- a/Assets/JAY/Scripts/PlayerController.cs +++ b/Assets/JAY/Scripts/PlayerController.cs @@ -67,13 +67,13 @@ public class PlayerController : CharacterBase, IObserver hitEffectController = GetComponentInChildren(); PlayerInit(); - + // isBattle 초기화 (임시) /*bool isHousingScene = SceneManager.GetActiveScene().name.Contains("Housing"); _isBattle = !isHousingScene; Debug.Log("_isBattle: " + _isBattle);*/ - // SwitchBattleMode(); + SwitchBattleMode(); } private void Update() From fcecd38c3f712f3641ac539f0e5f8bec5e1c180b Mon Sep 17 00:00:00 2001 From: HaeinLEE Date: Mon, 12 May 2025 09:24:19 +0900 Subject: [PATCH 4/5] =?UTF-8?q?[Remove]=20=ED=95=84=EC=9A=94=20=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=ED=97=A4=EB=8D=94=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/LIN/Scripts/DailyRoutine/InteractionController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs b/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs index d9217d97..d984587b 100644 --- a/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs +++ b/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs @@ -10,7 +10,7 @@ public class InteractionController : MonoBehaviour { [SerializeField] LayerMask interactionLayerMask; - [FormerlySerializedAs("housingCanvasManager")] [Header("UI 연동")] [SerializeField] + [Header("UI 연동")] [SerializeField] HousingCanvasController housingCanvasController; [SerializeField] private InteractionAnimationPanelController interactionAnimationPanelController; From 83dd8c6f94d12454d56c1aa493d5ae6383b651ed Mon Sep 17 00:00:00 2001 From: HaeinLEE Date: Mon, 12 May 2025 09:37:06 +0900 Subject: [PATCH 5/5] =?UTF-8?q?[Fix]=20=EC=B6=A9=EB=8F=8C=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A6=BD=ED=8A=B8=20=EB=A9=94=EC=9D=B8=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EA=B0=80=EC=A0=B8=EC=98=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/JAY/Scripts/PlayerController.cs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/Assets/JAY/Scripts/PlayerController.cs b/Assets/JAY/Scripts/PlayerController.cs index 41113e14..1d3e3503 100644 --- a/Assets/JAY/Scripts/PlayerController.cs +++ b/Assets/JAY/Scripts/PlayerController.cs @@ -56,6 +56,10 @@ public class PlayerController : CharacterBase, IObserver Joystick = FindObjectOfType(); } + // isBattle 초기화 (임시) + bool isHousingScene = SceneManager.GetActiveScene().name.Contains("Housing"); + _isBattle = !isHousingScene; + AssignCharacterController(); AssignAnimator(); } @@ -67,13 +71,6 @@ public class PlayerController : CharacterBase, IObserver hitEffectController = GetComponentInChildren(); PlayerInit(); - - // isBattle 초기화 (임시) - /*bool isHousingScene = SceneManager.GetActiveScene().name.Contains("Housing"); - _isBattle = !isHousingScene; - Debug.Log("_isBattle: " + _isBattle);*/ - - SwitchBattleMode(); } private void Update() @@ -96,7 +93,9 @@ public class PlayerController : CharacterBase, IObserver // 공격 입력 처리 if (Input.GetKeyDown(KeyCode.X) && (_currentAction == null || !_currentAction.IsActive) - && (CurrentState != PlayerState.Win && CurrentState != PlayerState.Dead)) { + && (CurrentState != PlayerState.Win && CurrentState != PlayerState.Dead)) + { + GameManager.Instance.PlayPlayerAttackSound(); StartAttackAction(); } @@ -219,13 +218,18 @@ public class PlayerController : CharacterBase, IObserver } - public void StartAttackAction() { + public void StartAttackAction() + { + if (!_isBattle) return; + _currentAction = _attackAction; _currentAction.StartAction(this); } public void StartDashAction() { + if (!_isBattle) return; + // 만약 공격 중이면 강제로 공격 종료 if (_currentAction == _attackAction && _attackAction.IsActive) { @@ -400,6 +404,7 @@ public class PlayerController : CharacterBase, IObserver if (character != this) return; if (CurrentState == PlayerState.Dead) return; + GameManager.Instance.PlayPlayerHitSound(); SetState(PlayerState.Hit); }