//Removes item after using it public void removeItem(PICK_UP item) { if (itemsInIventory[item] > 0) { itemsInIventory[item] = itemsInIventory[item] - 1; } }
//Checks if the players has the determined item public bool hasRequiredObject(PICK_UP item) { int amount = 0; itemsInIventory.TryGetValue(item, out amount); return(amount > 0); }
// Start is called before the first frame update void Start() { //Initialize Dictionary var values = PICK_UP.GetValues(typeof(PICK_UP)); foreach (PICK_UP val in values) { itemsInIventory.Add(val, 0); } itemsInIventory[PICK_UP.WRENCH] = 1; }
public void pickUpGem(PICK_UP gemType) { switch (gemType) { default: case (PICK_UP.BLUE_GEM): Destroy(blueGemBubble); portal.GetComponent <SwirlControl>().pickedBlue(); break; case (PICK_UP.RED_GEM): Destroy(redGemBubble); portal.GetComponent <SwirlControl>().pickedRed(); break; case (PICK_UP.GREEN_GEM): Destroy(greenGemBubble); portal.GetComponent <SwirlControl>().pickedGreen(); break; } }