Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. public class Bullet : MonoBehaviour {
  2.  
  3. [SerializeField]
  4. float Time = 5f;
  5.  
  6. void Start ()
  7. {
  8. Destroy(gameObject, Time);
  9. }
  10.  
  11. // Update is called once per frame
  12. void Update ()
  13. {
  14.  
  15. }
  16.  
  17. private void OnCollisionEnter2D(Collision2D collision)
  18. {
  19. var health = collision.gameObject.GetComponent<Statistics>().Health;
  20. health -= 1;
  21. Destroy(gameObject);
  22. }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement