private void HandleCameraMovement(KeyboardGuru keyboardGuru)
        {
            Rectangle newPostion  = Utils.CameraPostionRectangle();
            float     camreaSpeed = Settings.CAMERA_SPEED;

            if (_inputAdapter.KeyDown(Settings.KEY_FAST_CAMREA))
            {
                camreaSpeed *= 5;
            }

            if (_inputAdapter.KeyDown(Settings.KEY_LEFT_MOVEMENT))
            {
                newPostion.X -= camreaSpeed;
            }

            if (_inputAdapter.KeyDown(Settings.KEY_RIGHT_MOVEMENT))
            {
                newPostion.X += camreaSpeed;
            }

            if (_inputAdapter.KeyDown(Settings.KEY_UP_MOVEMENT))
            {
                newPostion.Y -= camreaSpeed;
            }

            if (_inputAdapter.KeyDown(Settings.KEY_DOWN_MOVEMENT))
            {
                newPostion.Y += camreaSpeed;
            }

            if (Utils.InsideGameBounds(newPostion))
            {
                SetCameraPostion(newPostion);
            }
        }
Esempio n. 2
0
        public void Refersh(IInputAdapter adapter)
        {
            _states.Clear();

            foreach (KeyCode value in Enum.GetValues(typeof(KeyCode)))
            {
                _states.Add(value, adapter.KeyDown(value));
            }
        }