parent
60e62cba0e
commit
040d273993
@ -0,0 +1,52 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class TownInfo : MonoBehaviour
|
||||
{
|
||||
public List<GameObject> goodsInTown = new List<GameObject>();
|
||||
public Transform townGoodsTempTransform;
|
||||
public GameObject goodsPrafab;
|
||||
|
||||
public List<Goods> goodsProduceInfo = new List<Goods>();
|
||||
|
||||
public Dictionary<GoodsType, int> townGoodsPrice;
|
||||
// Start is called before the first frame update
|
||||
private void Awake()
|
||||
{
|
||||
GenerateGoodsInTown();
|
||||
}
|
||||
|
||||
public void GenerateGoodsInTown()
|
||||
{
|
||||
townGoodsPrice = new Dictionary<GoodsType, int>();
|
||||
goodsInTown = new List<GameObject>();
|
||||
for (int i = 0; i < goodsProduceInfo.Count; i++)
|
||||
{
|
||||
if (goodsProduceInfo[i].isProducing)
|
||||
{
|
||||
townGoodsPrice.Add(goodsProduceInfo[i].goodsType, GoodsDatabase.instance.goodsPriceLookup[goodsProduceInfo[i].goodsType]);
|
||||
|
||||
goodsPrafab.GetComponent<SingleGoods>().goodsType = goodsProduceInfo[i].goodsType;
|
||||
/*for (int j = 0; j < Random.Range(1,3); j++)
|
||||
{
|
||||
GameObject _gameObject = Instantiate(goodsPrafab, townGoodsTempTransform, false);
|
||||
goodsInTown.Add(_gameObject);
|
||||
}*/
|
||||
GameObject _gameObject = Instantiate(goodsPrafab, townGoodsTempTransform, false);
|
||||
goodsInTown.Add(_gameObject);
|
||||
Debug.Log(goodsInTown.Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
townGoodsPrice.Add(goodsProduceInfo[i].goodsType, GoodsDatabase.instance.goodsPriceLookup[goodsProduceInfo[i].goodsType]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
int GetPrice(int _basePrice)
|
||||
{
|
||||
return _basePrice;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue