Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class GunSound : MonoBehaviour {
- //Note this is a terrible way to add sound please don't do this unless you have completely run out of ideas
- public AudioSource Audio1;
- public AudioSource Audio2;
- //refers to the weapon script to see if we can fire
- public Weapon OSA2;
- //refers to the Bomb script to see if we have ammo
- public Bomb OSA;
- // Use this for initialization
- void Start ()
- {
- //Get the Script!
- OSA = OSA.GetComponent<Bomb>();
- }
- // Update is called once per frame
- void Update ()
- {
- if (Input.GetMouseButtonDown(0))
- {
- Audio1.Play();
- }
- if (OSA.Ammo != 0)
- {
- if (Input.GetMouseButtonDown(1))
- {
- Audio2.Play();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement