Beispiel #1
0
 void Awake()
 {
     _manager     = CreateManager();
     _source      = GetSource();
     CurrentPos   = Root.position;
     CurrentChunk = null;
     _storage     = new ChunkStorage();
     _storage.AddChunk(new ChunkOffset(0, 0), null);
 }
Beispiel #2
0
 void AddChunk(ChunkOffset offset)
 {
     if (!_storage.ContainsChunk(CurrentOffset + offset))
     {
         var holder = _source.GetHolder(CurrentChunk, offset);
         var store  = _manager.SpawnChunk(GetNextPos(CurrentPos, offset), holder);
         _storage.AddChunk(CurrentOffset + offset, store);
     }
 }
Beispiel #3
0
        internal Chunk GetChunk(PositionChunk positionChunk)
        {
            Chunk chunk = storage.GetChunk(positionChunk);

            if (chunk == null)
            {
                chunk          = new Chunk();
                chunk.Position = positionChunk;
                storage.AddChunk(chunk);
            }
            return(chunk);
        }