Ejemplo n.º 1
0
    public void OnHotBarItemPressed(int index)
    {
        if (selectedItem != null && isInventoryOpen == true)
        {
            if (((index == 0 || index == 1) && selectedItem.type == ItemDetails.ItemType.Shoot) || ((index == 2 || index == 3) && selectedItem.type == ItemDetails.ItemType.Build))
            {
                PutItemIntoHotbar(index, hotbarParent.GetChild(index).transform);

                DeselectInventoryItem();
            }
        }
        if (!isInventoryOpen)
        {
            if (index != hbSelectedIndex & hotbarItems[index] != null)
            {
                hotbarParent.GetChild(hbSelectedIndex).transform.GetChild(1).GetComponent <Image>().color = new Color(0f, 0f, 0f, 0f);
                hotbarParent.GetChild(index).transform.GetChild(1).GetComponent <Image>().color           = new Color(0f, 0f, 0f, 1f);
                hbSelectedIndex    = index;
                hotbarSelectedItem = hotbarItems[index];
                if (hotbarSelectedItem.type == ItemDetails.ItemType.Shoot)
                {
                    igui.ShootMode();
                }
                else if (hotbarSelectedItem.id == 14)
                {
                    igui.BuildWall();
                }
                else
                {
                    igui.BuildTurret();
                }
            }
        }
    }