Cleanup excessive control panel audio sources
This commit is contained in:
parent
2ff13e1cd3
commit
f2aeaa936e
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,6 @@ using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
[RequireComponent(typeof(AudioSource))]
|
||||
public class LocomotionToggle : MonoBehaviour
|
||||
{
|
||||
[System.Serializable]
|
||||
@ -45,7 +44,6 @@ public class LocomotionToggle : MonoBehaviour
|
||||
locoEvent = new LocomotionToggleEvent();
|
||||
|
||||
audioSrc = GetComponent<AudioSource>();
|
||||
audioSrc.playOnAwake = false;
|
||||
soundOn = Resources.Load<AudioClip>("Audio/loco on");
|
||||
soundOff = Resources.Load<AudioClip>("Audio/loco off");
|
||||
|
||||
|
@ -3,7 +3,6 @@ using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
using WindowsInput.Native;
|
||||
|
||||
[RequireComponent(typeof(AudioSource))]
|
||||
public class PanelButton : MonoBehaviour
|
||||
{
|
||||
[DllImport("user32.dll")]
|
||||
@ -25,18 +24,12 @@ public class PanelButton : MonoBehaviour
|
||||
|
||||
private Renderer cr;
|
||||
public GameObject camera;
|
||||
private AudioSource audioSrc;
|
||||
private static AudioClip btnSound;
|
||||
public AudioSource audioSrc;
|
||||
|
||||
void Start()
|
||||
{
|
||||
btnSound = Resources.Load<AudioClip>("Audio/button press");
|
||||
cr = GetComponent<Renderer>();
|
||||
|
||||
audioSrc = GetComponent<AudioSource>();
|
||||
audioSrc.playOnAwake = false;
|
||||
audioSrc.clip = btnSound;
|
||||
|
||||
if (isToggle)
|
||||
{
|
||||
// initialize toggle state
|
||||
@ -50,7 +43,7 @@ public class PanelButton : MonoBehaviour
|
||||
_insideColliderCount += 1;
|
||||
ButtonPress();
|
||||
if (doesBeep)
|
||||
audioSrc.Play();
|
||||
audioSrc?.Play();
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
|
@ -20,8 +20,6 @@ public class PanelHiderButton : MonoBehaviour
|
||||
[SerializeField]
|
||||
private Image timerRing;
|
||||
[SerializeField]
|
||||
private AudioSource audioSrc;
|
||||
[SerializeField]
|
||||
private List<GameObject> panelButtons;
|
||||
|
||||
[Header("Assets")]
|
||||
@ -34,8 +32,10 @@ public class PanelHiderButton : MonoBehaviour
|
||||
[SerializeField]
|
||||
private AudioClip unlockSound;
|
||||
|
||||
private AudioSource audioSrc;
|
||||
private void Start()
|
||||
{
|
||||
audioSrc = GetComponent<AudioSource>();
|
||||
r = GetComponent<Renderer>();
|
||||
statusImg.texture = isLocked ? lockImg : unlockImg;
|
||||
audioSrc.clip = lockSound;
|
||||
|
@ -3,22 +3,16 @@ using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
using WindowsInput.Native;
|
||||
|
||||
[RequireComponent(typeof(AudioSource))]
|
||||
public class PanelThirdPersonButton : MonoBehaviour
|
||||
{
|
||||
public bool isTP;
|
||||
|
||||
private Renderer cr;
|
||||
public GameObject tpCamera;
|
||||
private AudioSource audioSrc;
|
||||
private static AudioClip btnSound;
|
||||
public AudioSource audioSrc;
|
||||
|
||||
void Start()
|
||||
{
|
||||
btnSound = Resources.Load<AudioClip>("Audio/button press");
|
||||
audioSrc = GetComponent<AudioSource>();
|
||||
audioSrc.playOnAwake = false;
|
||||
audioSrc.clip = btnSound;
|
||||
|
||||
cr = GetComponent<Renderer>();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user