public void clickInventoryItem(int slotnumber, Inventory toInventory)
{
// TRANSFER TO BUILDING INVENTORY
if (gameManager.getBuildingCatalog().getBuildingLastClicked() != null)
{
if (gameManager.GetUI().getBuildingInventoryOpen() && this.getInventorySlot(slotnumber).currentAmountInSlot != 0)
{
if (gameManager.getBuildingCatalog().getBuildingLastClickedAttributes().getPlayerEnteredBuilding())
{
int amountToRemove = toInventory.addItemToInventory(this.getInventorySlot(slotnumber).getItemInSlot(), this.getInventorySlot(slotnumber).getCurrentAmountInSlot());
removeAmountFromSpecificSlot(this.getInventorySlot(slotnumber), this.getInventorySlot(slotnumber).getCurrentAmountInSlot() - amountToRemove);
updateInventoryInterface();
}
else
{
gameManager.getMessageLogText().addMessageToLog("The player needs to be inside the building in order to transfer items to building inventory");
}
}
}
// TRANSFER TO UNFINISHED BUILDING
if (gameManager.getBuildingCatalog().getUnfinishedBuildingSelected() != null)
{
if (gameManager.GetUI().getUnfinishedBuildingOpen() && this.getInventorySlot(slotnumber).currentAmountInSlot != 0)
{
// TODO: if statement that prohbit player from transfering if to far away
int amountToRemove = toInventory.addItemToInventory(this.getInventorySlot(slotnumber).getItemInSlot(), this.getInventorySlot(slotnumber).getCurrentAmountInSlot());
removeAmountFromSpecificSlot(this.getInventorySlot(slotnumber), this.getInventorySlot(slotnumber).getCurrentAmountInSlot() - amountToRemove);
updateInventoryInterface();
}
}
// TRANSFER TO CITIZEN
if (gameManager.getCitizenCatalog().getSelectedCitizen() != null)
{
if (gameManager.GetUI().getCitizenInventoryOpen() && this.getInventorySlot(slotnumber).currentAmountInSlot != 0)
{
// TODO: if statement that prohbit player from transfering if to far away
int amountToRemove = toInventory.addItemToInventory(this.getInventorySlot(slotnumber).getItemInSlot(), this.getInventorySlot(slotnumber).getCurrentAmountInSlot());
removeAmountFromSpecificSlot(this.getInventorySlot(slotnumber), this.getInventorySlot(slotnumber).getCurrentAmountInSlot() - amountToRemove);
updateInventoryInterface();
}
}
// TRANSFER TO TOOLBAR
if (!gameManager.GetUI().getCitizenInventoryOpen() && !gameManager.GetUI().getUnfinishedBuildingOpen() && !gameManager.GetUI().getBuildingInventoryOpen() && this.getInventorySlot(slotnumber).currentAmountInSlot != 0)
{
//if(gameManager.getPlayerBehavior().getPerkattributes().getPerksByName(this.getInventorySlot(slotnumber).getItemInSlot()) != null){
gameManager.getPlayerBehavior().getToolbelt().addToSlot(this.getInventorySlot(slotnumber));
updateInventoryInterface();
//} else {
//Debug.Log("Dont have the perk associated with that item");
//}
}
if (gameManager.GetUI().getInventoryOpen() && gameManager.GetUI().getEquipmentOpen() && this.getInventorySlot(slotnumber).currentAmountInSlot != 0)
{
gameManager.getPlayerBehavior().getToolbelt().addToSlot(this.getInventorySlot(slotnumber));
updateInventoryInterface();
}
}