Guest User

Untitled

a guest
Oct 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class PlaceBlocks : MonoBehaviour {
  4.  
  5. [SerializeField]
  6. protected GameObject block;
  7. [SerializeField]
  8. protected float separation = 20f;
  9. [SerializeField]
  10. protected float reduction = 1f;
  11. [SerializeField]
  12. protected float blockHeight = 2f;
  13. [SerializeField]
  14. protected int blockCount = 10;
  15.  
  16. void Start () {
  17. float currentSeparation = separation;
  18. for(int x = 0; x < blockCount; x++)
  19. {
  20. GameObject obj1 = GameObject.Instantiate(block);
  21. GameObject obj2 = GameObject.Instantiate(block);
  22. obj1.transform.position = new Vector3(-currentSeparation, blockHeight * x, 0);
  23. obj2.transform.position = new Vector3(currentSeparation, blockHeight * x, 0);
  24. currentSeparation -= reduction;
  25. }
  26. }
  27. }
Add Comment
Please, Sign In to add comment