Exemplo n.º 1
0
    void Start()
    {
        if (instance != null)
        {
            Destroy(this);
        }
        else
        {
            instance = this;
        }

        placablesLayout = placables.GetComponent <LayoutElement> ();
        utilityLayout   = utility.GetComponent <LayoutElement> ();
        placablesRect   = placables.GetComponent <RectTransform> ();
        utilityRect     = utility.GetComponent <RectTransform> ();

        if (utilityRect.sizeDelta.x > placablesRect.sizeDelta.x)
        {
            minWidth = placablesRect.sizeDelta.x;
            maxWidth = utilityRect.sizeDelta.x;

            minHeightPref = placablesLayout.preferredHeight;
            maxHeightPref = utilityLayout.preferredHeight;
        }
        else
        {
            minWidth = utilityRect.sizeDelta.x;
            maxWidth = placablesRect.sizeDelta.x;

            minHeightPref = utilityLayout.preferredHeight;
            maxHeightPref = placablesLayout.preferredHeight;
        }

        UpdateGraphics();
    }
Exemplo n.º 2
0
    void OnTriggerEnter(Collider other)
    {
        Player p = other.GetComponent <Player> ();

        if (p != null)
        {
            ActiveItemHotbarHandler.AddItem(item);
            //p.inventory.AddItem (item, itemQuantity);
            Destroy(gameObject);
        }
    }
Exemplo n.º 3
0
 public void ChangeHotbar()
 {
     ActiveItemHotbarHandler.SwitchActiveHotbar();
 }
Exemplo n.º 4
0
 public void HotbarNavigationRight()
 {
     ActiveItemHotbarHandler.MoveSelector(true);
 }
Exemplo n.º 5
0
 public void HotbarNavigationLeft()
 {
     ActiveItemHotbarHandler.MoveSelector(false);
 }
Exemplo n.º 6
0
 public void CheckItemUsage()
 {
     ActiveItemHotbarHandler.UseItem();
 }