using Code.App.StateMachine; using Code.Scenes; using Code.StateMachine; using Code.UI; using UnityEngine; namespace Code.App.AppStates { public class GameOverState : BaseState { public GameOverState(AppStateMachineContext context) : base(context) { } private float damnTimer = 3f; // TODO Удалить при первой возможности public override void EnterState() { Context.UIService.SwitchPanelTo(UIPanel.GameOver); base.EnterState(); } private void ToMainMenu() { Context.StateMachine.SwitchState(AppState.MainMenu) .AllowStateTransition(AppState.Gameplay); } public override void Tick() { damnTimer -= Time.deltaTime; if (damnTimer <= float.Epsilon) ToMainMenu(); } public override void ExitState() { damnTimer = 5f; Context.UIService.LoadingScreen.Show(); base.ExitState(); } } }