private void UpdateProperty(ref TextureProperties p, int x0, int y0, int x1, int y1) { if (!Game.Instance.IsLoading()) { int simProperty = (int)p.simProperty; if (!p.updatedExternally) { TextureRegion texture_region = textureBuffers[simProperty].Lock(x0, y0, x1 - x0 + 1, y1 - y0 + 1); switch (p.simProperty) { case Property.StateChange: UpdateTextureThreaded(texture_region, x0, y0, x1, y1, UpdateStateChange); break; case Property.GasPressure: UpdateTextureThreaded(texture_region, x0, y0, x1, y1, UpdatePressure); break; case Property.GasColour: UpdateTextureThreaded(texture_region, x0, y0, x1, y1, UpdateGasColour); break; case Property.GasDanger: UpdateTextureThreaded(texture_region, x0, y0, x1, y1, UpdateDanger); break; case Property.FogOfWar: UpdateTextureThreaded(texture_region, x0, y0, x1, y1, UpdateFogOfWar); break; case Property.SolidDigAmount: UpdateTextureThreaded(texture_region, x0, y0, x1, y1, UpdateSolidDigAmount); break; case Property.SolidLiquidGasMass: UpdateTextureThreaded(texture_region, x0, y0, x1, y1, UpdateSolidLiquidGasMass); break; case Property.WorldLight: UpdateTextureThreaded(texture_region, x0, y0, x1, y1, UpdateWorldLight); break; case Property.Temperature: UpdateTextureThreaded(texture_region, x0, y0, x1, y1, UpdateTemperature); break; } texture_region.Unlock(); } else { switch (p.simProperty) { case Property.Flow: externallyUpdatedTextures[simProperty].LoadRawTextureData(externalFlowTex, 8 * Grid.WidthInCells * Grid.HeightInCells); break; case Property.Liquid: externallyUpdatedTextures[simProperty].LoadRawTextureData(externalLiquidTex, 4 * Grid.WidthInCells * Grid.HeightInCells); break; case Property.ExposedToSunlight: externallyUpdatedTextures[simProperty].LoadRawTextureData(externalExposedToSunlight, Grid.WidthInCells * Grid.HeightInCells); break; } externallyUpdatedTextures[simProperty].Apply(); } } }
public void Dispose() { region.Unlock(); }