public void CreateUIComponent(Assets.ItemAndStats <GameMode> instance) { var gameModeItemTemplate = Resources.Load("GameMode item-template"); GameObject itemInstance = Instantiate(gameModeItemTemplate, this.gameObject.transform) as GameObject; UI_ChooseGameModeItem ui_gameModeItemChooser = itemInstance.AddComponent <UI_ChooseGameModeItem>(); ui_gameModeItemChooser.gameModeToChoose = instance.item; itemInstance.AddComponent <UI_ItemChooser>(); itemInstance.transform.GetChild(0).GetChild(0).GetComponent <TextMeshProUGUI>().text = instance.item.GetName(); }
public void UpdateUIComponent<T>(T item) where T : Item { GameObject carGameObjectToUpdate = car_ui_gmComponents.First(x => x.Key.GetID() == item.GetID()).Value; Car carToUpdate = car_ui_gmComponents.First(x => x.Key.GetID() == item.GetID()).Key; car_ui_gmComponents.Remove(carToUpdate); Destroy(carGameObjectToUpdate); Assets.ItemAndStats<Car> itemToUpdate = new Assets.ItemAndStats<Car>(); itemToUpdate.item = carToUpdate; itemToUpdate.isBought = true; CreateUIComponent(itemToUpdate); }
public void CreateUIComponent(Assets.ItemAndStats<Car> instance) { var item_template_prefab = Resources.Load("Car item-template"); GameObject gameObject_instance = Instantiate(item_template_prefab, this.gameObject.transform) as GameObject; if (instance.isBought) { CreateBoughtItem(instance.item, ref gameObject_instance); } else CreatePurchasableItem(instance.item, ref gameObject_instance); gameObject_instance.transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = instance.item.GetName(); car_ui_gmComponents.Add(instance.item, gameObject_instance); }
public void UpdateUIComponent <T>(Assets.ItemAndStats <T> instance) where T : Item { throw new System.NotImplementedException(); }
public void CreateUIComponent(Assets.ItemAndStats <Road> instance) { throw new System.NotImplementedException(); }