/// <summary>
    /// Sets the item to the slot and sends network messages to update character sprites and the player's UI
    /// </summary>
    public static void EquipInInvSlot(InventorySlot inventorySlot, GameObject item)
    {
        if (inventorySlot.IsUISlot)
        {
            UpdateSlotMessage.Send(inventorySlot.Owner, item, false, inventorySlot.equipSlot);

            if (IsEquipSpriteSlot(inventorySlot.equipSlot))
            {
                var att       = item.GetComponent <ItemAttributes>();
                var reference = att.clothingReference;
                {
                    if (inventorySlot.equipSlot == EquipSlot.leftHand)
                    {
                        reference = att.NetworkInHandRefLeft();
                    }
                    else if (inventorySlot.equipSlot == EquipSlot.rightHand)
                    {
                        reference = att.NetworkInHandRefRight();
                    }
                }
                if (att.spriteType == SpriteType.Clothing || att.hierarchy.Contains("headset") ||
                    att.hierarchy.Contains("storage/backpack") || att.hierarchy.Contains("storage/bag") ||
                    att.hierarchy.Contains("storage/belt") || att.hierarchy.Contains("tank") || inventorySlot.equipSlot == EquipSlot.handcuffs ||
                    inventorySlot.equipSlot == EquipSlot.leftHand || inventorySlot.equipSlot == EquipSlot.rightHand)
                {
                    EquipmentSpritesMessage.SendToAll(inventorySlot.Owner, (int)inventorySlot.equipSlot, reference);
                }
            }
        }
        inventorySlot.Item = item;
    }
Beispiel #2
0
 public void NotifyPlayer(GameObject recipient)
 {
     for (int i = 0; i < clothingSlots.Length; i++)
     {
         var clothItem = clothingSlots[i];
         EquipmentSpritesMessage.SendTo(gameObject, i, recipient, clothItem.GameObjectReference, true, false);
     }
 }
    /// <summary>
    /// Sets the item to the slot and sends network messages to update character sprites and the player's UI
    /// </summary>
    public static void EquipInInvSlot(InventorySlot inventorySlot, GameObject item, bool isInit = false)
    {
        if (inventorySlot.IsUISlot)
        {
            UpdateSlotMessage.Send(inventorySlot.Owner, item, false, inventorySlot.equipSlot);

            if (IsEquipSpriteSlot(inventorySlot.equipSlot))
            {
                EquipmentSpritesMessage.SendToAll(inventorySlot.Owner, (int)inventorySlot.equipSlot, item, isInit);
            }
        }
        inventorySlot.Item = item;
    }
    /// <summary>
    /// Clears the slot and sends network messages to update character sprites and the player's UI
    /// </summary>
    public static void ClearInvSlot(InventorySlot inventorySlot)
    {
        if (inventorySlot.IsUISlot)
        {
            UpdateSlotMessage.Send(inventorySlot.Owner, inventorySlot.Item, true, inventorySlot.equipSlot);

            if (IsEquipSpriteSlot(inventorySlot.equipSlot))
            {
                EquipmentSpritesMessage.SendToAll(inventorySlot.Owner, (int)inventorySlot.equipSlot, null);
            }
        }
        inventorySlot.Item = null;
    }
 public void NotifyPlayer(GameObject recipient, bool clothItems = false)
 {
     if (!clothItems)
     {
         PlayerCustomisationMessage.SendTo(gameObject, recipient, ThisCharacter);
     }
     else
     {
         for (int i = 0; i < characterSprites.Length; i++)
         {
             var clothItem = characterSprites[i];
             EquipmentSpritesMessage.SendTo(gameObject, i, recipient, clothItem.GameObjectReference, true, true);
         }
     }
 }
Beispiel #6
0
 public void SetReference(int index, GameObject _Item)
 {
     EquipmentSpritesMessage.SendToAll(gameObject, index, _Item);
 }
Beispiel #7
0
 public void SetReference(int index, int reference)
 {
     EquipmentSpritesMessage.SendToAll(gameObject, index, reference);
 }
Beispiel #8
0
 public void ServerPerformInteraction(HandActivate interaction)
 {
     ToggleState(interaction.Performer.WorldPosServer());
     EquipmentSpritesMessage.SendToAll(interaction.Performer, (int)interaction.HandSlot.equipSlot, gameObject);
 }