PotionElement GetRightNeighbourOf(PotionElement element) { int pos = potions.IndexOf(element); if (pos + 1 > potions.Count - 1) { return(potions[0]); } else { return(potions[pos + 1]); } }
PotionElement GetLeftNeighbourOf(PotionElement element) { int pos = potions.IndexOf(element); if (pos == 0) { return(potions[potions.Count - 1]); } else { return(potions[pos - 1]); } }
void Start() { if (potions.Count == 0) { Debug.LogError("Potion Selector Elements not assigned!"); } mappedPotions = new Hashtable(); //setup foreach (PotionElement potion in potions) { mappedPotions.Add(potion.type, potion); potion.SetEmpty(emptyPotion); potion.SetCount(0); potion.image.transform.localScale = initialScale; } selectedElement = potions[0]; selectedElement.image.transform.localScale = selectedScale; instance = this; }