Esempio n. 1
0
    public void EquipDraggedItem()
    {
        var settings = applicationSettings.GetRucksackItemSettings(DraggedItem.SettingsId);

        int slotIndex = 0;

        for (int i = 0; i < dataModel.RucksackData.Length; i++)
        {
            if (dataModel.RucksackData[i].ItemType == settings.ItemType)
            {
                slotIndex = i;
            }
        }

        var data = dataModel.RucksackData[slotIndex];

        if (data.ItemId != Constants.UnEquippedItemId)
        {
            UnEquip(data.ItemId);
        }

        dataModel.SetItem(settings.ItemType, DraggedItem.InstanceId);
        data.ItemId = DraggedItem.InstanceId;
        DraggedItem.SetEquipped(true);

        DraggedItem.transform.localPosition = Vector3.zero;
        DraggedItem.transform.localRotation = Quaternion.identity;

        DraggedItem = null;
    }