player 데이터 싱글톤 구조로 변경
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
public class PlayerDataManager : SingletonBase<PlayerDataManager>
|
||||
{
|
||||
// 사용자가 생성해둔 플레이어 데이터를 싱글톤으로 전역 사용하기 위함
|
||||
public List<PlayerData> players { get; private set; }
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
LoadPlayerData();
|
||||
}
|
||||
|
||||
private void LoadPlayerData()
|
||||
{
|
||||
players = JSONLoader.LoadFromResources<List<PlayerData>>("Player");
|
||||
if (players == null)
|
||||
{
|
||||
players = new List<PlayerData>();
|
||||
Debug.LogError("⚠️ Player data loading failed. Check if 'Player.json' exists in Resources folder.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f52606f26bff734428ec67cdb89e0330
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user