|
|
|
@ -61,10 +61,10 @@ namespace Game { |
|
|
|
|
Vector2 thisPos = new Vector2(transform.position.x, transform.position.y); |
|
|
|
|
foreach (var ball in GameManager.Singleton.Balls) { |
|
|
|
|
Vector2 diff = thisPos - ball.Rb.position; |
|
|
|
|
if (diff.sqrMagnitude > Radius * Radius) |
|
|
|
|
if (diff.sqrMagnitude > Radius * Radius * 2 * 2) |
|
|
|
|
continue; |
|
|
|
|
float dist = diff.magnitude; |
|
|
|
|
Vector2 force = diff.normalized / dist * (Size * 5); |
|
|
|
|
Vector2 force = diff.normalized / dist * (Size * 20); |
|
|
|
|
force = Vector2.ClampMagnitude(force, 15); |
|
|
|
|
ball.Rb.AddForce(force); |
|
|
|
|
} |
|
|
|
|