public void GiveItem(CombinedElement combinedElement) { int numberCorrect = 0; //If the element is mixed if (combinedElement.elementTypes[0] != combinedElement.elementTypes[1]) { if (combinedElement.elementTypes[0] == correctElement1 || combinedElement.elementTypes[0] == correctElement2) { numberCorrect += 1; } if (combinedElement.elementTypes[1] == correctElement1 || combinedElement.elementTypes[1] == correctElement2) { numberCorrect += 1; } } //If the combined element is the same element twice else { if (combinedElement.elementTypes[0] == correctElement1 || combinedElement.elementTypes[0] == correctElement2) { numberCorrect += 1; } } if (numberCorrect == 0) { EmitSadFace(); } if (numberCorrect == 1) { targetFillAmount += oneCorrectPointAmount; SetGrowing(); EmitSmallHeart(); } if (numberCorrect == 2) { targetFillAmount += 2 * oneCorrectPointAmount; targetFillAmount += bonusPointAmount; SetGrowing(); EmitBigHeart(); foundCombo = true; } }
private void OnTriggerStay2D(Collider2D other) { //Pick Up Items if (other.gameObject.CompareTag("Item") && !holdingItem && Input.GetAxis("Fire1") == 1 && dropBufferTimer <= 0.0f && !other.GetComponent <Item>().inAlchemyStation) { isPickUpBufferOn = true; isDropBufferOn = false; dropBufferTimer = dropBufferTimerInit; holdingItem = true; other.GetComponent <Item>().isHeld = true; heldItem = other.GetComponent <Item>(); } //Use Stations if (other.gameObject.CompareTag("Gathering Station")) { inStationArea = true; if (!holdingItem && Input.GetAxis("Fire1") == 1 && !usingStation && stationUseBufferTimer == 0.0f) { stationUseBufferTimer = stationUseBufferTimerInit; usingStation = true; other.GetComponent <Station>().inUse = true; stationBeingUsed = other.GetComponent <Station>(); } } if (other.gameObject.CompareTag("Alchemy Station")) { inStationArea = true; if (Input.GetAxis("Fire1") == 1 && !usingStation && stationUseBufferTimer == 0.0f) { stationUseBufferTimer = stationUseBufferTimerInit; usingStation = true; //other.GetComponent<Station>().inUse = true; stationBeingUsed = other.GetComponent <Station>(); } } //Give Ouroboros Head an Item if (other.gameObject.CompareTag("Ouroboros Head")) { inStationArea = true; if (holdingItem && Input.GetAxis("Fire1") == 1) { if (heldItem is CombinedElement) { CombinedElement item = heldItem as CombinedElement; ouroborosSystem.GiveItem(item); Destroy(item.gameObject); heldItem = null; holdingItem = false; isDropBufferOn = true; pickUpBufferTimer = pickUpBufferTimerInit; isPickUpBufferOn = false; } } } }