public void Init(Dictionary <int, DATAFood> DictFood) { // :: Get this.dictFood = DictFood; // :: Set DATAFood food = this.dictFood[(int)eFood]; this.IMAGE_Food.sprite = Resources.Load <Sprite>(PATH_RESOURCES + food.sprite_name); this.TEXT_Price.text = food.price.ToString(); }
// : Update public void UpdateButton_Foods(int currentGold) { foreach (Transform child in this.transform) { // :: Get InKinder_PF_Food food = child.GetComponent <InKinder_PF_Food>(); DATAFood foodData = this.dictFood[(int)food.eFood]; Button foodButton = child.GetComponent <Button>(); // :: Set if (currentGold < foodData.price) { foodButton.interactable = false; } else { foodButton.interactable = true; } } }
private void ButtonScenario_Foods(Enum.eFood eFood) { // :: Get DATAFood food = this.minister.DATASecretary.DictFood[(int)eFood]; // :: Pay bool check = this.minister.PLAYERSecretary.PayGold(food.price); if (check) { // :: UI this.Scenario_Update(); this.UIChief.ShowField_Food(false); this.UIChief.CanTouchButton_All(false); // :: GO this.GOChief.Show_Food(eFood); this.GOChief.Blink_Alert(); // :: Animation this.GOChief.Set_EndEat(() => { // :: GO this.GOChief.Hide_Food(); // :: Status this.curZombie.Add_CurCalmDown(food.calm_down); this.Scenario_Update(); }); this.GOChief.Set_EndAnimation(() => { // :: UI this.UIChief.CanTouchButton_All(true); }); this.Do_NextSeconds(() => { this.GOChief.DoAnimation_Zombie(Enum.eAnimation.EAT); }, 0.5f); } }