Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. public var soundClip : AudioClip[];
  2. private var looper : int = 0;
  3.  
  4. function OnTriggerStay (col:Collider){
  5.  
  6. if(Input.GetKey("e")) {
  7. if(!audio.isPlaying)
  8. {
  9. audio.clip = soundClip[looper];
  10. audio.Play();
  11. looper++;
  12. looper = looper%soundClip.Length;
  13. gameObject.DestroyObject(GameObject);
  14. }
  15.  
  16. }
  17. }
  18.  
  19.  
  20.  
  21.  
  22. When u press the E key it plays sound and then Destroy The Object.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement