using System.Collections; using System.Collections.Generic; using UnityEngine; public class Bullet2 : Mover { public float lifespan = 1; public int damage = 1; public override float MoveX(float a) { return a; } public override float MoveY(float a) { return a; } private void OnCollisionEnter2D(Collision2D c) { var hh = gameObject.GetComponent(); if(hh) hh.hp -= damage; Destroy(gameObject); } void OnEnable() => Destroy(gameObject, lifespan); }