Made error sounds play in the background

This commit is contained in:
2026-01-22 22:24:22 +00:00
parent 16c35e1624
commit b3e5769758
3 changed files with 131 additions and 0 deletions

View File

@@ -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;
}