public void CopyFrom(PWaterProfile p) { LightingModel = p.LightingModel; RenderQueueIndex = p.RenderQueueIndex; Color = p.Color; SpecColor = p.SpecColor; Smoothness = p.Smoothness; EnableLightAbsorption = p.EnableLightAbsorption; DepthColor = p.DepthColor; MaxDepth = p.MaxDepth; EnableFoam = p.EnableFoam; FoamColor = p.FoamColor; FoamDistance = p.FoamDistance; EnableFoamHQ = p.EnableFoamHQ; FoamNoiseScaleHQ = p.FoamNoiseScaleHQ; FoamNoiseSpeedHQ = p.FoamNoiseSpeedHQ; ShorelineFoamStrength = p.ShorelineFoamStrength; CrestFoamStrength = p.CrestFoamStrength; CrestMaxDepth = p.CrestMaxDepth; SlopeFoamStrength = p.SlopeFoamStrength; SlopeFoamFlowSpeed = p.SlopeFoamFlowSpeed; SlopeFoamDistance = p.SlopeFoamDistance; EnableRipple = p.EnableRipple; RippleHeight = p.RippleHeight; RippleSpeed = p.RippleSpeed; RippleNoiseScale = p.RippleNoiseScale; EnableWave = p.EnableWave; WaveDirection = p.WaveDirection; WaveSpeed = p.WaveSpeed; WaveHeight = p.WaveHeight; WaveLength = p.WaveLength; WaveSteepness = p.WaveSteepness; WaveDeform = p.WaveDeform; FresnelStrength = p.FresnelStrength; FresnelBias = p.FresnelBias; EnableReflection = p.EnableReflection; ReflectionTextureResolution = p.ReflectionTextureResolution; EnableReflectionPixelLight = p.EnableReflectionPixelLight; ReflectionClipPlaneOffset = p.ReflectionClipPlaneOffset; ReflectionLayers = p.ReflectionLayers; ReflectCustomSkybox = p.ReflectCustomSkybox; ReflectionDistortionStrength = p.ReflectionDistortionStrength; EnableRefraction = p.EnableRefraction; RefractionDistortionStrength = p.RefractionDistortionStrength; EnableCaustic = p.EnableCaustic; CausticTexture = p.CausticTexture; CausticSize = p.CausticSize; CausticStrength = p.CausticStrength; CausticDistortionStrength = p.CausticDistortionStrength; }
public override void OnInspectorGUI() { if (water.transform.rotation != Quaternion.identity) { string warning = "The water object is designed to work without rotation. Some features may not work correctly."; EditorGUILayout.LabelField(warning, PEditorCommon.WarningLabel); } water.Profile = PEditorCommon.ScriptableObjectField <PWaterProfile>("Profile", water.Profile); profile = water.Profile; if (water.Profile == null) { return; } so = new SerializedObject(profile); reflectionLayersSO = so.FindProperty("reflectionLayers"); refractionLayersSO = so.FindProperty("refractionLayers"); EditorGUI.BeginChangeCheck(); DrawMeshSettingsGUI(); DrawRenderingSettingsGUI(); DrawColorsSettingsGUI(); DrawFresnelSettingsGUI(); DrawRippleSettingsGUI(); DrawWaveSettingsGUI(); DrawLightAbsorbtionSettingsGUI(); DrawFoamSettingsGUI(); DrawReflectionSettings(); DrawRefractionSettings(); DrawCausticSettings(); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(profile); water.UpdateMaterial(); } DrawEffectsGUI(); if (willDrawDebugGUI) { DrawDebugGUI(); } if (so != null) { so.Dispose(); } if (reflectionLayersSO != null) { reflectionLayersSO.Dispose(); } if (refractionLayersSO != null) { refractionLayersSO.Dispose(); } }
public void Reset() { PWaterProfile defaultProfile = PPoseidonSettings.Instance.CalmWaterProfile; if (defaultProfile != null) { CopyFrom(defaultProfile); } }
public static PWater CreateCalmWaterHQObject(MenuCommand cmd) { GameObject g = new GameObject("Calm Water HQ"); if (cmd != null && cmd.context != null) { GameObject root = cmd.context as GameObject; GameObjectUtility.SetParentAndAlign(g, root); } PWater waterComponent = g.AddComponent <PWater>(); PWaterProfile profile = PWaterProfile.CreateInstance <PWaterProfile>(); string fileName = "WaterProfile_" + PCommon.GetUniqueID(); string filePath = string.Format("Assets/{0}.asset", fileName); AssetDatabase.CreateAsset(profile, filePath); profile.CopyFrom(PPoseidonSettings.Instance.CalmWaterHQProfile); waterComponent.Profile = profile; waterComponent.TileSize = new Vector2(100, 100); return(waterComponent); }
private void OnEnable() { instance = target as PWaterProfile; }