|
|
@ -37,14 +37,25 @@ public class WaterController : MonoBehaviour { |
|
|
|
/// <param name="point"> point where water is createds</param>
|
|
|
|
/// <param name="radius"> radius of effected object</param>
|
|
|
|
/// <param name="power"> power with chich the objects are pushed</param>
|
|
|
|
public void CreateWave(Vector3 point, float radius, float power){ |
|
|
|
public void CreateWave(Vector3 point, float radius, float power) { |
|
|
|
|
|
|
|
//find all colliders within the wave distance
|
|
|
|
|
|
|
|
point.y = transform.position.y; |
|
|
|
StartCoroutine(waveController(point, radius, power, 2)); |
|
|
|
|
|
|
|
Collider[] colliders = Physics.OverlapSphere(point, radius); |
|
|
|
foreach (Collider hit in colliders) { |
|
|
|
Debug.Log(hit.name); |
|
|
|
BuoyantObject hitScript = hit.gameObject.GetComponent<BuoyantObject>(); |
|
|
|
if (hitScript != null) { |
|
|
|
Debug.DrawLine(point, hit.transform.position, Color.blue, 1); |
|
|
|
StartCoroutine(hitScript.pushObject(point, power, 2)); |
|
|
|
} |
|
|
|
|
|
|
|
//StartCoroutine(waveController(point, radius, power, 2));
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
#endregion Interaction Functions
|
|
|
|
|
|
|
|