16 lines
401 B
C#
16 lines
401 B
C#
using UnityEngine;
|
|
|
|
namespace Level3 {
|
|
public class Bullet3 : 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);
|
|
}
|
|
}
|
|
}
|