Fixed EndRound music looping forever. Closes #334
This commit is contained in:
@@ -272,6 +272,7 @@ namespace Barotrauma
|
||||
var cinematic = new TransitionCinematic(leavingSubs, GameMain.GameScreen.Cam, 5.0f);
|
||||
|
||||
SoundPlayer.OverrideMusicType = CrewManager.GetCharacters().Any(c => !c.IsDead) ? "endround" : "crewdead";
|
||||
SoundPlayer.OverrideMusicDuration = 18.0f;
|
||||
|
||||
CoroutineManager.StartCoroutine(EndCinematic(cinematic), "EndCinematic");
|
||||
|
||||
@@ -282,18 +283,12 @@ namespace Barotrauma
|
||||
{
|
||||
while (cinematic.Running)
|
||||
{
|
||||
if (Submarine.MainSub == null) yield return CoroutineStatus.Success;
|
||||
if (Submarine.MainSub == null) yield return CoroutineStatus.Success;
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
}
|
||||
|
||||
if (Submarine.MainSub == null) yield return CoroutineStatus.Success;
|
||||
|
||||
End("");
|
||||
|
||||
yield return new WaitForSeconds(18.0f);
|
||||
|
||||
SoundPlayer.OverrideMusicType = null;
|
||||
if (Submarine.MainSub != null) End("");
|
||||
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace Barotrauma
|
||||
if (!singleplayer)
|
||||
{
|
||||
SoundPlayer.OverrideMusicType = gameOver ? "crewdead" : "endround";
|
||||
SoundPlayer.OverrideMusicDuration = 18.0f;
|
||||
}
|
||||
|
||||
string summaryText = TextManager.Get(gameOver ? "RoundSummaryGameOver" :
|
||||
|
||||
@@ -335,6 +335,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
SoundPlayer.OverrideMusicType = "none";
|
||||
SoundPlayer.OverrideMusicDuration = null;
|
||||
for (int i = 0; i < Sounds.SoundManager.DefaultSourceCount; i++)
|
||||
{
|
||||
Sounds.SoundManager.Pause(i);
|
||||
|
||||
@@ -86,6 +86,8 @@ namespace Barotrauma
|
||||
set;
|
||||
}
|
||||
|
||||
public static float? OverrideMusicDuration;
|
||||
|
||||
public static int SoundCount;
|
||||
|
||||
public static IEnumerable<object> Init()
|
||||
@@ -278,6 +280,16 @@ namespace Barotrauma
|
||||
{
|
||||
if (musicClips == null) return;
|
||||
|
||||
if (OverrideMusicType != null && OverrideMusicDuration.HasValue)
|
||||
{
|
||||
OverrideMusicDuration -= deltaTime;
|
||||
if (OverrideMusicDuration <= 0.0f)
|
||||
{
|
||||
OverrideMusicType = null;
|
||||
OverrideMusicDuration = null;
|
||||
}
|
||||
}
|
||||
|
||||
updateMusicTimer -= deltaTime;
|
||||
if (updateMusicTimer <= 0.0f)
|
||||
{
|
||||
|
||||
@@ -1514,9 +1514,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
yield return CoroutineStatus.Running;
|
||||
} while (cinematic.Running);
|
||||
#if CLIENT
|
||||
SoundPlayer.OverrideMusicType = null;
|
||||
#endif
|
||||
|
||||
Submarine.Unload();
|
||||
entityEventManager.Clear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user