private void Update() { if (isInRange && player != null) { if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.F)) { if (player.GetComponent <Interactor>().CanFixBridge) { player.GetComponent <TileMaker>().BridgeIsFixed = true; gameObject.SetActive(false); if (infoMessage.CurrentMessage != "The bridge is fixed!") { infoMessage.DisplayMessage("The bridge is fixed!", 1.5F, true); } Interactor.BridgeFixed = true; gameManagerScript.AddItemToInventory(InventoryItem.Hammer, -1); if (particleSystem != null) { particleSystem.Stop(); } } else { if (infoMessage.CurrentMessage != "You need a hammer") { infoMessage.DisplayMessage("You need a hammer", 1.5F); } } } } }
public void AddToInventory(InventoryItem item, int num) { gameManager.AddItemToInventory(item, num); int berryCount = 0;; foreach (InventoryGroup inventoryGroup in GameManagerScript.inventory) { if (inventoryGroup.InventoryItem == InventoryItem.Health_Berry) { berryCount++; } if (inventoryGroup.InventoryItem == InventoryItem.Double_Health_Berry) { berryCount++; } if (inventoryGroup.InventoryItem == InventoryItem.Stamina_Berry) { berryCount++; } if (inventoryGroup.InventoryItem == InventoryItem.Thirst_Berry) { berryCount++; } if (inventoryGroup.InventoryItem == InventoryItem.Hunger_Berry) { berryCount++; } if (inventoryGroup.InventoryItem == InventoryItem.KissOfDeath_Berry) { berryCount++; } if (inventoryGroup.InventoryItem == InventoryItem.Poison_Berry) { berryCount++; } } if (berryCount >= 4) { AreBerriesCollected = true; } }
public void GiveToFamilyMember(int memberNumber) { if (family == null || gameManagerScript == null || itemToGive == null || itemToGive.inventoryGroup == null) { return; } family.GiveToMember(1, memberNumber, itemToGive.inventoryGroup.InventoryItem); if (itemToGive.inventoryGroup.InventoryItem == InventoryItem.Gold) { goldGiven++; } else { totalGiven++; } gameManagerScript.AddItemToInventory(itemToGive.inventoryGroup.InventoryItem, -1); }