예제 #1
0
 public void OnPointerEnter(PointerEventData dataName)
 {
     hovering = true;
     if (!active && specialisationId != 4 && (survivor.GetComponent <Survivor> ().scoutState == 0 || survivor.GetComponent <Survivor> ().scoutState == 1))
     {
         Color color = GetComponent <Image> ().color;
         GetComponent <Image> ().color = new Color(color.r, color.g, color.b, 1f);
         transform.Find("Image").GetComponent <Image> ().color = new Color(255f, 255f, 255f, 1f);
     }
     tooltip.ChangeText(specialisation.specialisationName.ToString(), specialisation.specialisationDescription);
 }
예제 #2
0
    void Update()
    {
        if (_active != gameObject.activeSelf)
        {
            if (!_active)
            {
                OnInventoryChanged();
            }

            _active = gameObject.activeSelf;
        }

        // Shift click
        if (Input.GetKey(KeyCode.LeftShift))
        {
            if (Input.GetMouseButton(0))
            {
                if (mouseHovering && item.itemName != "")
                {
                    ShiftClick();
                }
            }
        }

        // Left click
        if (Input.GetMouseButtonDown(0))
        {
            if (mouseHovering)
            {
                if (item.itemName != "" || inventoryUI.GetItemAtMouse() != null)
                {
                    MoveToMouse();
                }
            }
        }

        if (mouseHovering)
        {
            if (item != null)
            {
                if (item.itemName != "")
                {
                    string desc = item.itemDescription;
                    if (item.Amount > 1)
                    {
                        desc += "\nYou have " + item.Amount + " of these.";
                    }
                    tooltip.ChangeText(item.itemName, desc);
                    tooltip.SetPosition(new Vector2(Input.mousePosition.x, Input.mousePosition.y - 100f + tooltip.BodyHeight()));
                }
            }
        }
    }