public void AddItem(ItemsDescription description) { switch (description.itemType) { case ItemType.Normal: AddCorrectItemTypeToJournal(description.normalItemType); break; case ItemType.Acid: AddCorrectItemTypeToJournal(description.acidType); break; case ItemType.Base: AddCorrectItemTypeToJournal(description.baseType); break; case ItemType.Salt: AddCorrectItemTypeToJournal(description.saltType); break; case ItemType.Indicator: AddCorrectItemTypeToJournal(description.indicatorType); break; } }
public void SetpHIndicator(ItemsDescription newIndicator) { //Add the event and raise an event to notify subscribers that pH indicator has changed if (pHIndicator == null || pHIndicator.indicatorType != newIndicator.indicatorType) { pHIndicator = newIndicator; //Set the image in the button SetpHIndicatorImage(newIndicator.PhIndicatorImage); //TODO: Must be changed to reflect the pH use counter to the number of items of same type in the inventory //Increment the pH use counter pHUseCounter = newIndicator.useCount; pHIndicatorName.text = newIndicator.indicatorType.ToString(); pHUseCounterText.text = pHUseCounter.ToString(); if (PHIndicatorChangedEvent != null) { PHIndicatorChangedEvent(); } } else { pHUseCounter += newIndicator.useCount; pHUseCounterText.text = pHUseCounter.ToString(); } }
bool IsItemPresentInTheJournal(ItemsDescription des) { //Get the current items in the journal switch (des.itemType) { case ItemType.Normal: return(CheckWith(des.normalItemType)); break; case ItemType.Acid: return(CheckWith(des.acidType)); break; case ItemType.Base: return(CheckWith(des.baseType)); break; case ItemType.Salt: return(CheckWith(des.saltType)); break; case ItemType.Indicator: return(CheckWith(des.indicatorType)); break; } return(false); }
public void UseItem(ItemBase item) { if (item != null) { Debug.Log("Item is: " + item); ItemsDescription description = item.itemProperties.itemDescription; Corrosion c = GetComponentInParent <Corrosion>(); if (c != null && description != null) { if (description.GetItemType().GetType() == (typeof(AcidsList))) { //Corrode the item based on it's pH value.....Lesser pH, more corrosion //100 will be taken as a reference to calculate corrosion damage to all the platforms Debug.Log("Trying to corrode"); float value = (1 / (float)((description.pHValue) + 1)) * 100; c.Corrode(value); } else if (description.GetItemType().GetType() == (typeof(BasesList))) { //Corrode the item based on it's pH value.....Higher pH, more corrosion //100 will be taken as a reference to calculate corrosion damage to all the platforms int alteratedpH = 7 - (description.pHValue - 7); float value = (1 / ((alteratedpH) + 1)) * 100; c.Corrode(value); } } else { Debug.Log("Dude....There is no corrosion"); } } }
//Populate the descriptions here public static string GetDescription(AcidsList acid, ItemsDescription des) { string result = ""; switch (acid) { case AcidsList.HCl: break; } return(result); }
public void Extract(SelectionObjectData item) { ItemBase i = Extraction.Extract(item.item).GetComponent <ItemBase>(); ItemsDescription des = i.itemProperties.itemDescription; des.GetItemType(); //The extraction will take default information from the prefab object. //must check if the item type is already present. int phVal = des.pHValue; AddItem(i); //invenetory will take care of everything checking for ph if present. //IF the item type is already present, it's pH value in the description data must be checked. //If the pH is same, the extra volume must be added to the existing item slot }
void PassSelection() { for (int i = 0; i < selectedIndices.Count; i++) { if (inventory.slots[selectedIndices[i]].itemStored != null) { ItemsDescription des = inventory.slots[selectedIndices[i]].itemStored.itemProperties.itemDescription; if (des != null) { itemDescriptions.Add(des); } } } if (targetQuestionBox != null) { //Sets the selected items in the question box targetQuestionBox.SetSelectedItems(itemDescriptions); } ToggleActivation(inventory, targetQuestionBox); }
void ItemPickedUp(ItemBase item) { ItemsDescription des = item.GetComponent <ItemsDescription>(); if (des == null) { return; } //Check if the item is already present in the journal bool present = IsItemPresentInTheJournal(des); //Add the item if not. if (!present) { Debug.Log("Item is not present in the journal.....Attempting to add it"); AddItem(des); AddItemDetails(des); } else { Debug.Log("Item is already present in the journal....No need to add again"); } }
//Combine acids and bases....Volume calculation is present public void Combine(SelectionObjectData object1, SelectionObjectData object2) { //Two objects react to get a resultant object System.Enum result = Reactions.React(object1.item, object2.item); //Get the item description from the item manager ItemBase item = ItemManager.instance.itemDictionary[result].GetComponent <ItemBase>(); ItemsDescription description = item.itemProperties.itemDescription; //Perform the volume and pH calculations here. int pH = 9; //TODO: this must be calculated using the formula if (pH != description.pHValue) { //TODO: Assign a new slot in the inventory and add it //TODO: Add new item Description data along with it while adding } //TODO: Check if the item is present in the inventory //If present, compare it with it's slot's item description //If not, add it to a new slot along with the item description information to the slot. }
void AddItemDetails(ItemsDescription des) { //TODO: NEEDED itemsIcons.Add(des.GetComponent<SpriteRenderer>().sprite); itemsDescriptions.Add(des.itemDescription); }