コード例 #1
0
        public void DisconnectPlayer(CPlayer player)
        {
            if (PlayerState[player] != EPlayerState.CLOSED)
            {
                // TODO: send the dced spawn in the visible area around the player.
                // TODO: proceed removind the player of all the game state: mob grid, spawned mobs, etc.

                PlayerState[player] = EPlayerState.CLOSED;

                MyLog.Write($"The player {player.Index} was disconnected from the server.", ELogType.GAME_EVENT);
            }
        }
コード例 #2
0
        public bool TryInsertPlayer(CPlayer player)
        {
            short validIndex = 1;

            for (; validIndex < NetworkBasics.MAX_PLAYER; validIndex++)
            {
                if (PlayerState[validIndex] == EPlayerState.CLOSED)
                {
                    break;
                }
            }

            if (validIndex >= NetworkBasics.MAX_PLAYER)
            {
                return(false);
            }

            player.Index = validIndex;

            PlayerState[player.Index] = EPlayerState.UNITIALIZED;

            return(true);
        }
コード例 #3
0
ファイル: CPlayerState.cs プロジェクト: requeijaum/ToK-Server
 /// <summary>
 /// Gets or sets the player state.
 /// Exceptions:
 ///     Exception when accessing this with a invalid player index.
 /// </summary>
 public EPlayerState this[CPlayer player]
 {
     get { return(this[player.Index]); }
     set { this[player.Index] = value; }
 }