1
0
Fork 0

LoopingFix

This commit is contained in:
Unknown 2018-04-23 03:13:42 +02:00
parent 3fd5637ec9
commit 42bf9150ae
2 changed files with 6 additions and 4 deletions

View file

@ -13,6 +13,8 @@ public class AudioControl : MonoBehaviour
public enum Sfx { shoot, explosion, mobattack }; public enum Sfx { shoot, explosion, mobattack };
private const float lvlbgm = 37.879f; private const float lvlbgm = 37.879f;
private const float gobgm = 14.406f;
private const float loopdelay = 0.05f;
private bool menu; private bool menu;
// Use this for initialization // Use this for initialization
@ -20,15 +22,14 @@ public class AudioControl : MonoBehaviour
{ {
maintheme.loop = true; maintheme.loop = true;
gameovers.loop = true; gameovers.loop = true;
maintheme.Play();
} }
private void Update() private void Update()
{ {
if (maintheme.time >= 99.0f) if (maintheme.time >= maintheme.clip.length - loopdelay)
maintheme.time = lvlbgm; maintheme.time = lvlbgm;
if (gameovers.time >= 22.85f) if (gameovers.time >= gameovers.clip.length - loopdelay)
gameovers.time = 3; gameovers.time = gobgm;
} }
public void GameOverBgm() public void GameOverBgm()

View file

@ -71,6 +71,7 @@ AudioMixerSnapshotController:
m_SnapshotID: d3789ccdbdc046a448f1887d94c3f7f5 m_SnapshotID: d3789ccdbdc046a448f1887d94c3f7f5
m_FloatValues: m_FloatValues:
25123d234de4ec84aafee1d0c380f3ad: 0.025578512 25123d234de4ec84aafee1d0c380f3ad: 0.025578512
7e224658afaf14242ba3996793ac12a1: -7.436929
m_TransitionOverrides: {} m_TransitionOverrides: {}
--- !u!243 &243067197919102372 --- !u!243 &243067197919102372
AudioMixerGroupController: AudioMixerGroupController: