Интерфейс, конфиги камер
This commit is contained in:
1 parent
efad72b4d9
commit
e5f4f292c2
66 files changed
+11465
-9059
No files matched your search
@@ -1,5 +1,6 @@
|
||||
using System.Globalization;
|
||||
using System.Reflection.Emit;
|
||||
using Code.App.Loading;
|
||||
using Code.App.StateMachine;
|
||||
using Code.Audio;
|
||||
using Code.Gameplay.Camera;
|
||||
@@ -41,7 +42,13 @@ namespace Code.App.AppStates
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
Context.UIService.LoadingScreen.Show();
|
||||
Context.LoadingManager
|
||||
.RegisterLoading(LoadingWork.LoadScene)
|
||||
.RegisterLoading(LoadingWork.WaitForSceneInstaller)
|
||||
.RegisterLoading(LoadingWork.LoadUI)
|
||||
.RegisterLoading(LoadingWork.LoadModelResource)
|
||||
.RegisterLoading(LoadingWork.LoadAudio);
|
||||
// Context.UIService.LoadingScreen.Show();
|
||||
|
||||
_playerMoney = Context.PlayerFactory.CreatePlayerMoney();
|
||||
_playerHealth = Context.PlayerFactory.CreatePlayerHealth();
|
||||
@@ -79,7 +86,6 @@ namespace Code.App.AppStates
|
||||
WaitForPlayerArmsToInitialize(),
|
||||
WaitForPlayerCharacterLoad()
|
||||
);
|
||||
MusicInitialize();
|
||||
|
||||
Container sceneContainer = SceneManager.GetActiveScene().GetSceneContainer();
|
||||
|
||||
@@ -87,24 +93,35 @@ namespace Code.App.AppStates
|
||||
|
||||
PlayerInitialize(sceneEnvironment);
|
||||
|
||||
UIInitialize();
|
||||
|
||||
CameraInitialize();
|
||||
|
||||
InputServiceInitialize();
|
||||
|
||||
GameplayServicesInitialize(sceneContainer);
|
||||
|
||||
MusicInitialize();
|
||||
|
||||
UIInitialize();
|
||||
|
||||
_tickEnabled = true;
|
||||
|
||||
Context.UIService.LoadingScreen.Hide();
|
||||
Context.LoadingManager
|
||||
.UnregisterLoading(LoadingWork.LoadScene)
|
||||
.UnregisterLoading(LoadingWork.LoadUI)
|
||||
.UnregisterLoading(LoadingWork.LoadModelResource)
|
||||
.UnregisterLoading(LoadingWork.LoadAudio);
|
||||
// Context.UIService.LoadingScreen.Hide();
|
||||
}
|
||||
|
||||
private async UniTask WaitForPlayerArmsToInitialize() => _armsMesh = await Context.PlayerFactory.CreateArms(Context.CameraStateMachine.Camera.transform);
|
||||
|
||||
private void OrderGiven(float time)
|
||||
{
|
||||
|
||||
_gameplayPanel.ShowTimer();
|
||||
}
|
||||
private void OrderFailure()
|
||||
{
|
||||
_playerHealth.InstaKill();
|
||||
}
|
||||
private void OrderRecieved(float time)
|
||||
{
|
||||
@@ -112,6 +129,8 @@ namespace Code.App.AppStates
|
||||
}
|
||||
private void OrderDelivered(int score, float time)
|
||||
{
|
||||
_gameplayPanel.HideTimer();
|
||||
|
||||
if(time < 0f) Context.AudioService.PlayDispatcher((DispatcherSounds)Random.Range((int)DispatcherSounds.Late1,(int)DispatcherSounds.Late2));
|
||||
_playerMoney.GiveMoney(score);
|
||||
}
|
||||
@@ -145,8 +164,7 @@ namespace Code.App.AppStates
|
||||
{
|
||||
if (!_tickEnabled) return;
|
||||
|
||||
// TODO ГРЯЗь
|
||||
_gameplayPanel.Timer.text = ((int)_orderService.DecreaseTimer(Time.deltaTime)).ToString(CultureInfo.CurrentCulture);
|
||||
_orderService.DecreaseTimer(Time.deltaTime);
|
||||
}
|
||||
|
||||
private void EndGame()
|
||||
@@ -166,6 +184,7 @@ namespace Code.App.AppStates
|
||||
_playerCharacter = null;
|
||||
Context.PlayerFactory.ReleaseArms(_armsMesh);
|
||||
_armsMesh = null;
|
||||
_orderService = null;
|
||||
|
||||
Context.InputService.DisableMap(ActionMappings.Gameplay);
|
||||
Context.AudioService.GladlyAskToStopMusic(MusicType.Action, callback: Context.AudioFactory.ReleaseActionMusic);
|
||||
@@ -198,7 +217,9 @@ namespace Code.App.AppStates
|
||||
private void UIInitialize()
|
||||
{
|
||||
_gameplayPanel = (GameplayPanel)Context.UIService.CurrentPanel;
|
||||
_gameplayPanel.Initialize(_playerMoney, _playerHealth);
|
||||
_gameplayPanel.Initialize(_playerMoney, _playerHealth, _orderService);
|
||||
Context.AudioService.OnDispatcherStarted += _gameplayPanel.SummonDispatcher;
|
||||
Context.AudioService.OnDispatcherEnded += _gameplayPanel.CloseDispatcher;
|
||||
}
|
||||
private void MusicInitialize()
|
||||
{
|
||||
@@ -218,6 +239,7 @@ namespace Code.App.AppStates
|
||||
_orderService.OnOrderGiven += OrderGiven;
|
||||
_orderService.OnOrderRecieved += OrderRecieved;
|
||||
_orderService.OnOrderDelivered += OrderDelivered;
|
||||
_orderService.OnOrderFailure += OrderFailure;
|
||||
}
|
||||
private GameplaySceneEnvironment SceneEnvironmentVariables(Container sceneContainer)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user