Advertisement
gomuani

coin

Jun 1st, 2022
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class coin : MonoBehaviour
  6. {
  7.  
  8.  
  9. public int valor = 1;
  10. public GameManager gameManager;
  11. // Use this for initialization
  12. void Start()
  13. {
  14.  
  15. }
  16.  
  17. // Update is called once per frame
  18. void Update()
  19. {
  20.  
  21. }
  22.  
  23. private void OnTriggerEnter2D(Collider2D collision)
  24. {
  25. if (collision.CompareTag("Player"))
  26. {
  27. gameManager.SumarPuntos(valor);
  28. Destroy(this.gameObject);
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement