2026-05-22 보스스킬 : 지진
This commit is contained in:
29
Assets/02_Scripts/Managers/GameManager.cs
Normal file
29
Assets/02_Scripts/Managers/GameManager.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GameManager : MonoBehaviour,ISceneInitializable
|
||||
{
|
||||
public static GameManager Instance;
|
||||
|
||||
public SkillSupport SkillSupporter {get; private set;}
|
||||
public PlayerController LocalPlayer {get; private set;}
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this; //만들어진 자신을 인스턴스로 설정
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject); //이미 인스턴스가 있으면 자신을 파괴
|
||||
}
|
||||
}
|
||||
|
||||
public void OnSceneLoaded()
|
||||
{
|
||||
Debug.Log("aaaa");
|
||||
SkillSupporter = Object.FindFirstObjectByType<SkillSupport>();
|
||||
LocalPlayer = Object.FindFirstObjectByType<PlayerController>();
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Managers/GameManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/GameManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b2c0a8cf5c55bc4da93c75f61309de6
|
||||
@@ -31,19 +31,18 @@ private void Update()
|
||||
//씬이 로드되었을때 호출
|
||||
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
if(scene.name == "GameScene")
|
||||
{
|
||||
MonoBehaviour[] allObjs = UnityEngine.Object.FindObjectsByType<MonoBehaviour>(FindObjectsSortMode.None);
|
||||
|
||||
foreach (var obj in allObjs)
|
||||
MonoBehaviour[] allObjs = UnityEngine.Object.FindObjectsByType<MonoBehaviour>(FindObjectsSortMode.None);
|
||||
|
||||
foreach (var obj in allObjs)
|
||||
{
|
||||
if (obj is ISceneInitializable initializable)
|
||||
{
|
||||
if (obj is ISceneInitializable initializable)
|
||||
{
|
||||
//씬에서 ISceneInitializable 인터페이스를 가진 오브젝트의 초기화 로직을 실행
|
||||
initializable.OnSceneLoaded();
|
||||
}
|
||||
//씬에서 ISceneInitializable 인터페이스를 가진 오브젝트의 초기화 로직을 실행
|
||||
initializable.OnSceneLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void SetSceneLoadingProgressValue(float value)
|
||||
|
||||
Reference in New Issue
Block a user