示例#1
0
    void Update()
    {
        // TODO: *************** DEBUG ONLY * Please Remove On Build ***********************
        // if (Input.GetKeyDown(KeyCode.I))
        // {
        //  for (int i = 0; i < ItemManager.GetItemLibCount(); i++)
        //  {
        //      AddItem(i);
        //  }
        // }
        // *********************************************************************************

        RaycastHit hit       = new RaycastHit();
        Ray        ray       = Camera.main.ScreenPointToRay(Input.mousePosition);
        int        layerMask = 1 << inventoryLayer;

        // OnMouseDown
        if (Input.GetMouseButtonDown(0))
        {
            if (Physics.Raycast(ray, out hit, 300f, layerMask))
            {
                if (hit.transform.gameObject == gameObject && Type == InventoryType.OtherInventory && !TopMenu.isOpen)
                {
                    InventoryPanelManager.CurrentOtherInventory = this;
                    TopMenu topMenuScript = GameObject.Find("TopMenu").GetComponent <TopMenu>();
                    topMenuScript.Inventory(true);
                    OnEnableInventory();
                }
            }
        }
    }