Esempio n. 1
0
 void Start()
 {
     mybody          = GetComponent <Rigidbody2D>();
     direction       = 0;
     Inventory.money = new int[(CurrencyColor.GetValues(typeof(CurrencyColor)).Length)];
     Inventory.items = new List <short>();
 }
Esempio n. 2
0
    public static void Setup(ItemList itemList)
    {
        open    = false;
        itemIds = new List <short>();

        int amount = Random.Range(3, 6);

        for (int i = 0; i < amount; i++)
        {
            int index = Random.Range(0, itemList.items.Count);
            itemIds.Add(itemList.items[index].id);
            // Randomize each item's cost and type of currency
            itemList.items[index].costAmount = (short)Random.Range(1, 6);
            itemList.items[index].costType   = (CurrencyColor)Random.Range(0, (CurrencyColor.GetValues(typeof(CurrencyColor)).Length));
        }
        ready = true;
    }
Esempio n. 3
0
    IEnumerator SpawnMoney(float time)
    {
        yield return(new WaitForSeconds(time));

        while (Shop.open)
        {
            yield return(null);
        }
        if (!Shop.CheckEmpty())
        {
            float spawnx = Random.Range(leftLimit, rightLimit);
            temp = Instantiate(currencyPrefab, new Vector2(spawnx, this.transform.position.y), Quaternion.identity);
            temp.GetComponent <CurrencyController>().myColor = (CurrencyColor)Random.Range(0, (CurrencyColor.GetValues(typeof(CurrencyColor)).Length));
            StartCoroutine(SpawnMoney(Random.Range(minTime, maxTime)));
        }
    }