Advertisement
KorolevDmitry123

Untitled

Jul 27th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4.  
  5. public class BulletSound : MonoBehaviour {
  6. public AudioSource source;
  7. private GameObject bullet;
  8. public Dictionary <string, AudioClip> shootSounds;
  9. public AudioClip ShootE;
  10. public AudioClip ShootP;
  11. public AudioClip ShootM;
  12. public AudioClip ShootG;
  13. public AudioClip ShootV;
  14. public AudioClip ShootR;
  15. public bool e;
  16. public GameObject _bullet;
  17. void Start()
  18. {
  19. bullet = (GameObject)this.gameObject;
  20. source = GetComponent<AudioSource>();
  21. source.loop = false;
  22. }
  23. void OnTriggerEnter(Collider collision1)
  24. {
  25. if (collision1.CompareTag("Enemy"))
  26. {
  27. e = true;
  28. }
  29. }
  30. void Update()
  31. {
  32. if (e == true)
  33. {
  34. bullet.GetComponent<AudioSource>().PlayOneShot(ShootE);
  35. _bullet.gameObject.SetActive(false);
  36. Debug.Log("E");
  37. e = false;
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement