Advertisement
Guest User

Untitled

a guest
Mar 4th, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4.  
  5. public class Coin_A8 : MonoBehaviour
  6. {
  7.  
  8. private bool pickedUp = false;
  9.  
  10. public AudioSource coinAudioSource;
  11.  
  12. public void Pickup()
  13. {
  14. if(!coinAudioSource.isPlaying && !pickedUp)
  15. {
  16. coinAudioSource.Play();
  17. pickedUp = true;
  18. }
  19. }
  20. public void Update()
  21. {
  22. if(!coinAudioSource.isPlaying && pickedUp)
  23. {
  24. Destroy(gameObject);
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement