using System.Collections; using System.Collections.Generic; using UnityEngine; public class Bullet : MonoBehaviour { Rigidbody2D rb; public float damage; public float time = 2f; public void ApplyVel(Vector2 dir,float speed) { rb = GetComponent(); rb.velocity = dir * speed; Destroy(gameObject, time); } private void OnCollisionEnter2D(Collision2D c) { Destroy(gameObject); } }