Exemplo n.º 1
0
    private bool CheckAltClick()
    {
        if (KeyboardInputManager.IsAltPressed())
        {
            //Check for items on the clicked position, and display them in the Item List Tab, if they're in reach
            //and not FOV occluded
            Vector3 position = MouseWorldPosition;
            position.z = 0f;
            if (!lightingSystem.enabled || lightingSystem.IsScreenPointVisible(CommonInput.mousePosition))
            {
                if (PlayerManager.LocalPlayerScript.IsInReach(position, false))
                {
                    List <GameObject> objects = UITileList.GetItemsAtPosition(position);
                    //remove hidden wallmounts
                    objects.RemoveAll(obj =>
                                      obj.GetComponent <WallmountBehavior>() != null &&
                                      obj.GetComponent <WallmountBehavior>().IsHiddenFromLocalPlayer());
                    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
        public override void CheckMouseInput()
        {
            if (EventSystem.current.IsPointerOverGameObject())
            {
                //don't do any game world interactions if we are over the UI
                return;
            }

            if (UIManager.IsMouseInteractionDisabled)
            {
                //still allow tooltips
                CheckHover();
                return;
            }

            if (CommonInput.GetMouseButtonDown(0))
            {
                if (KeyboardInputManager.IsControlPressed() && KeyboardInputManager.IsShiftPressed())
                {
                    CheckForInteractions(AiActivate.ClickTypes.CtrlShiftClick);
                    return;
                }

                //check ctrl+click for dragging
                if (KeyboardInputManager.IsControlPressed())
                {
                    CheckForInteractions(AiActivate.ClickTypes.CtrlClick);
                    return;
                }

                if (KeyboardInputManager.IsShiftPressed())
                {
                    //like above, send shift-click request, then do nothing else.
                    //Inspect();
                    CheckForInteractions(AiActivate.ClickTypes.ShiftClick);
                    return;
                }

                if (KeyboardInputManager.IsAltPressed())
                {
                    CheckForInteractions(AiActivate.ClickTypes.AltClick);
                    return;
                }

                CheckForInteractions(AiActivate.ClickTypes.NormalClick);
            }
            else
            {
                CheckHover();
            }
        }
Exemplo n.º 3
0
    public override void CheckMouseInput()
    {
        if (EventSystem.current.IsPointerOverGameObject())
        {
            //don't do any game world interactions if we are over the UI
            return;
        }

        if (UIManager.IsMouseInteractionDisabled)
        {
            //still allow tooltips
            CheckHover();
            return;
        }

        if (CommonInput.GetMouseButtonDown(0))
        {
            if (ClicksFromBlobHud())
            {
                return;
            }

            //check ctrl+click for dragging
            if (KeyboardInputManager.IsControlPressed())
            {
                //Place strong blob / reflective if strong blob already
                blobPlayer.CmdTryPlaceStrongReflective(Camera.main.ScreenToWorldPoint(CommonInput.mousePosition).RoundToInt());
                return;
            }

            if (KeyboardInputManager.IsShiftPressed())
            {
                //like above, send shift-click request, then do nothing else.
                Inspect();
                return;
            }

            if (KeyboardInputManager.IsAltPressed())
            {
                //Remove blob
                blobPlayer.CmdRemoveBlob(Camera.main.ScreenToWorldPoint(CommonInput.mousePosition).RoundToInt());
                return;
            }

            blobPlayer.CmdTryPlaceBlobOrAttack(Camera.main.ScreenToWorldPoint(CommonInput.mousePosition).RoundToInt());
        }
        else
        {
            CheckHover();
        }
    }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a HandApply interaction performed by the local player targeting the specified object.
 /// </summary>
 /// <param name="targetObject">object targeted by the interaction</param>
 public static HandApply ByLocalPlayer(GameObject targetObject)
 {
     if (PlayerManager.LocalPlayerScript.IsGhost)
     {
         //hand apply never works when local player
         return(HandApply.Invalid);
     }
     return(new HandApply(PlayerManager.LocalPlayer,
                          PlayerManager.LocalPlayerScript.DynamicItemStorage.GetActiveHandSlot()?.ItemObject,
                          targetObject,
                          UIManager.DamageZone,
                          PlayerManager.LocalPlayerScript.DynamicItemStorage.GetActiveHandSlot(),
                          UIManager.CurrentIntent,
                          KeyboardInputManager.IsAltPressed()));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates a HandApply interaction performed by the local player targeting the specified object.
 /// </summary>
 /// <param name="targetObject">object targeted by the interaction</param>
 /// <returns></returns>
 public static HandApply ByLocalPlayer(GameObject targetObject)
 {
     if (PlayerManager.LocalPlayerScript.IsGhost)
     {
         //hand apply never works when local player
         return(HandApply.Invalid);
     }
     return(new HandApply(PlayerManager.LocalPlayer,
                          UIManager.Hands.CurrentSlot.ItemObject,
                          targetObject,
                          UIManager.DamageZone,
                          UIManager.Instance.hands.CurrentSlot.ItemSlot,
                          UIManager.CurrentIntent,
                          KeyboardInputManager.IsAltPressed()));
 }
Exemplo n.º 6
0
    /// <summary>
    /// Creates a PositionalHandApply interaction performed by the local player targeting the specified object.
    /// </summary>
    /// <param name="targetObject">object targeted by the interaction, null to target empty space</param>
    /// <param name="targetVector">vector pointing from player to the position they are targeting, defaults
    /// to where the mouse currently is.</param>
    /// <returns></returns>
    public static PositionalHandApply ByLocalPlayer(GameObject targetObject, Vector2?targetVector = null)
    {
        if (PlayerManager.LocalPlayerScript.IsGhost)
        {
            return(Invalid);
        }
        var targetVec = targetVector ?? MouseUtils.MouseToWorldPos() - PlayerManager.LocalPlayer.transform.position;

        return(new PositionalHandApply(
                   PlayerManager.LocalPlayer,
                   PlayerManager.LocalPlayerScript.DynamicItemStorage.GetActiveHandSlot()?.ItemObject,
                   targetObject,
                   targetVec,
                   PlayerManager.LocalPlayerScript.DynamicItemStorage.GetActiveHandSlot(),
                   UIManager.CurrentIntent,
                   UIManager.DamageZone,
                   KeyboardInputManager.IsAltPressed()));
    }
    /// <summary>
    /// Creates a PositionalHandApply interaction performed by the local player targeting the specified object.
    /// </summary>
    /// <param name="targetObject">object targeted by the interaction, null to target empty space</param>
    /// <param name="targetVector">Target position, the Local position that the performer is pointing at , Defaults
    /// to where the mouse currently is.</param>
    /// <returns></returns>
    public static PositionalHandApply ByLocalPlayer(GameObject targetObject, Vector2?IntargePosition = null)
    {
        if (PlayerManager.LocalPlayerScript.IsGhost)
        {
            return(Invalid);
        }
        var targePosition = IntargePosition ?? MouseUtils.MouseToWorldPos().ToLocal(PlayerManager.LocalPlayer.RegisterTile().Matrix);

        return(new PositionalHandApply(
                   PlayerManager.LocalPlayer,
                   PlayerManager.LocalPlayerScript.DynamicItemStorage.GetActiveHandSlot()?.ItemObject,
                   targetObject,
                   targePosition,
                   PlayerManager.LocalPlayerScript.DynamicItemStorage.GetActiveHandSlot(),
                   UIManager.CurrentIntent,
                   UIManager.DamageZone,
                   KeyboardInputManager.IsAltPressed()));
    }
Exemplo n.º 8
0
 /// <summary>
 /// Create a InventoryApply interaction performed by the local player using their active hand
 /// </summary>
 /// <param name="targetObjectSlot">slot of the object that the player is applying the active hand item to</param>
 /// <param name="fromSlot">hand slot if clicking on something in inventory, otherwise slot
 /// the item is being dragged from</param>
 /// <returns></returns>
 public static InventoryApply ByLocalPlayer(ItemSlot targetObjectSlot, ItemSlot fromSlot)
 {
     if (PlayerManager.LocalPlayerScript.IsGhost)
     {
         return(Invalid);
     }
     return(new InventoryApply(PlayerManager.LocalPlayer,
                               targetObjectSlot, fromSlot, UIManager.CurrentIntent, KeyboardInputManager.IsAltPressed()));
 }