Browse Source

ripples now based on water size

master
Joshua Reason 7 years ago
parent
commit
1794e20caf
1 changed files with 11 additions and 2 deletions
  1. +11
    -2
      IronToad_UnityProject/Assets/Scripts/WaterController.cs

+ 11
- 2
IronToad_UnityProject/Assets/Scripts/WaterController.cs View File

@ -13,6 +13,8 @@ public class WaterController : MonoBehaviour {
public float waveSpeed = 1;
public float maxWaveHeight = 2;
private readonly float scaleConstant = 50f;
public GameObject rippleEffect;
#region Unity Functions
@ -48,8 +50,15 @@ public class WaterController : MonoBehaviour {
pos.y += 1;
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);
foreach (Collider hit in colliders) {

Loading…
Cancel
Save