Exemple #1
0
    // (Button callback) Rotate clothes on the given slot by offset
    public static void Scroll(ClothingItem.ClothingSlot slot, int offset)
    {
        Assert.IsNotNull(_instance._characterCustomized);
        ClothingSlotContainer clothingSlotContainer = _clothingContainersBySlot[slot];

        clothingSlotContainer.currentIndex += offset;
        clothingSlotContainer.currentIndex %= clothingSlotContainer.ClothingItems.Length;
        if (clothingSlotContainer.currentIndex < 0)
        {
            clothingSlotContainer.currentIndex = clothingSlotContainer.ClothingItems.Length + clothingSlotContainer.currentIndex;
        }
        _instance._characterCustomized.SetClothingItem(slot, clothingSlotContainer.ClothingItems[clothingSlotContainer.currentIndex]);
    }
Exemple #2
0
    /// <summary>
    /// Set the clothing item on the given slot.
    /// </summary>
    /// <param name="slot">The clothing slot</param>
    /// <param name="clothingItem">The ClothingItem that will be switched to</param>
    public void SetClothingItem(ClothingItem.ClothingSlot slot, ClothingItem clothingItem)
    {
        if (_clothingItems.ContainsKey(slot))
        {
            // Delete the old clothing item on this slot
            ClothingItem currentIten = _clothingItems[slot];
            Destroy(currentIten.gameObject);
        }

        // Create the new clothing item
        ClothingItem newItem = Instantiate(clothingItem, transform.position, transform.rotation);

        newItem.SetTargetArmature(_armature);
        _clothingItems[slot] = newItem;
    }