Minor - Add Assets And Support Dual Screen
This commit is contained in:
15
Assets/MobileDepthWater/Scripts/AnimationStarter.cs
Normal file
15
Assets/MobileDepthWater/Scripts/AnimationStarter.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Assets.MobileOptimizedWater.Scripts
|
||||
{
|
||||
using UnityEngine;
|
||||
|
||||
public class AnimationStarter : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Animator animator;
|
||||
[SerializeField] private Motion animation;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
animator.Play(animation.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/MobileDepthWater/Scripts/AnimationStarter.cs.meta
Normal file
19
Assets/MobileDepthWater/Scripts/AnimationStarter.cs.meta
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c6c94318626bb246a07b7f09604d66c
|
||||
timeCreated: 1493245613
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 89541
|
||||
packageName: Mobile depth water shader
|
||||
packageVersion: 1.0
|
||||
assetPath: Assets/MobileDepthWater/Scripts/AnimationStarter.cs
|
||||
uploadId: 179707
|
||||
61
Assets/MobileDepthWater/Scripts/CameraDepthSlider.cs
Normal file
61
Assets/MobileDepthWater/Scripts/CameraDepthSlider.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
namespace Assets.MobileOptimizedWater.Scripts
|
||||
{
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CameraDepthSlider : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Slider slider;
|
||||
[SerializeField] private Transform cameraTransform;
|
||||
|
||||
[Space]
|
||||
[SerializeField] private float minDistance;
|
||||
[SerializeField] private float maxDistance;
|
||||
|
||||
[Space]
|
||||
[SerializeField] private float scrollDelta;
|
||||
[SerializeField] private float scrollSpeed;
|
||||
|
||||
private Vector3 cameraDirectionToRoot;
|
||||
|
||||
private float currentScrollSpeed;
|
||||
private float currentValue;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
cameraDirectionToRoot = cameraTransform.localPosition.normalized;
|
||||
|
||||
slider.value = 0.2f;
|
||||
OnSliderValueChanged();
|
||||
}
|
||||
|
||||
public void OnSliderValueChanged()
|
||||
{
|
||||
UpdateDepthPosition(slider.value);
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public void Update()
|
||||
{
|
||||
if (Input.GetKey(KeyCode.W))
|
||||
{
|
||||
currentScrollSpeed = Mathf.Lerp(currentScrollSpeed, currentScrollSpeed + scrollDelta, Time.deltaTime * scrollSpeed);
|
||||
UpdateDepthPosition(Mathf.Lerp(currentValue, currentValue + currentScrollSpeed, Time.deltaTime * scrollSpeed));
|
||||
}
|
||||
else if (Input.GetKey(KeyCode.S))
|
||||
{
|
||||
currentScrollSpeed = Mathf.Lerp(currentScrollSpeed, currentScrollSpeed + scrollDelta, Time.deltaTime * scrollSpeed);
|
||||
UpdateDepthPosition(Mathf.Lerp(currentValue, currentValue - currentScrollSpeed, Time.deltaTime * scrollSpeed));
|
||||
}
|
||||
|
||||
currentScrollSpeed = 0f;
|
||||
}
|
||||
#endif
|
||||
|
||||
private void UpdateDepthPosition(float value)
|
||||
{
|
||||
currentValue = Mathf.Clamp(value, 0f, 1f);
|
||||
cameraTransform.localPosition = cameraDirectionToRoot * Mathf.Lerp(minDistance, maxDistance, currentValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/MobileDepthWater/Scripts/CameraDepthSlider.cs.meta
Normal file
19
Assets/MobileDepthWater/Scripts/CameraDepthSlider.cs.meta
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 163194dd3a9ff9a4f9e9e76a372f4ea5
|
||||
timeCreated: 1493329456
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 89541
|
||||
packageName: Mobile depth water shader
|
||||
packageVersion: 1.0
|
||||
assetPath: Assets/MobileDepthWater/Scripts/CameraDepthSlider.cs
|
||||
uploadId: 179707
|
||||
17
Assets/MobileDepthWater/Scripts/CameraRotator.cs
Normal file
17
Assets/MobileDepthWater/Scripts/CameraRotator.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace Assets.MobileOptimizedWater.Scripts
|
||||
{
|
||||
using UnityEngine;
|
||||
|
||||
public class CameraRotator : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float speed = 5f;
|
||||
|
||||
public void Update()
|
||||
{
|
||||
var angles = transform.eulerAngles;
|
||||
angles.y += Time.deltaTime * speed;
|
||||
|
||||
transform.eulerAngles = angles;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/MobileDepthWater/Scripts/CameraRotator.cs.meta
Normal file
19
Assets/MobileDepthWater/Scripts/CameraRotator.cs.meta
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a28d745c2c1c0e249aaa6117f403d94b
|
||||
timeCreated: 1493151061
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 89541
|
||||
packageName: Mobile depth water shader
|
||||
packageVersion: 1.0
|
||||
assetPath: Assets/MobileDepthWater/Scripts/CameraRotator.cs
|
||||
uploadId: 179707
|
||||
90
Assets/MobileDepthWater/Scripts/FPSCounter.cs
Normal file
90
Assets/MobileDepthWater/Scripts/FPSCounter.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
namespace Assets.Scripts.Helpers
|
||||
{
|
||||
using UnityEngine;
|
||||
|
||||
public class FPSCounter
|
||||
{
|
||||
private const float Frequency = 0.1f;
|
||||
private const int DataSize = 100;
|
||||
|
||||
private float[] fpsData;
|
||||
private float[] deltaTimeData;
|
||||
|
||||
private float timer;
|
||||
private int index;
|
||||
|
||||
private int lastFrameCount;
|
||||
private float lastTime;
|
||||
|
||||
public FPSCounter()
|
||||
{
|
||||
index = 0;
|
||||
timer = 0f;
|
||||
|
||||
fpsData = new float[DataSize];
|
||||
deltaTimeData = new float[DataSize];
|
||||
}
|
||||
|
||||
public float Fps
|
||||
{
|
||||
get { return fpsData[Mathf.Max(index - 1, 0)]; }
|
||||
}
|
||||
|
||||
public void Update(float deltaTime)
|
||||
{
|
||||
timer += deltaTime;
|
||||
|
||||
if (timer >= Frequency)
|
||||
{
|
||||
var timeSpan = Time.realtimeSinceStartup - lastTime;
|
||||
var frameCount = Time.frameCount - lastFrameCount;
|
||||
|
||||
fpsData[index] = frameCount / timeSpan;
|
||||
deltaTimeData[index] = timer;
|
||||
|
||||
index = (index + 1) % DataSize;
|
||||
|
||||
lastFrameCount = Time.frameCount;
|
||||
lastTime = Time.realtimeSinceStartup;
|
||||
|
||||
timer = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return average fps for last N seconds.
|
||||
/// </summary>
|
||||
/// <param name="forLastSec">Last seconds for calculating.</param>
|
||||
/// <returns>Average fps for last N seconds.</returns>
|
||||
public float GetAverageFps(float forLastSec)
|
||||
{
|
||||
var fpsSum = 0f;
|
||||
var timeSum = 0f;
|
||||
|
||||
var localIndex = index - 1;
|
||||
var totalDataCount = 0;
|
||||
|
||||
while (timeSum <= forLastSec)
|
||||
{
|
||||
if (localIndex < 0)
|
||||
{
|
||||
localIndex += DataSize;
|
||||
}
|
||||
|
||||
fpsSum += fpsData[localIndex];
|
||||
timeSum += deltaTimeData[localIndex];
|
||||
|
||||
localIndex--;
|
||||
totalDataCount++;
|
||||
|
||||
if (totalDataCount == DataSize)
|
||||
{
|
||||
Debug.LogWarning("Too few data to calculate average fps for such long term.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return fpsSum / totalDataCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/MobileDepthWater/Scripts/FPSCounter.cs.meta
Normal file
19
Assets/MobileDepthWater/Scripts/FPSCounter.cs.meta
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b1c28173ea46b14d8082af87f26aa6d
|
||||
timeCreated: 1493152153
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 89541
|
||||
packageName: Mobile depth water shader
|
||||
packageVersion: 1.0
|
||||
assetPath: Assets/MobileDepthWater/Scripts/FPSCounter.cs
|
||||
uploadId: 179707
|
||||
24
Assets/MobileDepthWater/Scripts/FPSUI.cs
Normal file
24
Assets/MobileDepthWater/Scripts/FPSUI.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace Assets.MobileOptimizedWater.Scripts
|
||||
{
|
||||
using Assets.Scripts.Helpers;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class FPSUI : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Text fpsText;
|
||||
|
||||
private FPSCounter fpsCounter;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
fpsCounter = new FPSCounter();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
fpsCounter.Update(Time.deltaTime);
|
||||
fpsText.text = "Fps: " + fpsCounter.GetAverageFps(1f).ToString("###");
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/MobileDepthWater/Scripts/FPSUI.cs.meta
Normal file
19
Assets/MobileDepthWater/Scripts/FPSUI.cs.meta
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27de325d551c70740a742a8b6544895f
|
||||
timeCreated: 1493152271
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 89541
|
||||
packageName: Mobile depth water shader
|
||||
packageVersion: 1.0
|
||||
assetPath: Assets/MobileDepthWater/Scripts/FPSUI.cs
|
||||
uploadId: 179707
|
||||
43
Assets/MobileDepthWater/Scripts/TouchRotator.cs
Normal file
43
Assets/MobileDepthWater/Scripts/TouchRotator.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
namespace Assets.MobileOptimizedWater.Scripts
|
||||
{
|
||||
using UnityEngine;
|
||||
|
||||
public class TouchRotator : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Transform cameraRoot;
|
||||
[SerializeField] private float speed;
|
||||
[SerializeField] private float mouseSpeed;
|
||||
|
||||
private Vector3 prevMousePos;
|
||||
|
||||
#if !UNITY_EDITOR
|
||||
public void Update()
|
||||
{
|
||||
if (Input.touchCount > 0 && Input.GetTouch(0).position.x < Screen.width * 0.9f)
|
||||
{
|
||||
var deltaPos = Input.GetTouch(0).deltaPosition;
|
||||
|
||||
var deltaRotation = new Vector3(-deltaPos.y, deltaPos.x) * Time.deltaTime * speed;
|
||||
var rotation = cameraRoot.eulerAngles + deltaRotation;
|
||||
|
||||
cameraRoot.eulerAngles = new Vector3(Mathf.Clamp(rotation.x, 0f, 90f), rotation.y);
|
||||
}
|
||||
}
|
||||
#else
|
||||
public void Update()
|
||||
{
|
||||
if (Input.GetKey(KeyCode.LeftAlt))
|
||||
{
|
||||
var deltaPos = Input.mousePosition - prevMousePos;
|
||||
|
||||
var deltaRotation = new Vector3(-deltaPos.y, deltaPos.x) * Time.deltaTime * mouseSpeed;
|
||||
var rotation = cameraRoot.eulerAngles + deltaRotation;
|
||||
|
||||
cameraRoot.eulerAngles = new Vector3(Mathf.Clamp(rotation.x, 0f, 90f), rotation.y);
|
||||
}
|
||||
|
||||
prevMousePos = Input.mousePosition;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
19
Assets/MobileDepthWater/Scripts/TouchRotator.cs.meta
Normal file
19
Assets/MobileDepthWater/Scripts/TouchRotator.cs.meta
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d1b9910e5f079f4e93608f9b3b58bcc
|
||||
timeCreated: 1493309108
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 89541
|
||||
packageName: Mobile depth water shader
|
||||
packageVersion: 1.0
|
||||
assetPath: Assets/MobileDepthWater/Scripts/TouchRotator.cs
|
||||
uploadId: 179707
|
||||
9
Assets/MobileDepthWater/Scripts/Water.meta
Normal file
9
Assets/MobileDepthWater/Scripts/Water.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8858ad60fb56664593478ccb67b8d4b
|
||||
folderAsset: yes
|
||||
timeCreated: 1493665152
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
20
Assets/MobileDepthWater/Scripts/Water/WaterArea.cs
Normal file
20
Assets/MobileDepthWater/Scripts/Water/WaterArea.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace Assets.Scripts.Water
|
||||
{
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Area that belongs to some water
|
||||
/// </summary>
|
||||
public class WaterArea : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Water shader properties of the water this area belong
|
||||
/// </summary>
|
||||
[SerializeField] private WaterPropertyBlockSetter waterProperties;
|
||||
|
||||
public MaterialPropertyBlock WaterPropertyBlock
|
||||
{
|
||||
get { return waterProperties.MaterialPropertyBlock; }
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/MobileDepthWater/Scripts/Water/WaterArea.cs.meta
Normal file
19
Assets/MobileDepthWater/Scripts/Water/WaterArea.cs.meta
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8224516acd263b45a7aa9170e00b7ff
|
||||
timeCreated: 1493665152
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 89541
|
||||
packageName: Mobile depth water shader
|
||||
packageVersion: 1.0
|
||||
assetPath: Assets/MobileDepthWater/Scripts/Water/WaterArea.cs
|
||||
uploadId: 179707
|
||||
@@ -0,0 +1,45 @@
|
||||
namespace Assets.Scripts.Water
|
||||
{
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// This class switchs material of dynamic objects if they enter or exit any water area
|
||||
/// After switching to water material it pushes water area properties to dynamic object material
|
||||
/// It allows objects to be under the lake or be in the different water
|
||||
/// Also switching material to diffuse after exiting the water gives a bit performance
|
||||
/// </summary>
|
||||
public class WaterMaterialSwitcher : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Renderer renderer;
|
||||
[SerializeField] private Material waterMaterial;
|
||||
[SerializeField] private Material diffuseMaterial;
|
||||
|
||||
private MaterialPropertyBlock defaulPropertyBlock;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
defaulPropertyBlock = new MaterialPropertyBlock();
|
||||
renderer.GetPropertyBlock(defaulPropertyBlock);
|
||||
}
|
||||
|
||||
public void OnTriggerEnter(Collider collider)
|
||||
{
|
||||
if (collider.tag == "Water")
|
||||
{
|
||||
var waterPropertyBlock = collider.GetComponent<WaterArea>().WaterPropertyBlock;
|
||||
|
||||
renderer.sharedMaterial = waterMaterial;
|
||||
renderer.SetPropertyBlock(waterPropertyBlock);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnTriggerExit(Collider collider)
|
||||
{
|
||||
if (collider.tag == "Water")
|
||||
{
|
||||
renderer.sharedMaterial = diffuseMaterial;
|
||||
renderer.SetPropertyBlock(defaulPropertyBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43f35e80d9e9de94b9032fbd4aa2b5f7
|
||||
timeCreated: 1493664770
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 89541
|
||||
packageName: Mobile depth water shader
|
||||
packageVersion: 1.0
|
||||
assetPath: Assets/MobileDepthWater/Scripts/Water/WaterMaterialSwitcher.cs
|
||||
uploadId: 179707
|
||||
@@ -0,0 +1,107 @@
|
||||
namespace Assets.Scripts.Water
|
||||
{
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// This class helps you to set water properties for a lot of materials at the same time.
|
||||
/// So you don't have to make it for each independently.
|
||||
/// Put it on the scene, add renderers and set up your water.
|
||||
/// </summary>
|
||||
[ExecuteInEditMode]
|
||||
public class WaterPropertyBlockSetter : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Renderer[] waterRenderers;
|
||||
|
||||
[Space]
|
||||
[SerializeField] private Color waterColor;
|
||||
[SerializeField] private Texture waterTex;
|
||||
[SerializeField] private Vector2 waterTile;
|
||||
[Range(0, 1)][SerializeField] private float textureVisibility;
|
||||
|
||||
[Space]
|
||||
[SerializeField] private Texture distortionTex;
|
||||
[SerializeField] private Vector2 distortionTile;
|
||||
|
||||
[Space]
|
||||
[SerializeField] private float waterHeight;
|
||||
[SerializeField] private float waterDeep;
|
||||
[Range(0, 0.1f)][SerializeField] private float waterDepthParam;
|
||||
[Range(0, 1)][SerializeField] private float waterMinAlpha;
|
||||
|
||||
[Space]
|
||||
[SerializeField] private Color borderColor;
|
||||
[Range(0, 1)][SerializeField] private float borderWidth;
|
||||
|
||||
[Space]
|
||||
[SerializeField] private Vector2 moveDirection;
|
||||
|
||||
private MaterialPropertyBlock materialPropertyBlock;
|
||||
|
||||
public MaterialPropertyBlock MaterialPropertyBlock
|
||||
{
|
||||
get { return materialPropertyBlock; }
|
||||
}
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
materialPropertyBlock = new MaterialPropertyBlock();
|
||||
SetUpPropertyBlock(materialPropertyBlock);
|
||||
|
||||
if (waterRenderers != null)
|
||||
{
|
||||
for (var i = 0; i < waterRenderers.Length; i++)
|
||||
{
|
||||
waterRenderers[i].SetPropertyBlock(materialPropertyBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public void OnEnable()
|
||||
{
|
||||
materialPropertyBlock = new MaterialPropertyBlock();
|
||||
SetUpPropertyBlock(materialPropertyBlock);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
SetUpPropertyBlock(materialPropertyBlock);
|
||||
|
||||
if (waterRenderers != null)
|
||||
{
|
||||
for (var i = 0; i < waterRenderers.Length; i++)
|
||||
{
|
||||
waterRenderers[i].SetPropertyBlock(materialPropertyBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private void SetUpPropertyBlock(MaterialPropertyBlock propertyBlock)
|
||||
{
|
||||
propertyBlock.SetColor("_WaterColor", waterColor);
|
||||
propertyBlock.SetColor("_BorderColor", borderColor);
|
||||
|
||||
propertyBlock.SetVector("_Tiling", waterTile);
|
||||
propertyBlock.SetVector("_DistTiling", distortionTile);
|
||||
propertyBlock.SetVector("_MoveDirection", new Vector4(moveDirection.x, 0f, moveDirection.y, 0f));
|
||||
|
||||
if (waterTex != null)
|
||||
{
|
||||
propertyBlock.SetTexture("_WaterTex", waterTex);
|
||||
}
|
||||
|
||||
if (distortionTex != null)
|
||||
{
|
||||
propertyBlock.SetTexture("_DistTex", distortionTex);
|
||||
}
|
||||
|
||||
propertyBlock.SetFloat("_TextureVisibility", textureVisibility);
|
||||
propertyBlock.SetFloat("_WaterHeight", waterHeight);
|
||||
propertyBlock.SetFloat("_WaterDeep", waterDeep);
|
||||
propertyBlock.SetFloat("_WaterDepth", waterDepthParam);
|
||||
propertyBlock.SetFloat("_WaterMinAlpha", waterMinAlpha);
|
||||
propertyBlock.SetFloat("_BorderWidth", borderWidth);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b610d095b4e1b044805a720533b3ce8
|
||||
timeCreated: 1493665152
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 89541
|
||||
packageName: Mobile depth water shader
|
||||
packageVersion: 1.0
|
||||
assetPath: Assets/MobileDepthWater/Scripts/Water/WaterPropertyBlockSetter.cs
|
||||
uploadId: 179707
|
||||
Reference in New Issue
Block a user