示例#1
0
        public GameRoom Find(int roomId)
        {
            GameRoom room = null;

            if (_rooms.TryGetValue(roomId, out room))
            {
                return(room);
            }

            return(null);
        }
示例#2
0
        public GameRoom Add(int mapId)
        {
            GameRoom gameRoom = new GameRoom();

            gameRoom.Push(gameRoom.Init, mapId, 10);
            gameRoom.RoomId = _roomId;
            _rooms.Add(_roomId, gameRoom);
            _roomId++;

            return(gameRoom);
        }
示例#3
0
        public GameRoom Add(GameRoom gameRoom)
        {
            lock (_lock)
            {
                gameRoom.RoomId = _roomId;
                gameRoom.MData  = new Google.Protobuf.Protocol.MapSaveData();
                _rooms.Add(_roomId, gameRoom);
                _roomId++;
            }

            return(gameRoom);
        }
        public GameRoom Add(int mapid)
        {
            GameRoom gameRoom = new GameRoom();

            gameRoom.Push(gameRoom.init, mapid);

            lock (_lock)
            {
                gameRoom.RoomID = _roomId;
                _rooms.Add(_roomId, gameRoom);
                _roomId++;
            }

            return(gameRoom);
        }
示例#5
0
        public GameRoom Add(int mapId)
        {
            GameRoom gameRoom = new GameRoom();

            gameRoom.Init(mapId);

            // 동일한 roomId가 생성되지 않게 하기위해 lock
            lock (_lock)
            {
                gameRoom.RoomId = _roomId;
                _rooms.Add(_roomId, gameRoom);
                _roomId++;
            }

            return(gameRoom);
        }
示例#6
0
        public virtual void OnDead(GameObject attacker)
        {
            if (Room == null)
            {
                return;
            }

            S_Die diePacket = new S_Die();

            diePacket.ObjectId   = Id;
            diePacket.AttackerId = attacker.Id;
            Room.Broadcast(CellPos, diePacket);

            GameRoom room = Room;

            room.LeaveGame(Id);

            Stat.Hp         = Stat.MaxHp;
            PosInfo.State   = CreatureState.Idle;
            PosInfo.MoveDir = MoveDir.Down;

            room.EnterGame(this, randomPos: true);
        }