Addressables in process
This commit is contained in:
1 parent
1ad87e7432
commit
6b1f24b72e
13 files changed
+122
-77
No files matched your search
@@ -5,7 +5,6 @@ using Code.Input;
|
||||
using Code.Scenes;
|
||||
using Code.StateMachine;
|
||||
using Code.UI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Code.App.AppStates
|
||||
@@ -15,6 +14,8 @@ namespace Code.App.AppStates
|
||||
private PlayerHealth _playerHealth;
|
||||
private PlayerMoney _playerMoney;
|
||||
|
||||
private bool _uiLoaded, _sceneLoaded;
|
||||
|
||||
public GameplayState(AppStateMachineContext context) : base(context)
|
||||
{
|
||||
}
|
||||
@@ -23,12 +24,9 @@ namespace Code.App.AppStates
|
||||
{
|
||||
Context.UIService.LoadingScreen.Show();
|
||||
|
||||
Context.SceneLoaderService.LoadScene((int)SceneIds.MovementDev, SceneLoaded); // TODO Фабрика говна Nada
|
||||
Context.InputService.EnableMap(ActionMappings.Gameplay);
|
||||
|
||||
Context.UIService.SwitchPanelTo(UIPanel.Gameplay);
|
||||
|
||||
Context.CameraStateMachine.SwitchState(CameraMode.FirstPerson);
|
||||
Context.SceneLoaderService.LoadSceneAsync((int)SceneIds.MovementDev, callBack: OnSceneLoaded); // TODO Фабрика говна Nada
|
||||
|
||||
Context.UIService.SwitchPanelTo(UIPanel.Gameplay, callback: PostUILoaded);
|
||||
|
||||
_playerMoney = Context.PlayerFactory.CreatePlayerMoney();
|
||||
_playerHealth = Context.PlayerFactory.CreatePlayerHealth();
|
||||
@@ -40,16 +38,32 @@ namespace Code.App.AppStates
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.LooseHealth, LooseHealth);
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.LooseMoney, LooseMoney);
|
||||
}
|
||||
|
||||
private void OnSceneLoaded()
|
||||
{
|
||||
_sceneLoaded = true;
|
||||
CheckIfLoaded();
|
||||
}
|
||||
|
||||
private void SceneLoaded()
|
||||
private void PostUILoaded()
|
||||
{
|
||||
((GameplayPanel)(Context.UIService.CurrentPanel)).Initialize(_playerMoney, _playerHealth);
|
||||
Context.UIService.LoadingScreen.Hide();
|
||||
|
||||
base.EnterState();
|
||||
_uiLoaded = true;
|
||||
CheckIfLoaded();
|
||||
}
|
||||
|
||||
|
||||
private void CheckIfLoaded()
|
||||
{
|
||||
if(!_uiLoaded || !_sceneLoaded) return;
|
||||
|
||||
Context.UIService.LoadingScreen.Hide();
|
||||
|
||||
Context.CameraStateMachine.SwitchState(CameraMode.FirstPerson);
|
||||
Context.InputService.EnableMap(ActionMappings.Gameplay);
|
||||
}
|
||||
|
||||
|
||||
// Debug
|
||||
private void GiveHealth(InputAction.CallbackContext context)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user