Exemple #1
0
		public VoxelStruct getFloor(string[,] field){

			JoinVoxel join = new JoinVoxel ();
			for(int i=0;i<field.GetLength(0); ++i){
				for(int j=0; j<field.GetLength(1); ++j){
					int n = hasUp (field, i, j) | hasDown (field, i, j) | hasLeft (field, i, j) | hasRight (field, i, j);

					VoxelStruct c = store.getCell (field[i, j], n);
					join.addVoxel(c, new VectorInt3(16 * i, 16 * j, 0));
				}

			}
			VoxelStruct vs = join.doIt ();
			return vs;
		}
Exemple #2
0
        public VoxelStruct building()
        {
            VoxelMaker[] makers = this.gameObject.GetComponentsInChildren <VoxelMaker> ();
            JoinVoxel    join   = new JoinVoxel();

            for (int i = 0; i < makers.Length; ++i)
            {
                Vector3 offset = makers [i].gameObject.transform.localPosition;
                offset.x = Mathf.Round(offset.x);
                offset.y = Mathf.Round(offset.y);
                offset.z = Mathf.Round(offset.z);
                makers [i].gameObject.transform.localPosition = offset;
                makers [i]._loader.read();
                Debug.Log(offset);
                join.addVoxel(makers [i]._model.vs, new VectorInt3((int)offset.x, (int)offset.z, (int)offset.y));
            }
            VoxelStruct vs = join.doIt();

            return(vs);
        }