Example #1
0
        public void UpdatePlayerState(string gameId, string playerId, IPlayerGameStateUpdate state)
        {
            IGame game;

            if (games.TryGetValue(gameId, out game))
            {
                game.UpdatePlayerState(playerId, state);
            }
        }
Example #2
0
        public void UpdatePlayerState(string playerId, IPlayerGameStateUpdate state)
        {
            TronPlayer player = (TronPlayer)this.players.FirstOrDefault(item => item.ID == playerId);

            if (player != null)
            {
                if (this.ValidateDirection(player.CurrentDirection, ((TronPlayerStateUpdate)state).Direction))
                {
                    player.CurrentDirection = ((TronPlayerStateUpdate)state).Direction;
                }
            }
        }