private bool IsValidChunkAction(ChunkAction chunkAction) { return(chunkAction.X >= 0 && chunkAction.X < _chunkSettings.ChunkWidth && chunkAction.Y >= 0 && chunkAction.Y < _chunkSettings.ChunkHeight); }
public async Task <int> ProcessAsync(ChunkAction chunkAction) { if (!IsValidChunkAction(chunkAction)) { throw new InvalidOperationException($"Chunk {chunkAction} is not valid."); } //we do not need an accurate value _lastUpdatedTicksUTC = DateTime.UtcNow.Ticks; return(await _chunklerClient.ProcessChunkActionAsync( new Chunkler.ChunkKey { BattleId = _battleId, ChunkXIndex = ChunkKey.X, ChunkYIndex = ChunkKey.Y }, new Chunkler.ChunkAction { XIndex = chunkAction.X, YIndex = chunkAction.Y, Color = chunkAction.Color })); }