Fixed a bug where state machines and auto play audio on awake fucked me
This commit is contained in:
@@ -435615,11 +435615,6 @@ Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 5145306031820616614, guid: fbbe1f4baf226904b96f839fe0c00181, type: 3}
|
||||
m_PrefabInstance: {fileID: 374459781}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &378341385 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 5943355783477523754, guid: 9b2926886934b554f9a1727331d34787, type: 3}
|
||||
m_PrefabInstance: {fileID: 1070397503}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &381929909
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -444473,7 +444468,7 @@ AudioSource:
|
||||
OutputAudioMixerGroup: {fileID: 0}
|
||||
m_audioClip: {fileID: 0}
|
||||
m_Resource: {fileID: 0}
|
||||
m_PlayOnAwake: 1
|
||||
m_PlayOnAwake: 0
|
||||
m_Volume: 1
|
||||
m_Pitch: 1
|
||||
Loop: 0
|
||||
@@ -446097,7 +446092,7 @@ AudioSource:
|
||||
OutputAudioMixerGroup: {fileID: 0}
|
||||
m_audioClip: {fileID: 0}
|
||||
m_Resource: {fileID: 0}
|
||||
m_PlayOnAwake: 1
|
||||
m_PlayOnAwake: 0
|
||||
m_Volume: 1
|
||||
m_Pitch: 1
|
||||
Loop: 0
|
||||
@@ -446197,7 +446192,7 @@ MonoBehaviour:
|
||||
audioSourceType: 0
|
||||
audioSource: {fileID: 0}
|
||||
clipPriority: 0
|
||||
sourcePriority: 0
|
||||
sourcePriority: 1
|
||||
--- !u!1 &871315074 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 5383276844808284485, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3}
|
||||
@@ -450971,9 +450966,6 @@ PrefabInstance:
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 1436203570}
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 5943355783477523754, guid: 9b2926886934b554f9a1727331d34787, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 1516406297}
|
||||
- targetCorrespondingSourceObject: {fileID: 1011363502278351410, guid: 9b2926886934b554f9a1727331d34787, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 2133104410}
|
||||
@@ -460688,109 +460680,12 @@ MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 578146208477020881, guid: 9b2926886934b554f9a1727331d34787, type: 3}
|
||||
m_PrefabInstance: {fileID: 1070397503}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 378341385}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 603ecc4a6ab6bb84c8cb9773fa310b69, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: '::'
|
||||
--- !u!82 &1516406297
|
||||
AudioSource:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 378341385}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 4
|
||||
OutputAudioMixerGroup: {fileID: 0}
|
||||
m_audioClip: {fileID: 0}
|
||||
m_Resource: {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 &1519887120 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 825072831861764844, guid: 3beba8513eb20af4493d170a3203efb0, type: 3}
|
||||
@@ -468847,7 +468742,7 @@ AudioSource:
|
||||
OutputAudioMixerGroup: {fileID: 0}
|
||||
m_audioClip: {fileID: 0}
|
||||
m_Resource: {fileID: 0}
|
||||
m_PlayOnAwake: 1
|
||||
m_PlayOnAwake: 0
|
||||
m_Volume: 1
|
||||
m_Pitch: 1
|
||||
Loop: 0
|
||||
@@ -468974,7 +468869,7 @@ MonoBehaviour:
|
||||
audioSourceType: 0
|
||||
audioSource: {fileID: 0}
|
||||
clipPriority: 0
|
||||
sourcePriority: 0
|
||||
sourcePriority: 1
|
||||
--- !u!1 &1877702733
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -475344,7 +475239,7 @@ AudioSource:
|
||||
OutputAudioMixerGroup: {fileID: 0}
|
||||
m_audioClip: {fileID: 0}
|
||||
m_Resource: {fileID: 0}
|
||||
m_PlayOnAwake: 1
|
||||
m_PlayOnAwake: 0
|
||||
m_Volume: 1
|
||||
m_Pitch: 1
|
||||
Loop: 0
|
||||
@@ -475471,7 +475366,7 @@ MonoBehaviour:
|
||||
audioSourceType: 0
|
||||
audioSource: {fileID: 0}
|
||||
clipPriority: 0
|
||||
sourcePriority: 0
|
||||
sourcePriority: 1
|
||||
--- !u!4 &2144703707 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 9067462609398217044, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class AppleAudioSource : MonoBehaviour
|
||||
{
|
||||
public enum AudioSourceType{CriticalVO,VO,Ambience,SFX,Music}
|
||||
public AudioSourceType audioSourceType;
|
||||
public AudioSource audioSource;
|
||||
[HideInInspector] public AudioSource audioSource;
|
||||
private AudioMixer _audioMixer;
|
||||
[HideInInspector ] public int clipPriority;
|
||||
public int sourcePriority;
|
||||
@@ -25,6 +25,7 @@ public class AppleAudioSource : MonoBehaviour
|
||||
AudioManager.Instance.RegisterNewAudioSource(this);
|
||||
_audioMixer = AudioManager.Instance.audioMixer;
|
||||
InitializeAudioSource();
|
||||
audioSource.playOnAwake = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -255,8 +255,23 @@ public class AudioManager : MonoBehaviour, IPausable
|
||||
private void InterruptAudioSource(AppleAudioSource newAudioSource)
|
||||
{
|
||||
wasInterrupted = true;
|
||||
currentlyPlayingVO.InterruptAudio(newAudioSource.name);
|
||||
//currentlyPlayingVO.InterruptAudio(newAudioSource.name);
|
||||
InterruptAllVOSources();
|
||||
ResetAudioSource();
|
||||
currentlyPlayingVO = newAudioSource;
|
||||
}
|
||||
|
||||
private void InterruptAllVOSources()
|
||||
{
|
||||
foreach (AppleAudioSource source in criticalVOSources)
|
||||
{
|
||||
source.InterruptAudio("GlobalInterrupt");
|
||||
|
||||
}
|
||||
foreach (AppleAudioSource source in VOSources)
|
||||
{
|
||||
source.InterruptAudio("GlobalInterrupt");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user