Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Bullet : MonoBehaviour {
- [SerializeField]
- float Time = 5f;
- void Start ()
- {
- Destroy(gameObject, Time);
- }
- // Update is called once per frame
- void Update ()
- {
- }
- private void OnCollisionEnter2D(Collision2D collision)
- {
- var health = collision.gameObject.GetComponent<Statistics>().Health;
- health -= 1;
- Destroy(gameObject);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement