Exemplo n.º 1
0
    //캐릭터의 생성 -> Client
    public void CreateUnitSend(EndPoint endPoint, short characterId, float posX, float posY, float posZ)
    {
        Debug.Log(endPoint.ToString() + "캐릭터 생성 보냄");

        CreateUnitData   createUnitData       = new CreateUnitData(characterId, posX, posY, posZ);
        CreateUnitPacket createUnitDataPacket = new CreateUnitPacket(createUnitData);

        createUnitDataPacket.SetPacketId((int)P2PPacketId.CreateUnit);

        int index = networkManager.GetUserIndex(endPoint);

        DataPacket packet = new DataPacket(CreateUdpPacket(createUnitDataPacket, udpId[index]), endPoint);

        sendMsgs.Enqueue(packet);

        SendData sendData = new SendData(udpId[index], endPoint, packet.msg);

        networkManager.ReSendManager.AddReSendData(sendData, index);
        udpId[index]++;
    }
Exemplo n.º 2
0
    //캐릭터의 생성 -> Client
    public void CreateUnitSend(EndPoint endPoint, byte unitType, short characterId, byte unitIndex, float posX, float posY, float posZ)
    {
        Debug.Log(endPoint.ToString() + "캐릭터 생성 보냄 아이디 " + characterId);

        CreateUnitData   createUnitData       = new CreateUnitData(unitType, characterId, unitIndex, posX, posY, posZ);
        CreateUnitPacket createUnitDataPacket = new CreateUnitPacket(createUnitData);

        createUnitDataPacket.SetPacketId((int)P2PPacketId.CreateUnit);

        int index = NetworkManager.Instance.GetUserIndex(endPoint);

        DataPacket packet = new DataPacket(CreateUdpPacket(createUnitDataPacket, udpId[index]), endPoint);

        sendMsgs.Enqueue(packet);

        SendData sendData = new SendData(udpId[index], endPoint, packet.msg);

        NetworkManager.Instance.ReSendManager.AddReSendData(sendData, index);
        ReSendManager.Instance.characterCreating = true;
        udpId[index]++;
    }