private void Awake() { if (!Instance) { Instance = this; } img = GetComponent <Image>(); baseColor = img.color; }
public void AddBonus(int type, Sprite img, float time, Color col) { if (time > 0.0f) { //si le bonus existe déjà, add du temps à l'image if (bonusList.ContainsKey(type) && bonusList[type] != null) { BonusUI obj = bonusList[type]; obj.SetTime(time); } else { if (bonusList.ContainsKey(type) && bonusList[type] == null) { bonusList.Remove(type); } GameObject tmp; tmp = Instantiate(bonusUiPrefab); tmp.transform.SetParent(grid.transform); tmp.GetComponent <BonusUI>().Init(img, time, this, col); bonusList.Add(type, tmp.GetComponent <BonusUI>()); } } }