Made error sounds play in the background
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace InterfaceOff.WorldScene
|
||||
{
|
||||
@@ -19,6 +20,20 @@ namespace InterfaceOff.WorldScene
|
||||
[SerializeField] private Image FrontLayerImage;
|
||||
[SerializeField] private GameObject StillObject;
|
||||
[SerializeField] private GameObject MovingObject;
|
||||
[SerializeField] private AudioClip[] AudioClips;
|
||||
[SerializeField] private AudioSource PlayerAudioSource;
|
||||
|
||||
public static void PlayRandomErrorSound()
|
||||
{
|
||||
if (DebugUtils.IsNull(Instance))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int audioIndex = Random.Range(0, Instance.AudioClips.Length);
|
||||
Instance.PlayerAudioSource.PlayOneShot(Instance.AudioClips[audioIndex]);
|
||||
Instance.PlayerAudioSource.pitch = Random.Range(0.9f, 1.1f);
|
||||
}
|
||||
|
||||
private const int MAX_WINDOWS = 20;
|
||||
|
||||
@@ -27,6 +42,8 @@ namespace InterfaceOff.WorldScene
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
|
||||
/* Loads the JSON */
|
||||
Frames = JsonUtility.FromJson<PlayerFrameInfoArray>(PlayerFrameDump.DUMPED_STRING).FrameInfo;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user