Exemplo n.º 1
0
        public static ValueTask Update(CanvasTimingInformation info, IHumanInterfaceParser input)
        {
            TotalTime = info.TotalTime;

            if (info.TotalTime - _lastTimeKeyboardChecked > .25f.Seconds())
            {
                _lastTimeKeyboardChecked = info.TotalTime;

                if (input.IsKeyCurrentlyDown(Keys.D))
                {
                    ShouldShow = !ShouldShow;
                }
            }

            if (input.WasKeyPressedAndReleased(Keys.A))
            {
                Constants.FramesPerSecond -= 5;
                Constants.FramesPerSecond  = Math.Max(5, Constants.FramesPerSecond);
            }

            if (input.WasKeyPressedAndReleased(Keys.S))
            {
                Constants.FramesPerSecond += 5;
            }

            return(default);
Exemplo n.º 2
0
        public async ValueTask <ActUpdateResult> Update(CanvasTimingInformation timing)
        {
            if (_input.WasKeyPressedAndReleased(Keys.One))
            {
                await _mediator.Publish(new NewGameEvent(1));

                return(ActUpdateResult.Finished);
            }

            if (_input.WasKeyPressedAndReleased(Keys.Two) && _coinBox.Credits >= 2)
            {
                await _mediator.Publish(new NewGameEvent(2));

                return(ActUpdateResult.Finished);
            }

            if (_input.WasKeyPressedAndReleased(Keys.Five))
            {
                await _mediator.Publish(new CoinInsertedEvent());
            }

            return(ActUpdateResult.Running);
        }
Exemplo n.º 3
0
        async ValueTask checkCheatKeys()
        {
            if (Cheats.AllowDebugKeys && _input.IsKeyCurrentlyDown(Keys.Three))
            {
                // ReSharper disable once HeapView.BoxingAllocation
                _currentAct = await _mediator.Send(new GetActRequest("LevelFinishedAct"));
            }
            if (Cheats.AllowDebugKeys && _input.IsKeyCurrentlyDown(Keys.Four))
            {
                await _mediator.Publish(new PacManEatenEvent());
            }

            if (Cheats.AllowDebugKeys && _input.WasKeyPressedAndReleased(Keys.Six))
            {
                await _mediator.Publish(new AllPillsEatenEvent());
            }
        }
Exemplo n.º 4
0
        public async ValueTask <ActUpdateResult> Update(CanvasTimingInformation timing)
        {
            if (_input.WasKeyPressedAndReleased(Keys.Five))
            {
                await _mediator.Publish(new CoinInsertedEvent());

                return(ActUpdateResult.Finished);
            }

            _gameStats.Update(timing);

            await _maze.Update(timing);

            await _pacman.Update(timing);

            await _fruit.Update(timing);

            await _ghostCollection.Update(timing);

            return(ActUpdateResult.Running);
        }