private async void EnqueueLocalUpdateTask() { pendingLocalUpdate = true; await ChunkService.TaskDispatcher.NextReadOnlyChance(); OnChunkUpdate?.Invoke(this); }
public void SetTile(int index, Tile tile) { if (_tiles[index] != tile) { _tiles[index] = tile; OnChunkUpdate?.Invoke(this, index); } }
/// <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; } }