//using a generic OnClick() function to link the Button component's commands to this script. Useful for Computer & Touch Devices. public void OnClick() { //if our current ingredient IS the ingredient held, do NOTHING if (_slotIngredient.IngredientData == _craftingController.CurrIngredient) { return; } //otherwise (our ingredient is different than _crafting.controller's, make the swap Ingredients_sObj heldIngredient = _craftingController.CurrIngredient; if (heldIngredient.Quantity != 0) //>0 would exclude our -1 values, which are our Infinite values { //give one back to previous "current" ingredient, _slotIngredient.IngredientData.IncreaseQuantity(1); //set our ingredient to the new Ingredient_sObj, then take 1 away _slotIngredient.SetIngredient(heldIngredient); heldIngredient.DecreaseQuantity(1); } else { //if our ingredient IS == 0, we have run out of a natural ingredient type //we force the _craftingController to "drop" the ingredient and return to NULL _craftingController.HoldIngredient(_nullIngredient); Debug.Log("Cannot use " + heldIngredient.Name); } }
public void SetIngredient(Ingredients_sObj ingredient) { _currentSold = 0; title.text = ingredient.Name; price.text = ingredient.Cost.ToString(); itemImage.sprite = ingredient.Image; selfIngredient = ingredient; _sellLimit = _sellFoundation - ingredient.Cost; }
public void HoldIngredient(Ingredients_sObj ingredient) { //called from the HotBar script, tells the controller to remember the data passed from the HotBar's _ingred CurrIngredient = ingredient; }
public void SetIngredient(Ingredients_sObj ingred) { display.SetIngredient(ingred); }
public void SetIngredientHistory(Ingredients_sObj ingred) { _ingredientHistory = ingred; CreateHistorySlots(); UpdateHistories(); }
override protected void Awake() { _nullIngredient = _slotIngredient.IngredientData; }
public void SetIngredient(Ingredients_sObj inputIngredient) { _ingredient = inputIngredient; Display(); }
public void SetIngredient(Ingredients_sObj ingredient) { _ingredientData = ingredient; UpdateDisplaySprite(); }