float GetTotal(OnlineShopCartItem givenItem) { float total = 0; OnlineShopCartItem[] items = GetComponentsInChildren <OnlineShopCartItem>() as OnlineShopCartItem[]; foreach (OnlineShopCartItem item in items) { if (item != givenItem) { total += item.price; } } return(total); }
public void RefreshTotalPrice(OnlineShopCartItem givenItem) { float total = GetTotal(givenItem); totalPriceText.text = total.ToString("F2") + "€"; }