Recerca-Cerdanya-Talk/Assets/Scripts/Level 3/Bullet3.cs
2023-08-22 20:12:53 +02:00

13 lines
375 B
C#

using UnityEngine;
namespace Level3 {
public class Bullet3 : BulletStats {
public void AddForce(int direction) {
GetComponent<Rigidbody2D>().velocity = Vector2.right * direction * bulletSpeed;
}
void OnCollisionEnter2D(Collision2D other) {
if(!other.gameObject.CompareTag("Enemy")) Destroy(gameObject);
}
}
}