Музыка есть
This commit is contained in:
1 parent
557c4c3dee
commit
346dc97fef
67 files changed
+774
-66
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using Code.App.StateMachine;
|
||||
using Code.Audio;
|
||||
using Code.Gameplay.Camera;
|
||||
using Code.Gameplay.Player;
|
||||
using Code.Input;
|
||||
@@ -14,7 +15,7 @@ namespace Code.App.AppStates
|
||||
private PlayerHealth _playerHealth;
|
||||
private PlayerMoney _playerMoney;
|
||||
|
||||
private bool _uiLoaded, _sceneLoaded;
|
||||
private bool _uiLoaded, _sceneLoaded, _onGameplayMusicLoaded, _onActionMusicLoaded;
|
||||
|
||||
public GameplayState(AppStateMachineContext context) : base(context)
|
||||
{
|
||||
@@ -22,7 +23,7 @@ namespace Code.App.AppStates
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
_uiLoaded = _sceneLoaded = false;
|
||||
_uiLoaded = _sceneLoaded = _onActionMusicLoaded = _onGameplayMusicLoaded = false;
|
||||
|
||||
Context.UIService.LoadingScreen.Show();
|
||||
|
||||
@@ -35,12 +36,23 @@ namespace Code.App.AppStates
|
||||
|
||||
Context.UIService.SwitchPanelTo(UIPanel.Gameplay, callback: PostUILoaded);
|
||||
|
||||
Context.AudioFactory.WarmGameplayMusic(OnGameplayMusicLoaded);
|
||||
Context.AudioService.TransitToSnapshot(AudioSnapshotState.Peaceful);
|
||||
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.GiveHealth, GiveHealth);
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.GiveMoney, GiveMoney);
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.LooseHealth, LooseHealth);
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.LooseMoney, LooseMoney);
|
||||
}
|
||||
|
||||
private void OnGameplayMusicLoaded()
|
||||
{
|
||||
_onGameplayMusicLoaded = true;
|
||||
|
||||
// Context.AudioService.();
|
||||
|
||||
CheckIfLoaded();
|
||||
}
|
||||
private void OnSceneLoaded()
|
||||
{
|
||||
_sceneLoaded = true;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Code.App.StateMachine;
|
||||
using Code.Audio;
|
||||
using Code.Gameplay.Camera;
|
||||
using Code.Gameplay.Camera.CameraStates;
|
||||
using Code.Input;
|
||||
@@ -14,14 +15,14 @@ namespace Code.App.AppStates
|
||||
{
|
||||
public class MainMenuState : BaseState<AppStateMachineContext>
|
||||
{
|
||||
private bool _uiLoaded, _sceneLoaded;
|
||||
private bool _uiLoaded, _sceneLoaded, _menuMusicLoaded;
|
||||
public MainMenuState(AppStateMachineContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
_uiLoaded = _sceneLoaded = false;
|
||||
_uiLoaded = _sceneLoaded = _menuMusicLoaded = false;
|
||||
|
||||
Context.UIService.LoadingScreen.Show();
|
||||
|
||||
@@ -29,9 +30,20 @@ namespace Code.App.AppStates
|
||||
|
||||
Context.UIService.SwitchPanelTo(UIPanel.MainMenu, PostUILoaded);
|
||||
|
||||
Context.AudioFactory.WarmMenuMusic(MenuMusicLoaded);
|
||||
|
||||
Context.CameraStateMachine.SwitchState(CameraMode.Static);
|
||||
}
|
||||
|
||||
private void MenuMusicLoaded()
|
||||
{
|
||||
_menuMusicLoaded = true;
|
||||
|
||||
Context.AudioService.TransitToSnapshot(AudioSnapshotState.Peaceful);
|
||||
Context.AudioService.PlayRandomMenuMusicUntilHumanityWillBeDestroyedForTheySins();
|
||||
|
||||
CheckIfLoaded();
|
||||
}
|
||||
private void PostUILoaded()
|
||||
{
|
||||
((MainMenuPanel)Context.UIService.CurrentPanel).startButton.onClick.AddListener(StartGame);
|
||||
@@ -60,7 +72,7 @@ namespace Code.App.AppStates
|
||||
|
||||
private void CheckIfLoaded()
|
||||
{
|
||||
if(!_uiLoaded || !_sceneLoaded) return;
|
||||
if(!_uiLoaded || !_sceneLoaded || !_menuMusicLoaded) return;
|
||||
|
||||
Context.UIService.LoadingScreen.Hide();
|
||||
|
||||
@@ -87,7 +99,8 @@ namespace Code.App.AppStates
|
||||
public override void ExitState()
|
||||
{
|
||||
Context.InputService.DisableMap(ActionMappings.MainMenu);
|
||||
|
||||
Context.AudioService.GladlyAskToStopMenuMusic(Context.AudioFactory.ReleaseMenuMusic);
|
||||
|
||||
base.ExitState();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user