//Client - 유닛 생성 public void CreateUnit(DataPacket packet, int udpId) { Debug.Log(packet.endPoint.ToString() + "유닛 생성"); CreateUnitPacket createUnitPacket = new CreateUnitPacket(packet.msg); CreateUnitData createUnitData = createUnitPacket.GetData(); int index = networkManager.GetUserIndex(packet.endPoint); dungeonManager.CreateUnit(createUnitData.ID, index, new Vector3(createUnitData.PosX, createUnitData.PosY, createUnitData.PosZ)); DataSender.Instance.UdpAnswer(packet.endPoint, udpId); }
//Client - 유닛 생성 public void CreateUnit(DataPacket packet, int udpId) { Debug.Log(packet.endPoint.ToString() + "유닛 생성"); CreateUnitPacket createUnitPacket = new CreateUnitPacket(packet.msg); CreateUnitData createUnitData = createUnitPacket.GetData(); Debug.Log("유닛 생성 아이디 : " + createUnitData.ID); DungeonManager.Instance.CreateUnit(createUnitData); DataSender.Instance.UdpAnswer(packet.endPoint, udpId); }
//캐릭터의 생성 -> 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]++; }
//캐릭터의 생성 -> 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]++; }