public ConsumableObject(ConsumableObject obj) { Id = obj.Id; Name = obj.Name; Description = obj.Description; Icon = obj.Icon; IsStackable = obj.IsStackable; }
// Callback whenever we enter a "trigger", which is a collder on an object with "isTrigger" checked. private void OnCollisionEnter2D(Collision2D collision) { ConsumableObject consumable = collision.collider.GetComponent <ConsumableObject>(); if (consumable) { consumable.TryBeConsumedBy(this); } }
public void EatOther(ConsumableObject obj, Action onAnimationComplete) { PauseTouchInput(); var letter = obj as ConsumableLetter; if (letter != null) { ModifyProficiency(letter.Letter, -1); } Destroy(obj.gameObject); Animator.ReactNegatively(onComplete: ResumeTouchAfterAnimation(onAnimationComplete)); }
public void UseItem0(ConsumableObject item) { GameMaster.PartyStats0.GetStat <Stat_Vital>(Base_Stat_Type.HP).StatCurrentValue += item.restoreHealthValue; GameMaster.PartyStats0.GetStat <Stat_Vital>(Base_Stat_Type.MP).StatCurrentValue += item.restoreSkillValue; _system.Inventory.RemoveItem(_system.selectedOption, 1); _system.itemsDisplayed[_system.Inventory.Container.Items[_system.selectedOption]].GetComponentInChildren <TextMeshProUGUI>().text = _system.Inventory.GetAmount(_system.selectedOption).ToString("n0"); _system.miniStats1.UpdateStats(); _system.IP_Cursor.transform.position = new Vector2(-1000, 0); Debug.Log(item + " was used"); }
void ConsumeObject(ConsumableObject consumedObject) { _objectsInActivity.Remove(consumedObject); var letter = consumedObject as ConsumableLetter; if (letter != null && _requestedLetter.Letter == letter.Letter) { HandleCorrectLetter(letter); } else { HandleWrongLetter(consumedObject); } }
void ConsumeObject(ConsumableObject consumedObject) { var letter = consumedObject as ConsumableLetter; if (IsRealLetter(letter)) { _remainingRealLetters--; _realLettersEaten++; Ressi.EatLetter(letter, TryCompleteActivity); } else { _nonLettersEaten++; Ressi.EatOther(consumedObject, TryCompleteActivity); } }
// Spotřebuje předmět ve slotu private void ConsumeItemInSlot(InventorySlot inventorySlot) { bool consumed = false; if (inventorySlot.ItemObject.type == ItemType.Consumable) // ADD more categories { ConsumableObject consumable = (ConsumableObject)inventorySlot.ItemObject; consumed = _player.RestoreHealth(consumable.healthRegen); } if (consumed) { GameObject slot = _slotHolder.transform.GetChild(inventorySlot.SlotHolderChildPosition).gameObject; if (_playerInventoryContainer.RemoveItem(inventorySlot.ItemObject.itemID)) { slot.SetActive(false); if (_playerInventoryContainer.Slots.Count > 0) { DisplayInfo(_playerInventoryContainer.Slots[0].ItemObject.itemID); } } else { if (inventorySlot.Amount > 1) { slot.GetComponentInChildren <TextMeshProUGUI>().enabled = true; slot.GetComponentInChildren <TextMeshProUGUI>().text = inventorySlot.Amount.ToString(); } else { slot.GetComponentInChildren <TextMeshProUGUI>().enabled = false; } } } }
private void OnTriggerEnter2D(Collider2D collider) { ExitPortal portal = collider.GetComponent <ExitPortal>(); if (portal) { AudioController.instance.PlayPortalSound(); GameController.instance.PortalToScene(portal.sceneToLoad); } BurnableObject burnable = collider.GetComponent <BurnableObject>(); if (burnable) { burnable.TryBeBurnedBy(this); } ConsumableObject consumable = collider.GetComponent <ConsumableObject>(); if (consumable) { consumable.TryBeConsumedBy(this); } }
void HandleWrongLetter(ConsumableObject consumedObject) { Ressi.EatOther(consumedObject, onAnimationComplete: PrintRequestedLetter); }