Exemplo n.º 1
0
            public Task Handle(PlayerStartingEvent notification, CancellationToken cancellationToken)
            {
                try
                {
                    var playerStats = _gameStats.CurrentPlayerStats;

                    foreach (IGhost ghost in _ghostCollection.Ghosts)
                    {
                        ghost.Reset();
                    }

                    _fruit.HandlePlayerStarted(playerStats, false);

                    _maze.HandlePlayerStarted(playerStats, _mazeCanvases.GetForPlayer(playerStats.PlayerIndex));

                    _pacman.HandlePlayerStarting(playerStats, false);

                    var act = _acts.GetActNamed("PlayerIntroAct");
                    act.Reset();

                    _game.SetAct(act);

                    return(Task.CompletedTask);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    throw;
                }
            }
Exemplo n.º 2
0
        public async Task Handle(CoinInsertedEvent notification, CancellationToken cancellationToken)
        {
            _coinBox.CoinInserted();

            await _gameSoundPlayer.CoinInserted();

            IAct currentAct = _acts.GetActNamed("StartButtonAct");

            _game.SetAct(currentAct);
        }
            public async Task Handle(DemoPlayerStartingEvent notification, CancellationToken cancellationToken)
            {
                var playerStats = _gameStats.CurrentPlayerStats;

                await _gameSoundPlayer.Disable();

                _ghostCollection.Ghosts.ForEach(g => g.Reset());

                _fruit.HandlePlayerStarted(playerStats, true);

                await _maze.HandlePlayerStarted(playerStats,
                                                _mazeCanvases.GetForPlayer(_gameStats.CurrentPlayerStats.PlayerIndex));

                await _pacman.HandlePlayerStarting(playerStats, true);

                var act = _acts.GetActNamed("DemoPlayerIntroAct");
                await act.Reset();

                _game.SetAct(act);
            }
Exemplo n.º 4
0
 public Task <IAct> Handle(GetActRequest request, CancellationToken cancellationToken)
 {
     return(Task.FromResult(_acts.GetActNamed(request.ActName)));
 }