Ejemplo n.º 1
0
    // Raycast version of OnMouseOver
    private void MouseOverItem()
    {
        Collider2D collider = Physics2D.OverlapPoint(Camera.main.ScreenToWorldPoint(Input.mousePosition), 1 << LayerMask.NameToLayer("Items"));

        if (collider == null)
        {
            if (selectedItem != null)
            {
                selectedItem.MouseExit();
                selectedItem = null;
            }

            return;
        }

        selectedItem = collider.GetComponent <AbstractItem>();
        selectedItem.MouseOver();
    }