Advertisement
LittleAngel

Untitled

May 9th, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class CoinController : MonoBehaviour {
  5.  
  6. public GameObject coin;
  7. public int coinCount;
  8. public float spacing;
  9.  
  10. void Start () {
  11. SpawnCoins ();
  12. }
  13.  
  14. void SpawnCoins () {
  15. for (int i = 0; i < coinCount; i++) {
  16. Vector3 spawnPosition = new Vector3 (transform.position.x,transform.position.y + 1,transform.position.z + i *spacing);
  17. Instantiate(coin, spawnPosition, Quaternion.identity);
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement