//캐릭터 움직임(공격, 점프, 스킬 등등) -> Client public void CharacterStateSend(int state, int unitIndex) { UnitStateData unitStateData = new UnitStateData((byte)UnitType.Hero, state, (byte)unitIndex); UnitStatePacket unitStatePacket = new UnitStatePacket(unitStateData); unitStatePacket.SetPacketId((int)P2PPacketId.UnitState); for (int index = 0; index < NetworkManager.Instance.UserIndex.Count; index++) { if (NetworkManager.Instance.MyIndex != index) { byte[] msg = CreateUdpPacket(unitStatePacket, udpId[index]); DataPacket packet = new DataPacket(msg, NetworkManager.Instance.UserIndex[index].EndPoint); sendMsgs.Enqueue(packet); } } }
//몬스터 움직임(공격, 점프, 스킬 등등) -> Client public void MonsterStateSend(int state, int unitIndex) { UnitStateData unitStateData = new UnitStateData((byte)UnitType.Monster, state, (byte)unitIndex); UnitStatePacket unitStatePacket = new UnitStatePacket(unitStateData); unitStatePacket.SetPacketId((int)P2PPacketId.UnitState); byte[] msg = CreatePacket(unitStatePacket); Debug.Log("몬스터 상태 보냄"); for (int index = 0; index < networkManager.UserIndex.Count; index++) { int userIndex = networkManager.UserIndex[index].UserNum; if (networkManager.MyIndex != userIndex) { DataPacket packet = new DataPacket(CreateUdpPacket(unitStatePacket, udpId[userIndex]), networkManager.UserIndex[index].EndPoint); sendMsgs.Enqueue(packet); } } }