private void OnShadersReloaded() { for (int i = 0; i < 12; i++) { TextureLerper textureLerper = lerpers[i]; if (textureLerper != null) { TextureProperties textureProperties = allTextureProperties[i]; Shader.SetGlobalTexture(textureProperties.texturePropertyName, textureLerper.Update()); } } }
private void LateUpdate() { if (Grid.IsInitialized()) { Shader.SetGlobalVector(WorldSizeID, new Vector4((float)Grid.WidthInCells, (float)Grid.HeightInCells, 1f / (float)Grid.WidthInCells, 1f / (float)Grid.HeightInCells)); Shader.SetGlobalVector(PropTexWsToCsID, new Vector4(0f, 0f, 1f, 1f)); Shader.SetGlobalVector(PropTexCsToWsID, new Vector4(0f, 0f, 1f, 1f)); Shader.SetGlobalFloat(TopBorderHeightID, (float)Grid.TopBorderHeight); GetVisibleCellRange(out int x, out int y, out int x2, out int y2); Shader.SetGlobalFloat(FogOfWarScaleID, FogOfWarScale); int num = NextPropertyIdx++ % allTextureProperties.Count; TextureProperties textureProperties = allTextureProperties[num]; while (textureProperties.updateEveryFrame) { num = NextPropertyIdx++ % allTextureProperties.Count; textureProperties = allTextureProperties[num]; } for (int i = 0; i < allTextureProperties.Count; i++) { TextureProperties p = allTextureProperties[i]; if (num == i || p.updateEveryFrame || GameUtil.IsCapturingTimeLapse()) { UpdateProperty(ref p, x, y, x2, y2); } } for (int j = 0; j < 12; j++) { TextureLerper textureLerper = lerpers[j]; if (textureLerper != null) { if (Time.timeScale == 0f) { textureLerper.LongUpdate(Time.unscaledDeltaTime); } TextureProperties textureProperties2 = allTextureProperties[j]; Shader.SetGlobalTexture(textureProperties2.texturePropertyName, textureLerper.Update()); } } } }