Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- public class BulletSound : MonoBehaviour {
- public AudioSource source;
- private GameObject bullet;
- public Dictionary <string, AudioClip> shootSounds;
- public AudioClip ShootE;
- public AudioClip ShootP;
- public AudioClip ShootM;
- public AudioClip ShootG;
- public AudioClip ShootV;
- public AudioClip ShootR;
- public bool e;
- public GameObject _bullet;
- void Start()
- {
- bullet = (GameObject)this.gameObject;
- source = GetComponent<AudioSource>();
- source.loop = false;
- }
- void OnTriggerEnter(Collider collision1)
- {
- if (collision1.CompareTag("Enemy"))
- {
- e = true;
- }
- }
- void Update()
- {
- if (e == true)
- {
- bullet.GetComponent<AudioSource>().PlayOneShot(ShootE);
- _bullet.gameObject.SetActive(false);
- Debug.Log("E");
- e = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement