public void UpdateCraftingPanel() { //CAMPFIRE craftCamfireButton.GetComponentInChildren <Button>().interactable = (playerInvo.CheckItemInInventory(2, 10)); //AXE craftAxeButton.GetComponentInChildren <Button>().interactable = (playerInvo.CheckItemInInventory(1, 10) && playerInvo.CheckItemInInventory(2, 10)); //PICK craftPickButton.GetComponentInChildren <Button>().interactable = (playerInvo.CheckItemInInventory(1, 10) && playerInvo.CheckItemInInventory(2, 10)); }
public bool PlaceTile(int x, int y, GameObject tile) { if (x >= 0 && x < frontTilesXdim && y >= 0 && y < frontTilesYdim && frontTiles[x, y] == null) { playerInventoryScript = player.GetComponent <InventoryScript>(); if (playerInventoryScript.CheckItemInInventory(tile, 1)) { playerInventoryScript.RemoveItemFromInventory(tile, 1); GameObject t = Instantiate(tile, new Vector2(x, y), Quaternion.identity); t.GetComponent <SpriteRenderer>().sortingOrder = frontTileLayerID; frontTiles[x, y] = t; return(true); } } return(false); }