Recerca-Cerdanya-Talk/Assets/Scripts/Level 2/Bullet2.cs
Gerard Gascón e4cc23e7f0 Some things
2023-08-19 23:55:03 +02:00

16 lines
401 B
C#

using UnityEngine;
namespace Level2 {
public class Bullet2 : MonoBehaviour {
[SerializeField] float speed;
public void AddForce(int direction) {
Rigidbody2D rb = GetComponent<Rigidbody2D>();
rb.velocity = Vector2.right * direction * speed;
}
void OnCollisionEnter2D(Collision2D other) {
Destroy(gameObject);
}
}
}