Ejemplo n.º 1
0
        public bool Join(Session session, string nickname, PlayerMode mode)
        {
            if (session.WorldID != null)
            {
                return(false);
            }
            session.WorldID  = ID;
            session.Nickname = nickname;
            sessions.Add(session);

            var sessionID = session.ID;

            if (mode == PlayerMode.Player)
            {
                var p = new Player(sessionID, session);
                playerTable[sessionID] = PlayerHolder.FromPlayer(p);
                return(true);
            }
            else if (mode == PlayerMode.Observer)
            {
                var o = new Observer(sessionID, session);
                playerTable[sessionID] = PlayerHolder.FromObserver(o);
                return(true);
            }
            // else...
            return(true);
        }