Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 /// <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; }
 }