public void UpdatePlayerState(string gameId, string playerId, IPlayerGameStateUpdate state) { IGame game; if (games.TryGetValue(gameId, out game)) { game.UpdatePlayerState(playerId, state); } }
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; } } }