using Code.Infrastructure.App; using Code.Infrastructure.Camera; using Code.Infrastructure.Generators; using Code.Infrastructure.Input; using Code.Infrastructure.SceneLoader; using Cysharp.Threading.Tasks; using UnityEngine; using UnityEngine.InputSystem; namespace Code.Game.OfficeGame.GameStates { [State(typeof(AppStates), typeof(AppStateMachineContext))] public partial class BattleState { public BattleState(AppStateMachineContext context) : base(context) { } public override AppStates MyState => AppStates.BattleState; public override async UniTask EnterState() { Cursor.lockState = CursorLockMode.Confined; #if UNITY_EDITOR Context.InputService.EnableMap(ActionMappings.Debug); Context.InputService.BindActionPerformed((int)ActionMappings.Debug, (int)DebugActions.ToggleBattleMode, ToggleBattleMode); #endif Context.InputService.EnableMap(ActionMappings.BattleMode); await Context.Camera.SwitchState(CameraMode.BattleMode); var container = Context.SceneContainerManager.ScenesContainers[SceneId.Testing]; (Context.Camera.CurrentBaseState).EnterState(); } private void ToggleBattleMode(InputAction.CallbackContext obj) { Context.StateMachine.SwitchState(AppStates.Testing).Forget(); } public override async UniTask ExitState() { #if UNITY_EDITOR Context.InputService.DisableMap(ActionMappings.Debug); Context.InputService.UnbindActionPerformed((int)ActionMappings.Debug, (int)DebugActions.ToggleBattleMode, ToggleBattleMode); #endif Context.InputService.DisableMap(ActionMappings.BattleMode); } } }