72 lines
2.4 KiB
C#
72 lines
2.4 KiB
C#
using BitStrap;
|
|
using UltimateWater;
|
|
using UnityEngine;
|
|
|
|
public class WaterParameters : MonoBehaviour
|
|
{
|
|
public Color colorUnderwater = Color.white;
|
|
|
|
public Color colorNormal = Color.white;
|
|
|
|
public Color reflectionColorUnderwater = Color.white;
|
|
|
|
public Color reflectionColorNormal = Color.white;
|
|
|
|
public Color reflectionColorSimpleReflection = Color.white;
|
|
|
|
[Space(10f)]
|
|
public float causticIntensityUnderwater = 1f;
|
|
|
|
[ReadOnly]
|
|
public float causticIntensityNormal = 1f;
|
|
|
|
public float causticScaleUnderwater = 40f;
|
|
|
|
[ReadOnly]
|
|
public float causticScaleNormal = 40f;
|
|
|
|
[HideInInspector]
|
|
public Water water;
|
|
|
|
public void Initialize()
|
|
{
|
|
causticIntensityNormal = GameController.Instance.azureSkyController.sunLightWaterEffects.Intensity;
|
|
causticScaleNormal = GameController.Instance.azureSkyController.sunLightWaterEffects.UvScale;
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
SetReflectionColor(false);
|
|
SetCausticIntensity(false);
|
|
}
|
|
|
|
public void SetReflectionColor(bool underwater)
|
|
{
|
|
if (!GameController.Instance.iceLevel || !GameController.Instance.fisheryEditorGame)
|
|
{
|
|
Color reflectionColor = ((!underwater) ? reflectionColorNormal : reflectionColorUnderwater);
|
|
if ((bool)GlobalSettings.Instance && GlobalSettings.Instance.renderSettings.reflectionQuality == RenderSettingsMy.ReflectionQuality.NONE)
|
|
{
|
|
reflectionColor = reflectionColorSimpleReflection;
|
|
}
|
|
water.ProfilesManager.Profiles[0].Profile.ReflectionColor = reflectionColor;
|
|
if (water.ProfilesManager.Profiles.Length > 1)
|
|
{
|
|
water.ProfilesManager.Profiles[1].Profile.ReflectionColor = reflectionColor;
|
|
}
|
|
if (GameController.Instance.iceLevel && !GameController.Instance.fisheryEditorGame)
|
|
{
|
|
water.ProfilesManager.Profiles[0].Profile.DiffuseColor = ((!underwater) ? colorNormal : colorUnderwater);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void SetCausticIntensity(bool underwater)
|
|
{
|
|
GameController.Instance.azureSkyController.sunLightWaterEffects.Intensity = ((!underwater) ? causticIntensityNormal : causticIntensityUnderwater);
|
|
GameController.Instance.azureSkyController.moonLightWaterEffects.Intensity = ((!underwater) ? causticIntensityNormal : causticIntensityUnderwater);
|
|
GameController.Instance.azureSkyController.sunLightWaterEffects.UvScale = ((!underwater) ? causticScaleNormal : causticScaleUnderwater);
|
|
GameController.Instance.azureSkyController.moonLightWaterEffects.UvScale = ((!underwater) ? causticScaleNormal : causticScaleUnderwater);
|
|
}
|
|
}
|