Exemple #1
0
        public bool ProcessMoves()
        {
            var lastFrameNum = GameState.LastFrame;
            var thisFrameNum = GameState.GetFrame();

            if (thisFrameNum == lastFrameNum)
            {
                return(false);
            }

            AIProcess(thisFrameNum);

            if (thisFrameNum != lastFrameNum + 1 && thisFrameNum > lastFrameNum)
            {
                _log?.Invoke(null, new Logging.LogEventArgs($"Lost frames between { lastFrameNum } and { thisFrameNum }"));
            }

            Prev = State;
            if (MQueue.HasFrame(thisFrameNum))
            {
                State = MQueue.Get(thisFrameNum);
                var rem = MQueue.Remove(thisFrameNum);
                LogFrameState(thisFrameNum, State, rem);
            }
            else
            {
                State = new ControllerState(thisFrameNum);
            }
            return(true);
        }