Пример #1
0
        /// <summary>
        ///     Updates the Input.
        /// </summary>
        private void UpdateInput()
        {
            _newMouseState = Input.Mouse.GetState();

            if (!_gameStarted)
            {
                if (_newMouseState.IsMouseButtonDown(MouseButtons.Left))
                {
                    _gameStarted = true;
                }
            }
            else
            {
                if (!_isDead)
                {
                    if (_newMouseState.IsMouseButtonDown(MouseButtons.Left))
                    {
                        _player.Velocity= new Vector2(0, -4.5f);
                        _swing.Play();
                    }
                }
            }

            if (_gameStarted && _isDead)
            {
                if (_newMouseState.IsMouseButtonDown(MouseButtons.Left))
                {
                    //reset game.
                    _player.Position = new Vector2(300, 230);
                    _player.Dead = false;
                    _player.Velocity = new Vector2(0, 0);
                    _isDead = false;
                    _gameStarted = false;
                    _pipeManager.Reset();
                    _pipeManager.Opacity = 1f;
                }
            }
        }