using System.Collections; using System.Collections.Generic; using UnityEngine; public class GoodsDatabase : MonoBehaviour { public static GoodsDatabase instance; public List goodsInfo = new List(); public Dictionary goodsNameLookup; public Dictionary goodsPriceLookup; public Dictionary goodsSpriteLookup; // Start is called before the first frame update private void Awake() { instance = this; goodsNameLookup = new Dictionary(); for(int i = 0; i < goodsInfo.Count; i++) { goodsNameLookup.Add(goodsInfo[i].goodsType, goodsInfo[i].goodsName); } goodsPriceLookup = new Dictionary(); for (int i = 0; i < goodsInfo.Count; i++) { goodsPriceLookup.Add(goodsInfo[i].goodsType, goodsInfo[i].basePrice); } goodsSpriteLookup = new Dictionary(); for (int i = 0; i < goodsInfo.Count; i++) { goodsSpriteLookup.Add(goodsInfo[i].goodsType, goodsInfo[i].sprite); } } } [System.Serializable] public class Goods { public GoodsType goodsType; public string goodsName; public int basePrice; public Sprite sprite; public bool isProducing; } public enum GoodsType { Redbottle, Bluebottle, }