示例#1
0
		// Update is called once per frame
		void Update () {
			if (_building == true && _voxFile != null) {

				init();
				if (_voxFile != null) {
					VoxelMaker.Building (this.gameObject, VoxelReader.ReadFromFile (_voxFile), this._material);
				}

				_building = false;	
			}
		}
示例#2
0
 void Update()
 {
     if (_refresh && !string.IsNullOrEmpty(_json))
     {
         var jData = JsonDataHandler.reader <VoxelJson>(_json);
         _refresh = false;
         if (_model != null)
         {
             _model.data = VoxelReader.FromJsonData(jData);
         }
         VoxelReader.print();
     }
 }
示例#3
0
        /*public bool _refresh = false;
         #if UNITY_EDITOR
         * void Update () {
         *      if (_refresh && !string.IsNullOrEmpty(_vodFile)) {
         *
         *              FileStream sw = new FileStream (_vodFile, FileMode.Open, FileAccess.Read);
         *              System.IO.BinaryReader br = new System.IO.BinaryReader (sw);
         *              if(_model != null){
         *                      _model.data = VoxelReader.FromMagica (br);
         *              }
         *              _refresh = false;
         *      }
         *
         * }
         *
         #endif
         */

        public override void read()
        {
            if (_model == null)
            {
                _model = this.gameObject.GetComponent <VoxelModel>();
            }
            FileStream sw = new FileStream(_vodFile, FileMode.Open, FileAccess.Read);

            System.IO.BinaryReader br = new System.IO.BinaryReader(sw);
            if (_model != null)
            {
                _model.data = VoxelReader.FromMagica(br);
            }
        }