TO SQUASH: shark movement.
This commit is contained in:
@@ -86,17 +86,28 @@ public class FruitBall : BallBase
|
||||
{
|
||||
if (collision.gameObject.CompareTag("Wall") ||
|
||||
collision.gameObject.CompareTag("BasicBall") ||
|
||||
collision.gameObject.CompareTag("FruitBall"))
|
||||
collision.gameObject.CompareTag("FruitBall") ||
|
||||
collision.gameObject.CompareTag("Shark"))
|
||||
{
|
||||
ContactPoint2D contact = collision.GetContact(0);
|
||||
speed = Vector2.Reflect(speed, contact.normal);
|
||||
|
||||
if (collision.gameObject.CompareTag("BasicBall") ||
|
||||
collision.gameObject.CompareTag("FruitBall"))
|
||||
collision.gameObject.CompareTag("FruitBall") ||
|
||||
collision.gameObject.CompareTag("Shark"))
|
||||
{
|
||||
speedIncreaseTimer = 2.0f; // Reset the timer to 2 seconds
|
||||
speedMultiplier = 20.0f; // Set the speed multiplier to 7x
|
||||
}
|
||||
|
||||
if (collision.gameObject.CompareTag("Shark"))
|
||||
{
|
||||
audioSource.PlayOneShot(bounceSound);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Physics2D.IgnoreCollision(collision.collider, GetComponent<Collider2D>(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user