Exemple #1
0
    void RedrawItemsInHand()
    {
        itemInBothHands = hotbar.GetItemInBothHands();
        itemInLeftHand  = hotbar.GetLeftItem();
        itemInRightHand = hotbar.GetRightItem();

        if (itemInBothHands != null && itemInBothHands.itemSO != null)
        {
            leftItemSr.color  = leftItemSr.color.SetA(0.0f);
            rightItemSr.color = rightItemSr.color.SetA(0.0f);
            bothItemSr.color  = bothItemSr.color.SetA(1.0f);
            bothItemSr.sprite = itemInBothHands.itemSO.sprite;
        }
        else
        {
            bothItemSr.color = bothItemSr.color.SetA(0.0f);

            if (itemInLeftHand.itemSO == null)
            {
                leftItemSr.color = leftItemSr.color.SetA(0.0f);
            }
            else
            {
                leftItemSr.color  = leftItemSr.color.SetA(1.0f);
                leftItemSr.sprite = itemInLeftHand.itemSO.sprite;
            }

            if (itemInRightHand.itemSO == null)
            {
                rightItemSr.color = rightItemSr.color.SetA(0.0f);
            }
            else
            {
                rightItemSr.color  = rightItemSr.color.SetA(1.0f);
                rightItemSr.sprite = itemInRightHand.itemSO.sprite;
            }
        }
    }