You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.4 KiB

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