void FixedUpdate() { if (AllContainersFull()) { if (GlobalControls.globalControlsProperties.Contains("apartmentCondition")) { foreach (StorageContainer container in containers) { GameObject item = container.contents; if (item) { GlobalItemList.UpdateItemList(item.name, "QuakeApartment", item.transform.position, container.name); } } SceneManager.LoadScene("QuakeApartment"); } else { foreach (StorageContainer container in containers) { GameObject item = container.contents; if (item) { GlobalItemList.UpdateItemList(item.name, "QuakeHouse", item.transform.position, container.name); } } SceneManager.LoadScene("QuakeHouse"); } } }
/// <summary> /// loads the item into a scene /// </summary> /// <param name="sceneName"></param> public void LoadItems(string sceneName) { List <Item> itemsToChange = new List <Item>(); if (sceneName.Equals("PreQuakeApartment")) { foreach (Item item in GlobalItemList.ItemList.Values) { if (item.scene.Equals("PreQuakeHouse")) { itemsToChange.Add(item); } } } foreach (Item item in itemsToChange) { GlobalItemList.UpdateItemList(item.name, "PreQuakeApartment", new Vector3(item.location.x - 2, item.location.y, item.location.z), item.containerName); } GameObject g = GameObject.FindWithTag("Inventory"); if (g) { inventory = g.GetComponent <Inventory>(); } foreach (Item item in GlobalItemList.ItemList.Values) { if (item.scene.Equals(sceneName) && item.containerName.Equals("")) { //poot item here GameObject prefab = (GameObject)Resources.Load(item.name, typeof(GameObject)); // prefab.transform.position = item.location; GameObject itemInScene = Instantiate(prefab, item.location, Quaternion.identity); itemInScene.transform.position = item.location; } else if (item.scene.Equals("Inventory") && item.containerName.Equals("Player") && inventory) { //populate inventory with many things GameObject prefab = (GameObject)Resources.Load(item.name, typeof(GameObject)); GameObject itemInInventory = Instantiate(prefab, item.location, Quaternion.identity); inventory.PickUpAtSlot((int)item.location.x, itemInInventory); } //case when we have an occupied container in the scene to be loaded else if (item.scene.Equals(sceneName) && !item.containerName.Equals("")) { GameObject itemInContainer = GameObject.Find(item.containerName); if (itemInContainer) { GameObject prefab = (GameObject)Resources.Load(item.name, typeof(GameObject)); // prefab.transform.position = item.location; GameObject itemInScene = Instantiate(prefab, item.location, Quaternion.identity); itemInScene.transform.position = item.location; //place this item into the storage container's contents itemInContainer.GetComponent <StorageContainer>().contents = itemInScene; } } } }
/// <summary> /// Takes the item in container (if there is one) or puts the selected item into container. /// </summary> void InteractWithStorageContainer(StorageContainer container) { int i = FirstEmptySlot(); if (i >= 0 && !SlotIsOccupied(i) && container.contents) { GameObject item = container.RemoveItem(); item.GetComponent <Collectible>().inStorageContainer = false; PickUp(item); } else { i = selectedSlotNumber; // Just to make the later expressions less hairy if (SlotIsOccupied(i) && !container.contents) { // Place item in the container container.contents = items[i]; items[i].SetActive(true); Transform t = player.transform; items[i].transform.position = player.destination.transform.position + player.transform.forward + Vector3.up; items[i].GetComponent <Collectible>().inStorageContainer = true; GlobalItemList.UpdateItemList(items[i].name, SceneManager.GetActiveScene().name, items[i].transform.position, container.name); // If these items are in a storage container, then the player doesn't have them // update globalControlsProperties accordingly. if (items[i].name.Equals("Water Bottle Clean(Clone)")) { GlobalControls.globalControlsProperties.Remove("playerHasCleanWater"); } if (items[i].name.Equals("Wrench(Clone)")) { GlobalControls.globalControlsProperties.Remove("playerHasWrench"); } if (items[i].name.Equals("First Aid Kit(Clone)")) { GlobalControls.globalControlsProperties.Remove("playerHasFirstAidKit"); } if (items[i].name.Equals("Epi Pen(Clone)")) { GlobalControls.globalControlsProperties.Remove("playerHasEpiPen"); } if (items[i].name.Equals("Wrench(Clone)")) { GlobalControls.globalControlsProperties.Remove("playerHasWrench"); } // Remove item from inventory items[i] = null; inventoryUI.RemoveFromSlot(i); } } }
public void UpdateGlobalItemList(string npcName) { for (int i = 0; i < inventoryUIs[(int)InventoryE.NPC].slotContents.Length; i++) { if (inventoryUIs[(int)InventoryE.NPC].slotContents[i].activeSelf) { inventories[(int)InventoryE.NPC].items[i].name = inventories[(int)InventoryE.NPC].items[i].name.Replace("(Clone)", "").Trim(); //If new item for NPC and it's one of their needs increase satisfaction int indexInNPCNeeds = GlobalControls.npcList[npcName].needs .IndexOf(inventories[(int)InventoryE.NPC].items[i].name); if (indexInNPCNeeds >= 0 && !GlobalItemList.ItemList[inventories[(int)InventoryE.NPC].items[i].name] .containerName.Equals(npcName) && !GlobalControls.npcList[npcName].needsMet[indexInNPCNeeds]) { GlobalControls.npcList[npcName].satisfaction++; Debug.Log(npcName + " Satisfaction increased to " + GlobalControls.npcList[npcName].satisfaction); GlobalControls.npcList[npcName].needsMet[indexInNPCNeeds] = true; // adjust the NPC's description to be only what they still need List <string> neededItems = new List <string>(); for (int j = 0; j < GlobalControls.npcList[npcName].needsMet.Count; j++) { if (!GlobalControls.npcList[npcName].needsMet[j]) { neededItems.Add(GlobalControls.npcList[npcName].needs[j]); } } string description; if (neededItems.Count == 0) { description = GlobalControls.npcList[npcName].name + " is happy and needs nothing more"; } else if (neededItems.Count == 1) { description = GlobalControls.npcList[npcName].name + " needs a " + neededItems[0]; } else { description = GlobalControls.npcList[npcName].name + " needs a " + neededItems[0] + " and a " + neededItems[1]; } GlobalControls.npcList[npcName].description = description; } GlobalItemList.UpdateItemList(inventories[(int)InventoryE.NPC].items[i].name, "Inventory", new Vector3(i, 0, 0), npcName); } } }
public void PickUp(GameObject item) { int i = FirstEmptySlot(); if (i >= 0) { inventoryUI.AddToSlot(i, item.GetComponent <Collectible>().sprite); // Add item to the items array items[i] = item; //updates item list to add item to list GlobalItemList.UpdateItemList(item.name, "Inventory", new Vector3(i, 0, 0), "Player"); // Remove item from the world item.SetActive(false); // If you pick up these items, that means the player has them. // Update globalControlsProperties accordingly. if (item.name.Equals("Water Bottle Clean(Clone)")) { Debug.Log("Player Has Water!"); GlobalControls.globalControlsProperties.Add("playerHasCleanWater"); } if (item.name.Equals("Wrench(Clone)")) { Debug.Log("Player Has Wrench!"); GlobalControls.globalControlsProperties.Add("playerHasWrench"); } if (item.name.Equals("First Aid Kit(Clone)")) { Debug.Log("Player Has First Aid Kit!"); GlobalControls.globalControlsProperties.Add("playerHasFirstAidKit"); } if (item.name.Equals("Epi Pen(Clone)")) { Debug.Log("Player Has Epi Pen!"); GlobalControls.globalControlsProperties.Add("playerHasEpiPen"); } } //reselect slot to current slot number to update tooltip if necessary SelectSlotNumber(selectedSlotNumber); }
/// <summary> /// same as RemoveLatrineItem but for bucket (apartment condition) /// </summary> /// <param name="i"></param> void RemoveBucketItem(int i) { twoBucket.contents = items[i]; items[i].SetActive(true); items[i].transform.position = player.destination.transform.position + player.transform.forward + Vector3.up; items[i].GetComponent <Collectible>().inLatrine = true; GlobalItemList.UpdateItemList(items[i].name, "", new Vector3(0, 0, 0), ""); GameObject.Find(items[i].name).SetActive(false); // Remove item from inventory items[i] = null; inventoryUI.RemoveFromSlot(i); twoBucket.contents = null; }
public void LeaveTrading() { for (int i = 0; i < inventoryUIs[(int)InventoryE.PlayerBin].slotContents.Length; i++) { if (inventoryUIs[(int)InventoryE.PlayerBin].slotContents[i].activeSelf) { tradeLogic.TransferItem(InventoryE.PlayerBin, InventoryE.Player, i); } } for (int i = 0; i < inventoryUIs[(int)InventoryE.NPCBin].slotContents.Length; i++) { if (inventoryUIs[(int)InventoryE.NPCBin].slotContents[i].activeSelf) { tradeLogic.TransferItem(InventoryE.NPCBin, InventoryE.NPC, i); } } tradeLogic.UpdateGlobalItemList(npcName); //update IOUs int counter = 0; foreach (GameObject go in inventoryUIs[(int)InventoryE.IOU].slotFrames) { if (go.activeSelf) { counter++; } } GlobalControls.npcList[npcName].owes = counter; referenceManager.inventoryCanvas.SetActive(true); if (referenceManager.inventoryCanvas) { //overwrite parent inventory with inventory here for (int i = 0; i < inventoryUIs[(int)InventoryE.Player].slotContents.Length; i++) { if (inventoryUIs[(int)InventoryE.Player].slotContents[i].activeSelf) { inventories[(int)InventoryE.Parent].items[i] = null; inventoryUIs[(int)InventoryE.Parent].slotContents[i].SetActive(false); tradeLogic.TransferItem(InventoryE.Player, InventoryE.Parent, i); } else if (inventoryUIs[(int)InventoryE.Parent].slotContents[i].activeSelf) { inventories[(int)InventoryE.Parent].items[i] = null; inventoryUIs[(int)InventoryE.Parent].slotContents[i].SetActive(false); } } for (int i = 0; i < inventoryUIs[(int)InventoryE.Parent].slotContents.Length; i++) { if (inventoryUIs[(int)InventoryE.Parent].slotContents[i].activeSelf) { inventories[(int)InventoryE.Parent].items[i].GetComponent <Collectible>().inventory = inventories[(int)InventoryE.Parent]; } } for (int i = 0; i < inventoryUIs[(int)InventoryE.Parent].slotContents.Length; i++) { if (inventoryUIs[(int)InventoryE.Parent].slotContents[i].activeSelf) { GlobalItemList.UpdateItemList(inventories[(int)InventoryE.Parent].items[i].name, "Inventory", new Vector3(i, 0, 0), "Player"); } } } gameStateManager.SetConversing(); }
void Update() { if (GlobalControls.globalControlsProperties.Contains("adminMode")) { if (!virtualKeyboard) { // Set keyDown to a specific cheat if (Input.GetKeyDown(preQuakeTeleport)) { keyDown = preQuakeTeleport; } else if (Input.GetKeyDown(quakeTeleport)) { keyDown = quakeTeleport; } else if (Input.GetKeyDown(strategicMapTeleport)) { keyDown = strategicMapTeleport; } else if (Input.GetKeyDown(completeWater)) { keyDown = completeWater; } else if (Input.GetKeyDown(completePoop)) { keyDown = completePoop; } else if (Input.GetKeyDown(restart)) { keyDown = restart; } else if (Input.GetKeyDown(loadPoopItems)) { keyDown = loadPoopItems; } else if (Input.GetKeyDown(loadWaterItems)) { keyDown = loadWaterItems; } else if (Input.GetKeyDown(loadPreQuakeItems)) { keyDown = loadPreQuakeItems; } else if (Input.GetKeyDown(changeCondition)) { keyDown = changeCondition; } else if (Input.GetKeyDown(angieItems)) { keyDown = angieItems; } else if (Input.GetKeyDown(carlosItems)) { keyDown = carlosItems; } else if (Input.GetKeyDown(demItems)) { keyDown = demItems; } else if (Input.GetKeyDown(annetteItems)) { keyDown = annetteItems; } else if (Input.GetKeyDown(safiItems)) { keyDown = safiItems; } else if (Input.GetKeyDown(rainerItems)) { keyDown = rainerItems; } } if (keyDown.Equals(preQuakeTeleport))//Load PreQuakeHouse { if (GlobalControls.globalControlsProperties.Contains("apartmentCondition")) { sceneManagement.ChangeScene("PreQuakeApartment"); } else { sceneManagement.ChangeScene("PreQuakeHouse"); } } if (keyDown.Equals(quakeTeleport))//Load QuakeHouse { if (GlobalControls.globalControlsProperties.Contains("apartmentCondition")) { sceneManagement.ChangeScene("QuakeApartment"); } else { sceneManagement.ChangeScene("QuakeHouse"); } } if (keyDown.Equals(strategicMapTeleport))//Load Strategic Map { sceneManagement.ChangeScene("StrategicMap"); } if (meters && keyDown.Equals(completeWater)) //Complete Water { meters.MarkTaskAsDone("water"); } if (meters && keyDown.Equals(completePoop)) //Complete Poop { meters.MarkTaskAsDone("poop"); } if (keyDown.Equals(restart)) //Restart Game { sceneManagement.Restart(); } if (keyDown.Equals(loadPoopItems)) //Load Yard with Latrine Items { if (GlobalControls.globalControlsProperties.Contains("apartmentCondition")) { GlobalItemList.Reset(); GlobalItemList.UpdateItemList("Bucket", "Inventory", new Vector3(0, 0, 0), "Player"); GlobalItemList.UpdateItemList("Bucket 2", "Inventory", new Vector3(1, 0, 0), "Player"); GlobalItemList.UpdateItemList("Bag", "Inventory", new Vector3(2, 0, 0), "Player"); GlobalItemList.UpdateItemList("Toilet Paper", "Inventory", new Vector3(3, 0, 0), "Player"); GlobalItemList.UpdateItemList("Wood Chips", "Inventory", new Vector3(4, 0, 0), "Player"); sceneManagement.ChangeScene("Street"); } else { GlobalItemList.Reset(); GlobalItemList.UpdateItemList("Shovel", "Inventory", new Vector3(0, 0, 0), "Player"); GlobalItemList.UpdateItemList("Plywood", "Inventory", new Vector3(1, 0, 0), "Player"); GlobalItemList.UpdateItemList("Rope", "Inventory", new Vector3(2, 0, 0), "Player"); GlobalItemList.UpdateItemList("Tarp", "Inventory", new Vector3(3, 0, 0), "Player"); GlobalItemList.UpdateItemList("Toilet Paper", "Inventory", new Vector3(4, 0, 0), "Player"); sceneManagement.ChangeScene("Yard"); } } if (keyDown.Equals(loadWaterItems)) //Load scene with water task items { GlobalItemList.Reset(); GlobalItemList.UpdateItemList("Dirty Water Bottle", "Inventory", new Vector3(0, 0, 0), "Player"); GlobalItemList.UpdateItemList("Bleach", "Inventory", new Vector3(1, 0, 0), "Player"); sceneManagement.ChangeScene(SceneManager.GetActiveScene().name); } if (keyDown.Equals(loadPreQuakeItems)) //Load Yard with PreQuake Items { if (GlobalControls.globalControlsProperties.Contains("apartmentCondition")) { GlobalItemList.Reset(); GlobalItemList.UpdateItemList("Bleach", "Street", new Vector3(4.5f, 1.5f, -8.5f), "Go Bag 1"); GlobalItemList.UpdateItemList("Book", "Street", new Vector3(4.5f, 1.5f, -7.5f), "Go Bag 2"); sceneManagement.ChangeScene("Street"); } else { GlobalItemList.Reset(); GlobalItemList.UpdateItemList("Sunscreen", "Yard", new Vector3(6.5f, 0.5f, 0.5f), ""); GlobalItemList.UpdateItemList("Dirty Water Bottle", "Yard", new Vector3(-6.5f, 0.5f, 0.5f), ""); GlobalItemList.UpdateItemList("Flashlight", "Yard", new Vector3(3.5f, 0.5f, 3.5f), ""); GlobalItemList.UpdateItemList("Book", "Yard", new Vector3(-5.5f, 0.5f, -7.5f), ""); sceneManagement.ChangeScene("Yard"); } } if (keyDown.Equals(changeCondition)) { if (GlobalControls.globalControlsProperties.Contains("apartmentCondition")) { Debug.Log("Changing Global Apartment condition flag from " + GlobalControls.globalControlsProperties.Contains("apartmentCondition") + " to " + !GlobalControls.globalControlsProperties.Contains("apartmentCondition")); GlobalControls.globalControlsProperties.Remove("apartmentCondition"); GlobalItemList.Reset(); } else if (!GlobalControls.globalControlsProperties.Contains("apartmentCondition")) { Debug.Log("Changing Global Apartment condition flag from " + GlobalControls.globalControlsProperties.Contains("apartmentCondition") + " to " + !GlobalControls.globalControlsProperties.Contains("apartmentCondition")); GlobalControls.globalControlsProperties.Add("apartmentCondition"); GlobalItemList.Reset(); } } if (keyDown.Equals(angieItems)) { Debug.Log("Giving Angie Required Items"); GlobalItemList.Reset(); GlobalItemList.UpdateItemList("First Aid Kit", "Inventory", new Vector3(0, 0, 0), "Player"); GlobalItemList.UpdateItemList("Epi Pen", "Inventory", new Vector3(1, 0, 0), "Player"); GlobalItemList.UpdateItemList("Water Bottle Clean", "Inventory", new Vector3(2, 0, 0), "Player"); sceneManagement.ChangeScene("PSU"); } else if (keyDown.Equals(carlosItems)) { Debug.Log("Giving Carlos Required Items"); GlobalItemList.Reset(); GlobalItemList.UpdateItemList("Radio", "Inventory", new Vector3(0, 0, 0), "Player"); GlobalItemList.UpdateItemList("Batteries", "Inventory", new Vector3(1, 0, 0), "Player"); GlobalItemList.UpdateItemList("Water Bottle Clean", "Inventory", new Vector3(2, 0, 0), "Player"); sceneManagement.ChangeScene("PSU"); } else if (keyDown.Equals(demItems)) { Debug.Log("Giving Dem Required Items"); GlobalItemList.Reset(); GlobalItemList.UpdateItemList("Canned Food", "Inventory", new Vector3(0, 0, 0), "Player"); GlobalItemList.UpdateItemList("Can Opener", "Inventory", new Vector3(1, 0, 0), "Player"); GlobalItemList.UpdateItemList("Water Bottle Clean", "Inventory", new Vector3(2, 0, 0), "Player"); sceneManagement.ChangeScene("WaterfrontPark"); } else if (keyDown.Equals(annetteItems)) { Debug.Log("Giving Annette Required Items"); GlobalItemList.Reset(); GlobalItemList.UpdateItemList("Dog Crate", "Inventory", new Vector3(0, 0, 0), "Player"); GlobalItemList.UpdateItemList("Leash", "Inventory", new Vector3(1, 0, 0), "Player"); GlobalItemList.UpdateItemList("Water Bottle Clean", "Inventory", new Vector3(2, 0, 0), "Player"); sceneManagement.ChangeScene("PioneerCourthouseSquare"); } else if (keyDown.Equals(safiItems)) { Debug.Log("Giving Safi Required Items"); GlobalItemList.Reset(); GlobalItemList.UpdateItemList("Wrench", "Inventory", new Vector3(0, 0, 0), "Player"); GlobalItemList.UpdateItemList("Water Bottle Clean", "Inventory", new Vector3(2, 0, 0), "Player"); sceneManagement.ChangeScene("WaterfrontPark"); } else if (keyDown.Equals(rainerItems)) { Debug.Log("Giving Rainer Required Items"); GlobalItemList.Reset(); GlobalItemList.UpdateItemList("Tent", "Inventory", new Vector3(0, 0, 0), "Player"); GlobalItemList.UpdateItemList("Blanket", "Inventory", new Vector3(1, 0, 0), "Player"); GlobalItemList.UpdateItemList("Water Bottle Clean", "Inventory", new Vector3(2, 0, 0), "Player"); sceneManagement.ChangeScene("PioneerCourthouseSquare"); } keyDown = KeyCode.JoystickButton0; } }
/// <summary> /// This handles All "end of scene" things we need to do /// </summary> /// <param name="sceneToLoad"></param> public void ChangeScene(string sceneToLoad) { // Set GlobalControls to current scene GlobalControls.currentScene = Array.IndexOf(previousScenes, SceneManager.GetActiveScene().name); if (sceneToLoad.Equals("StrategicMap")) { GlobalControls.globalControlsProperties.Add("isStrategicMap"); } else if (sceneToLoad.Equals("GameEnd")) { GlobalControls.globalControlsProperties.Remove("metersEnabled"); } else if (sceneToLoad.Contains("Quake")) { GlobalControls.globalControlsProperties.Remove("metersEnabled"); } else { GlobalControls.globalControlsProperties.Add("metersEnabled"); GlobalControls.globalControlsProperties.Remove("isStrategicMap"); if (!GlobalControls.globalControlsProperties.Contains("poopTaskCompleted")) { GlobalControls.poopTimeLeft--; } if (!GlobalControls.globalControlsProperties.Contains("waterTaskCompleted")) { GlobalControls.waterTimeLeft--; } } if (sceneToLoad.Equals("Yard") && SceneManager.GetActiveScene().name.Equals("QuakeHouse")) { bool noStoredWater = true; StorageContainer[] containers = new StorageContainer[] { GameObject.Find("Shed 1").GetComponent <StorageContainer>(), GameObject.Find("Shed 2").GetComponent <StorageContainer>(), GameObject.Find("Cabinet 1").GetComponent <StorageContainer>(), GameObject.Find("Cabinet 2").GetComponent <StorageContainer>(), GameObject.Find("Cabinet 3").GetComponent <StorageContainer>(), GameObject.Find("Cabinet 4").GetComponent <StorageContainer>(), }; foreach (StorageContainer container in containers) { GameObject item = container.contents; if (item) { GlobalItemList.UpdateItemList(item.name, "Yard", item.transform.position, container.name); } if (item && item.name.Equals("Dirty Water Bottle(Clone)") && (container.name.Equals("Shed 1") || container.name.Equals("Shed 2"))) { noStoredWater = false; } } if (noStoredWater) { GlobalControls.waterTimeLeft = GlobalControls.noStoredWaterTime; } } else if (sceneToLoad.Equals("QuakeHouse") && SceneManager.GetActiveScene().name.Equals("PreQuakeHouse")) { StorageContainer[] containers = new StorageContainer[] { GameObject.Find("Shed 1").GetComponent <StorageContainer>(), GameObject.Find("Shed 2").GetComponent <StorageContainer>(), GameObject.Find("Cabinet 1").GetComponent <StorageContainer>(), GameObject.Find("Cabinet 2").GetComponent <StorageContainer>(), GameObject.Find("Cabinet 3").GetComponent <StorageContainer>(), GameObject.Find("Cabinet 4").GetComponent <StorageContainer>(), }; foreach (StorageContainer container in containers) { GameObject item = container.contents; if (item) { GlobalItemList.UpdateItemList(item.name, "QuakeHouse", item.transform.position, container.name); } } } else if (sceneToLoad.Equals("QuakeApartment") && SceneManager.GetActiveScene().name.Equals("PreQuakeApartmentStylizedv3")) { StorageContainer[] containers = new StorageContainer[] { GameObject.Find("Shelf 1").GetComponent <StorageContainer>(), GameObject.Find("Shelf 2").GetComponent <StorageContainer>(), GameObject.Find("Shelf 3").GetComponent <StorageContainer>(), GameObject.Find("Shelf 4").GetComponent <StorageContainer>(), GameObject.Find("Go Bag 1").GetComponent <StorageContainer>(), GameObject.Find("Go Bag 2").GetComponent <StorageContainer>(), }; foreach (StorageContainer container in containers) { GameObject item = container.contents; if (item) { GlobalItemList.UpdateItemList(item.name, "QuakeApartment", item.transform.position, container.name); } } } else if (sceneToLoad.Equals("Street") && SceneManager.GetActiveScene().name.Equals("QuakeApartment")) { bool noStoredWater = true; int inventoryCount = 0; foreach (Item item in GlobalItemList.ItemList.Values) { if (item.scene.Equals("Inventory") && item.containerName.Equals("Player")) { if (item.name.Equals("Bleach")) { noStoredWater = false; } inventoryCount++; } } if (noStoredWater || inventoryCount != 2) { GlobalControls.waterTimeLeft = GlobalControls.noStoredWaterTime; } } SceneManager.LoadSceneAsync(sceneToLoad); }
private void InteractWithWaterPurifyingTable(StorageContainer container) { if (!container.contents && SlotIsOccupied(selectedSlotNumber)) { if (items[selectedSlotNumber].name.Equals("Dirty Water Bottle(Clone)")) { Debug.Log("Dropping water bottle"); container.contents = items[selectedSlotNumber]; items[selectedSlotNumber].SetActive(true); Transform t = player.transform; items[selectedSlotNumber].transform.position = player.destination.transform.position + player.transform.forward + Vector3.up; items[selectedSlotNumber].GetComponent <Collectible>().inStorageContainer = true; GlobalItemList.UpdateItemList(items[selectedSlotNumber].name, SceneManager.GetActiveScene().name, items[selectedSlotNumber].transform.position, container.name); // Remove item from inventory items[selectedSlotNumber] = null; inventoryUI.RemoveFromSlot(selectedSlotNumber); } } else if (container.contents && SlotIsOccupied(selectedSlotNumber)) { if (items[selectedSlotNumber].name.Equals("Bleach(Clone)") && !GlobalControls.globalControlsProperties.Contains("waterPurified")) { Debug.Log("Using bleach"); meters = referenceManager.metersCanvas.GetComponent <Meters>(); meters.MarkTaskAsDone("water"); GlobalItemList.UpdateItemList("Dirty Water Bottle", "", new Vector3(0, 0, 0), ""); GameObject.Find("Dirty Water Bottle(Clone)").SetActive(false); GlobalItemList.UpdateItemList("Water Bottle Clean", SceneManager.GetActiveScene().name, player.destination.transform.position + player.transform.forward + Vector3.up, "Water Purifying Table"); GlobalControls.globalControlsProperties.Add("waterPurified"); GameObject prefab = (GameObject)Resources.Load("Water Bottle Clean", typeof(GameObject)); GameObject waterBottleClean = Instantiate(prefab, player.destination.transform.position + player.transform.forward + Vector3.up, Quaternion.identity); container.contents = waterBottleClean; } } else { int i = FirstEmptySlot(); if (i >= 0 && !SlotIsOccupied(i) && container.contents) { //picking up the item GameObject item = container.RemoveItem(); item.GetComponent <Collectible>().inStorageContainer = false; PickUp(item); } } }