Пример #1
0
        public void BroadcastEquip(Pickupable pickupable, GameObject owner, string slot)
        {
            string ownerGuid = GuidHelper.GetGuid(owner);
            string itemGuid  = GuidHelper.GetGuid(pickupable.gameObject);
            // save current parent to prevent infinite oxygen when tank equipped above water #290
            Transform parent = pickupable.gameObject.transform.parent;

            // set pickupable parent to null to prevent deserialized function throwing errors when packet get to other players
            pickupable.gameObject.transform.SetParent(null);
            byte[] bytes = SerializationHelper.GetBytes(pickupable.gameObject);

            if (pickupable.GetTechType() == TechType.VehicleStorageModule)
            {
                List <InteractiveChildObjectIdentifier> childIdentifiers = VehicleChildObjectIdentifierHelper.ExtractGuidsOfInteractiveChildren(owner);
                VehicleChildUpdate vehicleChildInteractiveData           = new VehicleChildUpdate(ownerGuid, childIdentifiers);
                packetSender.Send(vehicleChildInteractiveData);
            }

            EquippedItemData equippedItem = new EquippedItemData(ownerGuid, itemGuid, bytes, slot);

            Player           player            = owner.GetComponent <Player>();
            bool             isPlayerEquipment = (player != null);
            EquipmentAddItem equipPacket       = new EquipmentAddItem(equippedItem, isPlayerEquipment);

            packetSender.Send(equipPacket);
            // re-assign parent to prevent infinite oxygen #290
            pickupable.gameObject.transform.SetParent(parent);
        }
Пример #2
0
        public void BroadcastEquip(Pickupable pickupable, GameObject owner, string slot)
        {
            string ownerGuid = GuidHelper.GetGuid(owner);
            string itemGuid  = GuidHelper.GetGuid(pickupable.gameObject);

            pickupable.gameObject.transform.SetParent(null); // On Deserialized Function Try to find non-existent Parent set null to prevent that bug
            byte[] bytes = SerializationHelper.GetBytes(pickupable.gameObject);

            if (pickupable.GetTechType() == TechType.VehicleStorageModule)
            {
                List <InteractiveChildObjectIdentifier> childIdentifiers = VehicleChildObjectIdentifierHelper.ExtractGuidsOfInteractiveChildren(owner);
                VehicleChildUpdate vehicleChildInteractiveData           = new VehicleChildUpdate(ownerGuid, childIdentifiers);
                packetSender.Send(vehicleChildInteractiveData);
            }



            EquippedItemData equippedItem = new EquippedItemData(ownerGuid, itemGuid, bytes, slot);

            Player           player            = owner.GetComponent <Player>();
            bool             isPlayerEquipment = (player != null);
            EquipmentAddItem equipPacket       = new EquipmentAddItem(equippedItem, isPlayerEquipment);

            packetSender.Send(equipPacket);
        }
Пример #3
0
        public void Equip(Pickupable pickupable, GameObject owner, string slot)
        {
            string  ownerGuid = GuidHelper.GetGuid(owner);
            Vector3 ownerPos  = owner.transform.position;

            byte[] bytes = SerializationHelper.GetBytes(pickupable.gameObject);

            EquipmentAddItem equip = new EquipmentAddItem(ownerGuid, slot, bytes, ownerPos);

            packetSender.Send(equip);
        }
Пример #4
0
        public void BroadcastEquip(Pickupable pickupable, GameObject owner, string slot)
        {
            string ownerGuid = GuidHelper.GetGuid(owner);
            string itemGuid  = GuidHelper.GetGuid(pickupable.gameObject);

            byte[] bytes = SerializationHelper.GetBytes(pickupable.gameObject);

            EquippedItemData equippedItem = new EquippedItemData(ownerGuid, itemGuid, bytes, slot);
            EquipmentAddItem equipPacket  = new EquipmentAddItem(equippedItem);

            packetSender.Send(equipPacket);
        }
Пример #5
0
        public void BroadcastEquip(Pickupable pickupable, GameObject owner, string slot)
        {
            string ownerGuid = GuidHelper.GetGuid(owner);
            string itemGuid  = GuidHelper.GetGuid(pickupable.gameObject);

            byte[] bytes = SerializationHelper.GetBytes(pickupable.gameObject);

            EquippedItemData equippedItem = new EquippedItemData(ownerGuid, itemGuid, bytes, slot);

            Player           player            = owner.GetComponent <Player>();
            bool             isPlayerEquipment = (player != null);
            EquipmentAddItem equipPacket       = new EquipmentAddItem(equippedItem, isPlayerEquipment);

            packetSender.Send(equipPacket);
        }