26 lines
752 B
C#
26 lines
752 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
|
|
namespace Fruitomation.Game
|
|
{
|
|
[CreateAssetMenu] public class BuildingRegistry : ScriptableObject
|
|
{
|
|
[System.Serializable] public class BuildingInfo
|
|
{
|
|
public string Name;
|
|
public BuildingUnlock Requirement;
|
|
public AutomationBuildingType Type;
|
|
public GameObject Prefab;
|
|
}
|
|
|
|
[SerializeField] private List<BuildingInfo> Buildings;
|
|
public BuildingInfo[] GetBuildings() => Buildings.ToArray();
|
|
|
|
public GameObject GetBuildingOf(string building)
|
|
{
|
|
return (from info in Buildings where info.Name == building select info.Prefab).FirstOrDefault();
|
|
}
|
|
}
|
|
}
|