|
|
@ -6,7 +6,7 @@ using UnityEngine; |
|
|
|
public class BoatController : BuoyantObject { |
|
|
|
|
|
|
|
public float trunSpeed = 0.5f; |
|
|
|
|
|
|
|
public float breakSpeed = 20f; |
|
|
|
|
|
|
|
// Use this for initialization
|
|
|
|
void Start() { |
|
|
@ -26,8 +26,15 @@ public class BoatController : BuoyantObject { |
|
|
|
} |
|
|
|
|
|
|
|
void OnCollisionEnter(Collision collision) { |
|
|
|
if (collision.gameObject.CompareTag("Rock")) |
|
|
|
NotificationServer.notify("show GameOverPanel"); |
|
|
|
if (collision.gameObject.CompareTag("Rock")) { |
|
|
|
|
|
|
|
float forwardHitSpeed = Vector3.Project(collision.relativeVelocity, transform.forward).magnitude; |
|
|
|
|
|
|
|
Debug.Log("Forward hit:" + forwardHitSpeed); |
|
|
|
if (forwardHitSpeed > breakSpeed) { |
|
|
|
NotificationServer.notify("show GameOverPanel"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|