public GameViewInfo GetGameView(int playerId) { lock (_liveLock) { var gv = new GameViewInfo(); gv.GameUid = GameUid; if (playerId > 0) { int p = FindPlayer(playerId); if (!_playerStates[p].IsActive || _playerStates[p].TurnCompleted >= _gameTurnStarted) { throw new WaitException(); } gv.PlayerIndex = p; } gv.GameState = State; gv.Turn = _gameTurnStarted; gv.PlayerStates = _playerStates.Select(s => new PlayerStateInfo(s)).ToArray(); gv.Map = (MapData)_map.Clone(); gv.PreviousTecmanPosition = _lastTecmanPosition; gv.PreviousGhostPosition = (Point[])_lastGhostPosition.Clone(); return(gv); } }
public GameViewInfo GetGameView(int playerId) { lock (_liveLock) { var gv = new GameViewInfo(); if (playerId > 0) { int p = findPlayer(playerId); if (!_pstates[p].IsActive || _pstates[p].TurnCompleted >= _gameTurnStarted) { throw new WaitException(); } gv.PlayerIndex = p; } gv.GameState = State; gv.Turn = _gameTurnStarted; gv.PlayerStates = _pstates.Select(s => new PlayerStateInfo(s)).ToArray(); gv.Map = (MapData)_map.Clone(); return(gv); } }