示例#1
0
    public InputManager()
    {
        _controls = new PlayerInput();

        #region Game
        _controls.Game.Movement.started   += ctx => ShipMove.Invoke(true);
        _controls.Game.Movement.canceled  += ctx => ShipMove.Invoke(false);
        _controls.Game.Rotation.performed += ctx => ShipRotate.Invoke(ctx.ReadValue <float>());
        _controls.Game.Rotation.canceled  += ctx => ShipRotate.Invoke(0);
        _controls.Game.Fire.started       += ctx => ShipFire.Invoke(true);
        _controls.Game.Fire.canceled      += ctx => ShipFire.Invoke(false);
        _controls.Game.Pause.started      += ctx => GamePause.Invoke();
        _controls.Game.Restart.started    += ctx => GameRestart.Invoke();
        #endregion

        #region Pause
        _controls.Pause.Exit.started   += ctx => PauseExit.Invoke();
        _controls.Pause.Resume.started += ctx => PauseResume.Invoke();
        #endregion

        #region Game Over
        _controls.GameOver.Restart.started += ctx => GameOverRestart.Invoke();
        _controls.GameOver.Exit.started    += ctx => GameOverExit.Invoke();
        #endregion

        GameManager.Instance.OnGameStateChanged += SwitchInputType;
    }
        private IEnumerator PauseOut()
        {
            m_pauseLock = true;
            m_canvasAnim.SetBool("PauseVisible", false);
            yield return(new WaitForSeconds(1f));

            PauseRequest?.Invoke(this, false);
            m_canvasAnim.SetBool("OverlayPause", false);
            yield return(new WaitForSeconds(1f));

            PauseExit?.Invoke(this, null);
            m_fogCtrl.SetActive(m_retFogEnabled);
            m_pauseLock = false;
        }