ofb/Assets/Scripts/BounceBehavior.cs

24 lines
491 B
C#
Raw Normal View History

2023-05-04 13:20:35 -07:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2023-05-04 13:53:37 -07:00
// MIGHT NOT NEED THIS LOL
2023-05-04 13:20:35 -07:00
public class WaterBehavior : MonoBehaviour
{
2023-05-04 13:31:41 -07:00
public Rigidbody2D RB;
[SerializeField] private float bounceForce = 2;
void OnCollisionEnter2D(Collision2D col)
2023-05-04 13:20:35 -07:00
{
2023-05-04 13:31:41 -07:00
Bounce();
2023-05-04 13:20:35 -07:00
}
2023-05-04 13:31:41 -07:00
private void Bounce()
2023-05-04 13:20:35 -07:00
{
2023-05-04 13:53:37 -07:00
/*RB.velocity = new Vector2(RB.velocity.x, -(RB.velocity.y));
RB.AddForce(RB.velocity * bounceForce, ForceMode2D.Impulse);*/
2023-05-04 13:20:35 -07:00
}
}