Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Transform[] SpawnPoints;
- public Transform[] EffectPoints;
- public float spawnTime = 1.5f;
- public float effectSpawnTime = 1f;
- public GameObject Coins;
- public GameObject Effect;
- int a = Random.Range(0, 4);
- // Use this for initialization
- void Start()
- {
- InvokeRepeating("SpawnParticle", effectSpawnTime, effectSpawnTime);
- InvokeRepeating("SpawnCoins", spawnTime, spawnTime);
- }
- // Update is called once per frame
- void Update()
- {
- }
- void SpawnCoins()
- {
- int spawnIndex = Random.Range(0, 4);
- Instantiate(Coins, SpawnPoints[spawnIndex].position, SpawnPoints[spawnIndex].rotation);
- }
- void SpawnParticle()
- {
- int spawnIndex = Random.Range(0, 4);
- Instantiate(Effect, EffectPoints[spawnIndex].position, EffectPoints[spawnIndex].rotation);
- }
Add Comment
Please, Sign In to add comment