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

@@ -73,10 +73,12 @@ GameObject:
- component: {fileID: 1807660236798938897}
- component: {fileID: 1013965729963872153}
- component: {fileID: 7220179918976106526}
- component: {fileID: 7410036744236083586}
- component: {fileID: 9011244016352067911}
- component: {fileID: 7092592538514510748}
- component: {fileID: 5849392838882679854}
- component: {fileID: 582799264655932961}
- component: {fileID: 3380663186425371797}
m_Layer: 0
m_Name: PlayerReplayer
m_TagString: Untagged
@@ -126,6 +128,11 @@ MonoBehaviour:
FrontLayerImage: {fileID: 0}
StillObject: {fileID: 2530260195553021270}
MovingObject: {fileID: 2870226596601462640}
AudioClips:
- {fileID: 8300000, guid: 696e56537295ac244b2de595287b4931, type: 3}
- {fileID: 8300000, guid: 413764415f5bf42429d26861fc5e82cf, type: 3}
- {fileID: 8300000, guid: 21713b7ac8710bf4fb3b949bbbebb67a, type: 3}
PlayerAudioSource: {fileID: 3380663186425371797}
--- !u!20 &7220179918976106526
Camera:
m_ObjectHideFlags: 0
@@ -177,6 +184,14 @@ Camera:
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!81 &7410036744236083586
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5082956827802089079}
m_Enabled: 1
--- !u!114 &9011244016352067911
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -292,6 +307,102 @@ Rigidbody:
m_Interpolate: 1
m_Constraints: 0
m_CollisionDetection: 1
--- !u!82 &3380663186425371797
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5082956827802089079}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &6013909295272487250
GameObject:
m_ObjectHideFlags: 0

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

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections;
using InterfaceOff.WorldScene;
using UnityEngine;
namespace InterfaceOff
@@ -14,6 +15,8 @@ namespace InterfaceOff
public void InstantiateWindowBase(WindowSpawner creator)
{
PlayerController.PlayRandomErrorSound();
transform.position = CanvasManager.GetRandomPositionOnCanvas();
Creator = creator;