Exemplo n.º 1
0
        private async void EnqueueLocalUpdateTask()
        {
            pendingLocalUpdate = true;
            await ChunkService.TaskDispatcher.NextReadOnlyChance();

            OnChunkUpdate?.Invoke(this);
        }
Exemplo n.º 2
0
 public void SetTile(int index, Tile tile)
 {
     if (_tiles[index] != tile)
     {
         _tiles[index] = tile;
         OnChunkUpdate?.Invoke(this, index);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Forces a chunk update.
        /// </summary>
        public void Update()
        {
            lock (this) {
                // Process all queued voxel updates
                while (_voxelEdits.Count > 0)
                {
                    VoxelUpdate update;
                    if (!_voxelEdits.TryDequeue(out update))
                    {
                        continue;
                    }
                    SetVoxel(update.Position, update.Voxel);
                }

                // Invoke the chunk update event
                OnChunkUpdate?.Invoke();

                IsMeshDirty = false;
            }
        }