Exemple #1
0
    /// <summary>
    /// Drop the item.
    /// </summary>
    /// <param name="obj">The GameObject (Player) that wants to execute this action.</param>
    /// <returns>Returns true if the item was dropped successfully, false otherwise.</returns>
    public override bool Execute(GameObject obj)
    {
        bool stackModifierInput = Input.GetKey(SettingsManager.GetStackModifier()); //if pressed, will drop entire stack
        int  amountToDrop       = 1;

        if (stackModifierInput)
        {
            amountToDrop = toDrop.Quantity;
        }

        GameItem removedItem = invPanel.ManagedInventory.RemoveItem(invPanel.SelectedX, invPanel.SelectedY, amountToDrop);

        if (removedItem == null)
        {
            return(false); //nothing to drop. Inventory bug
        }

        removedItem.CreateGameObject(obj.transform.position);
        return(true);
    }