private void StartLocalGame()
        {
            var levelAssetLocalName = _levelNames[_currentLevelIndex];

            var parameters = new GameSessionStartParameters
            {
                MatchesToWin   = 5,
                MatchTime      = _matchTimeSeconds,
                SessionName    = "Local Session",
                LevelAssetPath = GetFilePathFromLevelName(levelAssetLocalName),
                ProvidePlayerFigureController = ProvideFigureController
            };
            var gameSession = new GameSessionImp(parameters);

            for (var i = 0; i < _playerCount; i++)
            {
                gameSession.AddMember(MemberType.ActivePlayer);
            }
            for (var i = 0; i < _comPlayerCount; i++)
            {
                gameSession.AddMember(MemberType.Computer);
            }

            gameSession.StartMatch();
            _stateChangeInformation = StateChangeInformation.StateChange(typeof(WaitState), typeof(SlideTransition), gameSession);
        }
Exemplo n.º 2
0
        public void JoinClient(GameClient client)
        {
            if (!IsActive)
            {
                throw new InvalidOperationException("Session must be started to join clients");
            }

            lock (_sessionAccessLockObject)
            {
                _clients.Add(client);
                _gameSession.AddMember(MemberType.ActivePlayer, client.Name);
            }
        }