29 lines
648 B
C#
29 lines
648 B
C#
|
|
using UnityEngine;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using TMPro;
|
||
|
|
|
||
|
|
public class ShopManager : MonoBehaviour
|
||
|
|
{
|
||
|
|
public static ShopManager Instance;
|
||
|
|
public List<ItemData> allPossibleItems;
|
||
|
|
public ShopSlot[] shopSlots;
|
||
|
|
|
||
|
|
private void Start()
|
||
|
|
{
|
||
|
|
GenerateRandomShop();
|
||
|
|
}
|
||
|
|
|
||
|
|
public void GenerateRandomShop()
|
||
|
|
{
|
||
|
|
for (int i = 0; i < shopSlots.Length; i++)
|
||
|
|
{
|
||
|
|
if (allPossibleItems.Count == 0)
|
||
|
|
{
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
int randomIndex = Random.Range(0, allPossibleItems.Count);
|
||
|
|
shopSlots[i].Setup(allPossibleItems[randomIndex]);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|