Ejemplo n.º 1
0
    // this.MergeZones found than `this` have to be merged on `direction`
    //  Because this require state is merged or sideChunk have zone look for this chunk
    void MergeIfLoadedSideChunk(Direction direction, WorldChunkSettings setting)
    {
        Coord sideChunkCoord = this.coord.GetDirection(direction);

        if (MapEndless.instance.worldChunks.ContainsKey(sideChunkCoord))
        {
            // Get the chunk who need to be merged with
            WorldChunk sideChunk = MapEndless.instance.worldChunks [sideChunkCoord];
            // The side chunk is loaded, but not computed. Do it! (merging need Computed chunk)
            if (sideChunk.state < ChunkStates.Computed)
            {
                // Ask to be at least computed
                sideChunk.UpdateState(setting, ChunkStates.Computed);
            }
            else
            {
                this.MergeSideChunk(direction, sideChunk, setting);
                sideChunk.MergeSideChunk(Coord.GetDirectionInverse(direction), this, setting);

                // Dev test ? will also check if the zone is completed (fakeZone)
                sideChunk.TestZonesCompletedAndSeeMore(setting);
            }
        }
    }