public void DespawnChunk(ChunkStore store)
 {
     if (store != null)
     {
         Destroy(store.GameObject);
     }
 }
Esempio n. 2
0
    void Start()
    {
        if (!Application.isPlaying)
        {
            return;
        }

        List <Point3D>  blocksToInit;
        IChunkGenerator generator;
        string          entityID;

        Setup(out blocksToInit, out generator, out entityID);

        entityStore = new EntityStore(generator, entityID);
        chunkStore  = new ChunkStore(entityStore, Material, transform);

        blocksToInit.AddRange(entityStore.GetSavedChunks());
        blocksToInit = blocksToInit.Distinct().ToList();

        pendingChunks = blocksToInit.Select(chunkPos => new PendingChunk()
        {
            ChunkPos = chunkPos,
            WorldPos = transform.TransformPoint(TransformVertex(new Vector3(chunkPos.x, chunkPos.y, chunkPos.z) * Chunk.BlockSize))
        }).ToList();

        OnSetupCompleted();
    }
    public void AddChunk(ChunkOffset offset, ChunkStore store)
    {
        Dictionary <int, ChunkStore> dict;

        storage.TryGetValue(offset.X, out dict);
        if (dict == null)
        {
            dict = new Dictionary <int, ChunkStore>();
            storage.Add(offset.X, dict);
        }
        if (!dict.ContainsKey(offset.Z))
        {
            dict.Add(offset.Z, store);
        }
    }
 public void DespawnChunk(ChunkStore store)
 {
     throw new System.NotImplementedException();
 }