|
@ -13,6 +13,8 @@ public class WaterController : MonoBehaviour { |
|
|
public float waveSpeed = 1; |
|
|
public float waveSpeed = 1; |
|
|
public float maxWaveHeight = 2; |
|
|
public float maxWaveHeight = 2; |
|
|
|
|
|
|
|
|
|
|
|
private readonly float scaleConstant = 50f; |
|
|
|
|
|
|
|
|
public GameObject rippleEffect; |
|
|
public GameObject rippleEffect; |
|
|
|
|
|
|
|
|
#region Unity Functions
|
|
|
#region Unity Functions
|
|
@ -48,8 +50,15 @@ public class WaterController : MonoBehaviour { |
|
|
pos.y += 1; |
|
|
pos.y += 1; |
|
|
Quaternion rot = Quaternion.Euler(-90, 0, 0); |
|
|
Quaternion rot = Quaternion.Euler(-90, 0, 0); |
|
|
|
|
|
|
|
|
if (rippleEffect != null) |
|
|
|
|
|
Destroy(Instantiate(rippleEffect, pos, rot), 4); |
|
|
|
|
|
|
|
|
if (rippleEffect != null) { |
|
|
|
|
|
GameObject ripple = Instantiate(rippleEffect, pos, rot); |
|
|
|
|
|
|
|
|
|
|
|
Vector3 scale = Vector3.one * radius / scaleConstant; |
|
|
|
|
|
ripple.transform.localScale = scale; |
|
|
|
|
|
|
|
|
|
|
|
Destroy(ripple, 4); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
Collider[] colliders = Physics.OverlapSphere(point, radius); |
|
|
Collider[] colliders = Physics.OverlapSphere(point, radius); |
|
|
foreach (Collider hit in colliders) { |
|
|
foreach (Collider hit in colliders) { |
|
|