예제 #1
0
        private void OnKeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                _isPaused = !_isPaused;
            }

            if (e.Key == Key.Escape)
            {
                Close();
            }

            var spaceCraft = _gravitationalBodies[_targetIndex] as ISpaceCraft;

            if (spaceCraft != null)
            {
                spaceCraft.Controller.KeyUp(e.Key);
            }

            if (e.Key == Key.X)
            {
                _spaceCraftManager.ToggleDisplayVectors();
            }

            if (e.Key == Key.OemComma && _timeStepIndex > 0)
            {
                _timeStepIndex--;
                _userUpdatedTimesteps = true;
            }

            if (e.Key == Key.OemPeriod && !_isPaused && _timeStepIndex < _timeSteps.Count - 1)
            {
                _timeStepIndex++;
                _userUpdatedTimesteps = true;
            }

            if (e.Key == Key.OemCloseBrackets && !_isPaused)
            {
                _targetIndex = GravitationalBodyIterator.Next(_targetIndex, _gravitationalBodies, _camera);

                _camera.UpdateTarget(_gravitationalBodies[_targetIndex]);
            }

            if (e.Key == Key.OemOpenBrackets && !_isPaused)
            {
                _targetIndex = GravitationalBodyIterator.Prev(_targetIndex, _gravitationalBodies, _camera);

                _camera.UpdateTarget(_gravitationalBodies[_targetIndex]);
            }

            if (e.Key == Key.PageUp)
            {
                SetZoom(-0.02f);
            }

            if (e.Key == Key.PageDown)
            {
                SetZoom(0.04f);
            }
        }
예제 #2
0
        public void SetTarget(bool next)
        {
            if (next)
            {
                _targetIndex = GravitationalBodyIterator.Next(_targetIndex, _gravitationalBodies, _camera);
            }
            else
            {
                _targetIndex = GravitationalBodyIterator.Prev(_targetIndex, _gravitationalBodies, _camera);
            }

            _camera.UpdateTarget(_gravitationalBodies[_targetIndex]);
        }
예제 #3
0
        private void OnKeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                _isPaused = !_isPaused;
            }

            if (e.Key == Key.Escape)
            {
                Close();
            }

            var spaceCraft = _gravitationalBodies[_targetIndex] as ISpaceCraft;

            if (spaceCraft != null)
            {
                spaceCraft.Controller.KeyUp(e.Key);
            }

            if (e.Key == Key.X)
            {
                foreach (ISpaceCraft craft in _spaceCrafts)
                {
                    craft.ToggleDisplayVectors();
                }
            }

            if (e.Key == Key.OemComma && _timeStepIndex > 0)
            {
                _timeStepIndex--;
            }

            if (e.Key == Key.OemPeriod && _timeStepIndex < _timeSteps.Count - 1)
            {
                _timeStepIndex++;
            }

            if (e.Key == Key.OemCloseBrackets && !_isPaused)
            {
                _targetIndex = GravitationalBodyIterator.Next(_targetIndex, _gravitationalBodies);

                _camera.UpdateTarget(_gravitationalBodies[_targetIndex]);
            }

            if (e.Key == Key.OemOpenBrackets && !_isPaused)
            {
                _targetIndex = GravitationalBodyIterator.Prev(_targetIndex, _gravitationalBodies);

                _camera.UpdateTarget(_gravitationalBodies[_targetIndex]);
            }
        }