Advertisement
Guest User

Untitled

a guest
May 25th, 2014
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class world : MonoBehaviour {
  5.  
  6.  
  7. public GameObject brick;
  8.  
  9.  
  10. GameObject[, ,] block_map;
  11. int[, ,] map = new int[32,32,32];
  12. public GameObject[] blocks;
  13.  
  14. void Start() {
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21. for (int x = 0; x < 32; x++) {//ground
  22. for (int y = 0; y <32; y++) {
  23.  
  24. for (int z = 0; z < 32; z++) {
  25. switch (y)
  26. {
  27. case 0:
  28.  
  29. case 1:
  30. map[x,y,z]=1;
  31.  
  32. break;
  33. case 2:
  34. map[x,y,z]=(int)Mathf.Ceil(Random.Range(1, 5));
  35. break;
  36. case 3:
  37. map[x,y,z]=(int)Mathf.Ceil(Random.Range(2, 5));
  38. break;
  39. case 4:
  40. map[x,y,z]=(int)Mathf.Ceil(Random.Range(2, 5));
  41. break;
  42. case 5:
  43. map[x,y,z]=(int)Mathf.Ceil(Random.Range(0, 5));
  44. break;
  45. case 6:
  46. map[x,y,z]=(int)Mathf.Ceil(Random.Range(0, 5));
  47. break;
  48. case 7:
  49. map[x,y,z]=(int)Mathf.Ceil(Random.Range(0, 5));
  50. break;
  51. case 8:
  52. map[x,y,z]=(int)Mathf.Ceil(Random.Range(0, 5));
  53. break;
  54. default:
  55. map[x,y,z]=0;
  56. break;
  57. }}}}
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65. for (int x = 0; x < 32; x++) {
  66. for (int y = 0; y <32; y++) {//ground
  67. for (int z = 0; z < 32; z++){
  68.  
  69.  
  70. block_map[x,y,z]=(GameObject)Instantiate (blocks[map[x,y,z]], new Vector3 (x, y, z), Quaternion.identity);
  71.  
  72.  
  73. }
  74. }
  75. }
  76.  
  77.  
  78.  
  79.  
  80.  
  81. /**/
  82.  
  83. }
  84.  
  85.  
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement