Exemple #1
0
 IEnumerator SpawnSequence(Vector3 position, float spawnDelay)
 {
     for (int i = 0; i < rewardAmount.Value; i++)
     {
         Instantiate(rewards.GetRandom(), position, Quaternion.identity);
         yield return(new WaitForSeconds(spawnDelay));
     }
 }
Exemple #2
0
 void Instantiate(Vector3 pos)
 {
             #if UNITY_EDITOR
     var   prefab   = toSpawn.GetRandom();
     var   instance = UnityEditor.PrefabUtility.InstantiatePrefab(prefab) as GameObject;
     float newScale = Random.Range(spawnedScale.x, spawnedScale.y);
     instance.transform.localScale *= newScale;
     instance.transform.position    = pos;
     instance.transform.parent      = parent ? parent : transform;
     instances.Add(instance);
             #endif
 }