Exemplo n.º 1
0
    private bool CheckAltClick()
    {
        if (UnityEngine.Input.GetKey(KeyCode.LeftAlt) || UnityEngine.Input.GetKey(KeyCode.RightAlt))
        {
            //Check for items on the clicked possition, and display them in the Item List Tab, if they're in reach
            Vector3 position = Camera.main.ScreenToWorldPoint(UnityEngine.Input.mousePosition);
            position.z = 0f;
            if (PlayerManager.LocalPlayerScript.IsInReach(position))
            {
                List <GameObject> objects = UITileList.GetItemsAtPosition(position);
                LayerTile         tile    = UITileList.GetTileAtPosition(position);
                ControlTabs.ShowItemListTab(objects, tile, position);
            }

            UIManager.SetToolTip = $"clicked position: {Vector3Int.RoundToInt(position)}";
            return(true);
        }
        return(false);
    }
Exemplo n.º 2
0
        private void CheckAltClick()
        {
            Event e = Event.current;

            if (e.type != EventType.Used && e.button == 0 && (UnityEngine.Input.GetKey(KeyCode.LeftAlt) || UnityEngine.Input.GetKey(KeyCode.RightAlt)))
            {
                //Check for items on the clicked possition, and display them in the Item List Tab, if they're in reach
                Vector3 position = Camera.main.ScreenToWorldPoint(UnityEngine.Input.mousePosition);
                position.z = 0f;
                if (PlayerManager.LocalPlayerScript.IsInReach(position))
                {
                    List <GameObject> objects = UITileList.GetItemsAtPosition(position);
                    LayerTile         tile    = UITileList.GetTileAtPosition(position);
                    ControlTabs.ShowItemListTab(objects, tile, position);
                }

                UIManager.SetToolTip = $"clicked position: {Vector3Int.RoundToInt(position)}";
                e.Use();
            }
        }
Exemplo n.º 3
0
    private List <GameObject> GetRightClickableObjects(Vector3 mousePosition)
    {
        if (lightingSystem.enabled && !lightingSystem.IsScreenPointVisible(mousePosition))
        {
            return(null);
        }

        var position = Camera.main.ScreenToWorldPoint(mousePosition);

        position.z = 0f;
        var objects = UITileList.GetItemsAtPosition(position);

        //special case, remove wallmounts that are transparent
        objects.RemoveAll(IsHiddenWallmount);

        //Objects that are under a floor tile should not be available
        objects.RemoveAll(IsUnderFloorTile);

        return(objects);
    }