Ejemplo n.º 1
0
    public void CreateGameObject()
    {
        //NOTE: If this chunkData is already in dataReading or in rebuildList or in computingList, out-of-date chunk mesh will be attached.
        int cx = _node.CX, cy = _node.CY, cz = _node.CZ, lod = _node.Lod;

        if (_chunkPosLod.x != cx || _chunkPosLod.y != cy || _chunkPosLod.z != cz || _chunkPosLod.w != lod)
        {
//			OldChunkPos = _chunkPosLod;
//			if (null != OldChunkPos)
//				ChunkManager.Self.DelCacheReq(OldChunkPos.ToVector3());

            //DestroyGameObject(); // postpond destroy to AttachChunkGo
            _chunkPosLod.x = cx;
            _chunkPosLod.y = cy;
            _chunkPosLod.z = cz;
            _chunkPosLod.w = lod;
            _buildStep     = (int)EBuildStep.EBuildStep_StartDataLoading;
            DataVT_w       = S_ChunkDataNull;
            _bFromPool     = false;
            _bNoVerts      = false;
        }

        if (_buildStep >= (int)EBuildStep.EBuildStep_FinGoCreating)
        {
            if (null == (System.Object)_goChunk && !_bNoVerts)
            {
                _buildStep = (_chunkData.Length <= 0) ? (int)EBuildStep.EBuildStep_StartDataLoading : (int)EBuildStep.EBuildStep_FinDataLoading;
            }
            else
            {
                _node.OnEndUpdateNodeData(null);
                return;
            }
        }
        if (_buildStep < (int)EBuildStep.EBuildStep_FinDataLoading)
        {
            // load save data
        }
        else if (_buildStep < (int)EBuildStep.EBuildStep_FinGoCreating)
        {
            if (!_buildPosDatList.Contains(VFVoxelChunkData.GenStampOfUpdating(_chunkPosLod), this))
            {
                AddToBuildList();
            }
        }
    }