private IEnumerator RefreshEntity()
 {
     while (true)
     {
         if (world.FirstGeneted)
         {
             if (entityRefreshQueue.Count > 0)
             {
                 WorldPos refreshPos = entityRefreshQueue.Dequeue();
                 //真正要刷的时候再次判断是否在玩家视野
                 if (IsInPlayerView(refreshPos))
                 {
                     Chunk chunk = world.GetChunk(refreshPos.x, refreshPos.y, refreshPos.z);
                     if (chunk != null && chunk.isGenerated)
                     {
                         if (chunk.RefreshEntity() > 0)
                         {
                             yield return(new WaitForSeconds(0.1f));
                         }
                     }
                 }
             }
             if (entityRemoveQueue.Count > 0)
             {
                 WorldPos removePos = entityRemoveQueue.Dequeue();
                 if (!IsInPlayerView(removePos))
                 {
                     Chunk chunk = world.GetChunk(removePos.x, removePos.y, removePos.z);
                     if (chunk != null)
                     {
                         if (chunk.RemoveEntity() > 0)
                         {
                             yield return(new WaitForSeconds(0.1f));
                         }
                     }
                 }
             }
         }
         yield return(null);
     }
 }
        private void OnChunkGenerateFinish(object[] param)
        {
            Chunk chunk = param[0] as Chunk;

            chunk.RefreshEntity();
        }