Ejemplo n.º 1
0
        public bool Tick(float dt)
        {
            if (_needToExit)
            {
                return(true);
            }

            if (_simulationFinished || _paused)
            {
                return(false);
            }

            var(simulations, blendingFactor) = _timer.Tick(dt);

            for (var i = 0; i < simulations; i++)
            {
                var leftKeys  = _lInputSrc?.GetKeys() ?? _aiInputSrc.GetLeft(_state);
                var rightKeys = _rInoutSrc?.GetKeys() ?? _aiInputSrc.GetRight(_state);

                _previousState      = _state;
                _simulationFinished = _model.Tick(ref _state, leftKeys, rightKeys);

                if (_simulationFinished)
                {
                    break;
                }
            }

            _view.UpdateState(_previousState, _state, blendingFactor);

            if (_simulationFinished)
            {
                _ui.ShowResultDialog(_state.Scores);
            }

            return(false);
        }