Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //exchange this with the current method of version 1.0
- public void initTestMap(Vector3 mapSize, MapPosToPrefab function, Vector3 tileSize) {
- this.tiles = new Tile[(int)mapSize.x* (int)mapSize.y* ((int)mapSize.z + 1)];
- this.mapSize = mapSize;
- this.tileSize = tileSize;
- for (int i = 0; i < (int)mapSize.x; i++) {
- for (int j = 0; j < (int)mapSize.y; j++) {
- for (int k = 0; k < (int)mapSize.z; k++) {
- Tile functionTile = function(i,j,k);
- if(functionTile != null) {
- GameObject go =(GameObject) GameObject.Instantiate(functionTile.gameObject, Vector3.zero, Quaternion.identity);
- Tile t = go.GetComponent<Tile>();
- t.Position = Vector3.Scale(new Vector3(i,j,k), tileSize);
- go.name = "tile_" + i + j + k;
- this[i, j, k] = t;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement