Нашёл причину утечки памяти
This commit is contained in:
1 parent
60c28f54f2
commit
320847af5b
229 files changed
+3094
-18282
No files matched your search
@@ -76,11 +76,22 @@ namespace Code.Example.Platformer
|
||||
Context.CameraFactory.ReleaseCinemachineCamera(CameraMode.Platformer);
|
||||
Context.InputService.DisableMap(ActionMappings.Platformer);
|
||||
|
||||
_audioFactory.ReleaseAudios(AudioNames.Platformer);
|
||||
Context.AudioService.ChangeGroupVolume(
|
||||
AudioGroupType.Music,
|
||||
0f,
|
||||
0.5f,
|
||||
ReleasePlatformerMusic);
|
||||
|
||||
EventBus.Unsubscribe(this);
|
||||
}
|
||||
|
||||
private void ReleasePlatformerMusic()
|
||||
{
|
||||
Context.AudioService.CancelMusic(AudioNames.Platformer, 0);
|
||||
Context.AudioService.CancelMusic(AudioNames.Platformer, 7);
|
||||
_audioFactory.ReleaseAudios(AudioNames.Platformer);
|
||||
}
|
||||
|
||||
private void StartInitialLoading()
|
||||
{
|
||||
|
||||
@@ -259,6 +270,25 @@ namespace Code.Example.Platformer
|
||||
}
|
||||
|
||||
public void PlayerDied()
|
||||
{
|
||||
_loading = new(2, EndGameLoading);
|
||||
|
||||
Context.AudioService.ChangeGroupVolume(
|
||||
AudioGroupType.Music,
|
||||
0f,
|
||||
0.5f,
|
||||
OffTheMusic);
|
||||
|
||||
Context.UIService.OpenPanel(UIPanelType.Loading);
|
||||
}
|
||||
|
||||
private void OffTheMusic()
|
||||
{
|
||||
ReleasePlatformerMusic();
|
||||
_loading.DoProgress();
|
||||
}
|
||||
|
||||
private void EndGameLoading()
|
||||
{
|
||||
Context.StateMachine.SwitchState(AppStates.MainMenu)
|
||||
.AllowStateTransition(AppStates.Platformer);
|
||||
|
||||
Reference in new issue
Block a user