public void RemoveFood() { _currentStomchItem = null; _cdwDigestionBar.enabled = false; _image.sprite = null; StomachSlotState = EnumStomachSlotState.Empty; }
public void AddFood(StomachItemDTO stomachItem) { _currentStomchItem = stomachItem; _image.enabled = true; _cdwDigestionBar.enabled = true; _cdwDigestionBar.fillAmount = 0f; _image.sprite = stomachItem.Item.InventorySprite; StomachSlotState = EnumStomachSlotState.HasFood; }
IEnumerator StartDigestion(float digestionTime, StomachItemDTO stomachItem) { float internalCdw = 0f; while (internalCdw <= digestionTime) { internalCdw += Time.deltaTime; stomachItem.DigestionPercent = internalCdw / digestionTime; _stomachUIComponent.UpdateCdwFillAmountDigestionBar(stomachItem); yield return(new WaitForFixedUpdate()); } }
public void AddFood(ItemDTO food) { if (food.Amount > 1 || food.Amount == 0) { Debug.LogError("You can only eat one flower at ounce!"); } if (food.Item.ItemType != EnumItemScriptableType.Flower) { Debug.LogError("You can only eat flowerrs in this world!"); } StomachItemDTO stomachItem = new StomachItemDTO() { Id = Guid.NewGuid(), Item = food.Item, DigestionPercent = 0 }; StomachItemList.Add(stomachItem); _stomachUIComponent.AddFood(stomachItem); StartCoroutine(StartDigestion(food.Item.DigestionTime, stomachItem)); }
public void UpdateCdwFillAmountDigestionBar(StomachItemDTO stomachItem) { _stomachSlotComponentList.FirstOrDefault(e => e.StomachSlotState == EnumStomachSlotState.HasFood && e.StomachItemId == stomachItem.Id).UpdateDigestionBar(stomachItem.DigestionPercent); }
public void AddFood(StomachItemDTO stomachItem) { _stomachSlotComponentList.FirstOrDefault(e => e.StomachSlotState == EnumStomachSlotState.Empty).AddFood(stomachItem); }