Exemple #1
0
        public async Task Initialize(InitialGameData data)
        {
            await _game.Initialize(data);

            var gameStarted = new GameStartedServer(this.AsReference <IGameGrain>());
            await _game.NotifyEverybodyExcept(data.InitiatorId, gameStarted);

            await WriteStateAsync();

            _logger.Information(
                "Game initialized. Map size is {MapWidth}x{MapHeight}. There are {PlayerCount} players.",
                data.Map.Width,
                data.Map.Height,
                data.Players.Count);
            ScheduleTimer();
        }
Exemple #2
0
        public void GameStartedServerProcess()
        {
            MainController mainController = InitMainController();
            GameController gameController = mainController.GetGameControllerByName(GAME_NAME);

            GameArea.GameObjects.Player gameAreaPlayer = GetPlayer();
            IMessage <IGMController>    message        = new GameStartedServer(GAME_ID, PLAYER_ID);

            Assert.AreNotEqual(GameState.InProgress, gameController.State);

            // action
            message.Process(gameController);

            // assert
            Assert.AreEqual(GameState.InProgress, gameController.State);
        }
Exemple #3
0
 public Task Handle(GameStartedServer @event)
 {
     return(_player.Handle(@event));
 }