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