51 lines
1.5 KiB
C#

using System.Collections.Generic;
using UnityEngine;
namespace Streamingle.Background
{
/// <summary>
/// 배경 씬 데이터를 저장하는 ScriptableObject
/// </summary>
[CreateAssetMenu(fileName = "BackgroundSceneDatabase", menuName = "Streamingle/Background Scene Database")]
public class BackgroundSceneDatabase : ScriptableObject
{
public List<BackgroundSceneInfo> scenes = new List<BackgroundSceneInfo>();
/// <summary>
/// 카테고리별로 씬 목록 반환
/// </summary>
public Dictionary<string, List<BackgroundSceneInfo>> GetScenesByCategory()
{
var result = new Dictionary<string, List<BackgroundSceneInfo>>();
foreach (var scene in scenes)
{
string category = scene.Category;
if (!result.ContainsKey(category))
{
result[category] = new List<BackgroundSceneInfo>();
}
result[category].Add(scene);
}
return result;
}
/// <summary>
/// 씬 이름으로 검색
/// </summary>
public BackgroundSceneInfo FindByName(string sceneName)
{
return scenes.Find(s => s.sceneName == sceneName);
}
/// <summary>
/// 씬 경로로 검색
/// </summary>
public BackgroundSceneInfo FindByPath(string scenePath)
{
return scenes.Find(s => s.scenePath == scenePath);
}
}
}