Guest User

Untitled

a guest
Nov 18th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. public Transform[] SpawnPoints;
  2. public Transform[] EffectPoints;
  3.  
  4.  
  5. public float spawnTime = 1.5f;
  6. public float effectSpawnTime = 1f;
  7.  
  8. public GameObject Coins;
  9. public GameObject Effect;
  10.  
  11. int a = Random.Range(0, 4);
  12.  
  13.  
  14. // Use this for initialization
  15. void Start()
  16. {
  17.  
  18. InvokeRepeating("SpawnParticle", effectSpawnTime, effectSpawnTime);
  19. InvokeRepeating("SpawnCoins", spawnTime, spawnTime);
  20. }
  21.  
  22. // Update is called once per frame
  23. void Update()
  24. {
  25.  
  26. }
  27.  
  28. void SpawnCoins()
  29. {
  30.  
  31. int spawnIndex = Random.Range(0, 4);
  32. Instantiate(Coins, SpawnPoints[spawnIndex].position, SpawnPoints[spawnIndex].rotation);
  33. }
  34. void SpawnParticle()
  35. {
  36. int spawnIndex = Random.Range(0, 4);
  37. Instantiate(Effect, EffectPoints[spawnIndex].position, EffectPoints[spawnIndex].rotation);
  38. }
Add Comment
Please, Sign In to add comment