示例#1
0
 public void Update()
 {
     frameTimer.Restart();
     if (NetworkClient.active)
     {
         MeshGenerator.emptyFrameBuffer(world);
         requestedChunksTimer += Time.deltaTime;
         if (requestedChunksTimer >= RequestedChunksClearInterval)
         {
             if (NetworkServer.active)
             {
                 //host will already have the chunks loaded
                 foreach (var chunkPos in requestedChunks)
                 {
                     SendRequestChunk(chunkPos);
                 }
             }
             else
             {
                 foreach (var chunkPos in requestedChunks)
                 {
                     if (!world.loadedChunks.ContainsKey(chunkPos) && wl.chunkLoadable(world.WorldToChunkCoords(PlayerManager.singleton.Player.transform.position), chunkPos))
                     {
                         SendRequestChunk(chunkPos);
                     }
                 }
             }
             if (requestedChunks.Count > 0)
             {
                 requestedChunks.Clear();
             }
         }
     }
 }
示例#2
0
 public bool validChunkRequest(Vector3 requesterPosition, Vector3Int requestedChunk, WorldLoader loader)
 {
     return(loader.chunkLoadable(WorldToChunkCoords(requesterPosition), requestedChunk));
 }