From bd44a7cdc5de1a4795af313f520b492b8057ca23 Mon Sep 17 00:00:00 2001 From: Sehyeon Date: Wed, 16 Apr 2025 17:19:58 +0900 Subject: [PATCH] =?UTF-8?q?DEG-15=20=EA=B8=B0=EB=B3=B8=20=ED=81=B4?= =?UTF-8?q?=EB=9E=98=EC=8A=A4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspectionProfiles/Project_Default.xml | 6 +++ Assets/KSH.meta | 8 ++++ Assets/KSH/GameConstants.cs | 10 +++++ Assets/KSH/GameConstants.cs.meta | 11 +++++ Assets/KSH/GameManager.cs | 34 ++++++++++++++ Assets/KSH/GameManager.cs.meta | 11 +++++ Assets/KSH/PlayerStats.cs | 8 ++++ Assets/KSH/PlayerStats.cs.meta | 11 +++++ Assets/KSH/Singleton.cs | 45 +++++++++++++++++++ Assets/KSH/Singleton.cs.meta | 11 +++++ 10 files changed, 155 insertions(+) create mode 100644 .idea/.idea.Degulleo3D/.idea/inspectionProfiles/Project_Default.xml create mode 100644 Assets/KSH.meta create mode 100644 Assets/KSH/GameConstants.cs create mode 100644 Assets/KSH/GameConstants.cs.meta create mode 100644 Assets/KSH/GameManager.cs create mode 100644 Assets/KSH/GameManager.cs.meta create mode 100644 Assets/KSH/PlayerStats.cs create mode 100644 Assets/KSH/PlayerStats.cs.meta create mode 100644 Assets/KSH/Singleton.cs create mode 100644 Assets/KSH/Singleton.cs.meta diff --git a/.idea/.idea.Degulleo3D/.idea/inspectionProfiles/Project_Default.xml b/.idea/.idea.Degulleo3D/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000..dfb35ffb --- /dev/null +++ b/.idea/.idea.Degulleo3D/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/Assets/KSH.meta b/Assets/KSH.meta new file mode 100644 index 00000000..32286553 --- /dev/null +++ b/Assets/KSH.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8899b70334c78204fb97b6da706ac4c6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/KSH/GameConstants.cs b/Assets/KSH/GameConstants.cs new file mode 100644 index 00000000..66c4bf53 --- /dev/null +++ b/Assets/KSH/GameConstants.cs @@ -0,0 +1,10 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + + + +public class GameConstants : MonoBehaviour +{ + +} diff --git a/Assets/KSH/GameConstants.cs.meta b/Assets/KSH/GameConstants.cs.meta new file mode 100644 index 00000000..7fb223ac --- /dev/null +++ b/Assets/KSH/GameConstants.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1e1682026c3858a4f8974675387aaf5a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/KSH/GameManager.cs b/Assets/KSH/GameManager.cs new file mode 100644 index 00000000..73945d41 --- /dev/null +++ b/Assets/KSH/GameManager.cs @@ -0,0 +1,34 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.SceneManagement; + +public class GameManager : Singleton +{ + private Canvas _canvas; + + public void ChangeToGameScene() + { + SceneManager.LoadScene("Game"); // 던전 Scene + } + + public void ChangeToMainScene() + { + SceneManager.LoadScene("Housing"); // Home Scene + } + + // ToDo: Open Setting Panel 등 Panel 처리 + + protected override void OnSceneLoaded(Scene scene, LoadSceneMode mode) + { + // ToDo: 씬 로드 시 동작 구현. ex: BGM 변경 + + // UI용 Canvas 찾기 + // _canvas = GameObject.FindObjectOfType(); + } + + private void OnApplicationQuit() + { + // TODO: 게임 종료 시 로직 추가 + } +} diff --git a/Assets/KSH/GameManager.cs.meta b/Assets/KSH/GameManager.cs.meta new file mode 100644 index 00000000..7f546e24 --- /dev/null +++ b/Assets/KSH/GameManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 450038edae05f9b4d94ff56c62444048 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/KSH/PlayerStats.cs b/Assets/KSH/PlayerStats.cs new file mode 100644 index 00000000..e0ba559f --- /dev/null +++ b/Assets/KSH/PlayerStats.cs @@ -0,0 +1,8 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class PlayerStats : MonoBehaviour +{ + +} diff --git a/Assets/KSH/PlayerStats.cs.meta b/Assets/KSH/PlayerStats.cs.meta new file mode 100644 index 00000000..448b945c --- /dev/null +++ b/Assets/KSH/PlayerStats.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8bccfaf46267e2544aa4bae52756f182 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/KSH/Singleton.cs b/Assets/KSH/Singleton.cs new file mode 100644 index 00000000..9cc4927b --- /dev/null +++ b/Assets/KSH/Singleton.cs @@ -0,0 +1,45 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.SceneManagement; + +public abstract class Singleton : MonoBehaviour where T : Component +{ + private static T _instance; + + public static T Instance + { + get + { + if (_instance == null) + { + _instance = FindObjectOfType(); + if (_instance == null) + { + GameObject obj = new GameObject(); + obj.name = typeof(T).Name; + _instance = obj.AddComponent(); + } + } + return _instance; + } + } + + void Awake() + { + if (_instance == null) + { + _instance = this as T; + DontDestroyOnLoad(gameObject); // obj가 destory 안되도록 설정 + + // 씬 전환시 호출되는 액션 메서드 할당 + SceneManager.sceneLoaded += OnSceneLoaded; + } + else + { + Destroy(gameObject); + } + } + + protected abstract void OnSceneLoaded(Scene scene, LoadSceneMode mode); +} diff --git a/Assets/KSH/Singleton.cs.meta b/Assets/KSH/Singleton.cs.meta new file mode 100644 index 00000000..477ec449 --- /dev/null +++ b/Assets/KSH/Singleton.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 014fe0082bc24a041a78cce62ba16b5d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: