Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class world : MonoBehaviour {
- public GameObject brick;
- GameObject[, ,] block_map;
- int[, ,] map = new int[32,32,32];
- public GameObject[] blocks;
- void Start() {
- for (int x = 0; x < 32; x++) {//ground
- for (int y = 0; y <32; y++) {
- for (int z = 0; z < 32; z++) {
- switch (y)
- {
- case 0:
- case 1:
- map[x,y,z]=1;
- break;
- case 2:
- map[x,y,z]=(int)Mathf.Ceil(Random.Range(1, 5));
- break;
- case 3:
- map[x,y,z]=(int)Mathf.Ceil(Random.Range(2, 5));
- break;
- case 4:
- map[x,y,z]=(int)Mathf.Ceil(Random.Range(2, 5));
- break;
- case 5:
- map[x,y,z]=(int)Mathf.Ceil(Random.Range(0, 5));
- break;
- case 6:
- map[x,y,z]=(int)Mathf.Ceil(Random.Range(0, 5));
- break;
- case 7:
- map[x,y,z]=(int)Mathf.Ceil(Random.Range(0, 5));
- break;
- case 8:
- map[x,y,z]=(int)Mathf.Ceil(Random.Range(0, 5));
- break;
- default:
- map[x,y,z]=0;
- break;
- }}}}
- for (int x = 0; x < 32; x++) {
- for (int y = 0; y <32; y++) {//ground
- for (int z = 0; z < 32; z++){
- Debug.Log("going to instantiate for " + x + ", " + y + ", " + z);
- Debug.Log("using index: " + map[x,y,z]);
- Debug.Log("having game object name: " + blocks[map[x,y,z]].name);
- block_map[x,y,z]=(GameObject)Instantiate (blocks[map[x,y,z]], new Vector3 (x, y, z), Quaternion.identity);
- }
- }
- }
- /**/
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement