Exemplo n.º 1
0
    private void Spawn(LootPackage lootPackage)
    {
        int amount = lootPackage.amountMin;

        if (lootPackage.random)
        {
            amount = Random.Range(lootPackage.amountMin, lootPackage.amountMax);
        }
        StartCoroutine(SpawnTimed(amount, lootPackage));
    }
Exemplo n.º 2
0
    private void InstantiateLootChild(LootPackage lootPackage)
    {
        GameObject objToSpawn = new GameObject("LootChild_" + name);

        //Add Components
        objToSpawn.AddComponent <LootChild>();
        objToSpawn.transform.position = transform.position;
        objToSpawn.transform.parent   = EffectCollection.GetInstance().transform;
        LootChild lc = objToSpawn.GetComponent <LootChild>();

        lc.SpawnLoot(lootPackage);
    }
Exemplo n.º 3
0
    IEnumerator SpawnTimed(int amount, LootPackage lootPackage)
    {
        Debug.Log("Amount Spawn:" + amount);
        for (int i = 0; i < amount; i++)
        {
            Debug.Log("Spawn " + i);
            int pos = Random.Range(0, lootPackage.prefabLootList.Length);
            InstantiateEffect(lootPackage.prefabLootList[pos]);
            Debug.Log("Instantiate complete ");
            yield return(new WaitForSeconds(0.01F));

            Debug.Log("Waited for seconds " + i);
        }
        Destroy(gameObject);
    }
Exemplo n.º 4
0
 public void SpawnLoot(LootPackage lootPackage)
 {
     Spawn(lootPackage);
 }