Advertisement
gandalfbialy

Untitled

May 10th, 2025
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. using UnityEditor.Rendering.Analytics;
  2. using UnityEngine;
  3.  
  4. public class BricksScript : MonoBehaviour
  5. {
  6. public int life = 1;
  7.  
  8. // Start is called once before the first execution of Update after the MonoBehaviour is created
  9. void Start()
  10. {
  11.  
  12. }
  13.  
  14. // Update is called once per frame
  15. void Update()
  16. {
  17.  
  18. }
  19.  
  20. private void OnCollisionEnter(Collision collision)
  21. {
  22. if (collision.gameObject.tag == "Ball")
  23. {
  24. life--;
  25.  
  26. if (life <= 0)
  27. {
  28. GameManager.instance.bricks.Remove(this.gameObject);
  29. Destroy(gameObject);
  30. }
  31. }
  32. }
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement