public void AddUnit(CreachureStats unit) { if (globalMapUI == null) { globalMapUI = UIGlobalMap.instance; } units.Add(unit); isOnBattleField.Add(false); BattleFieldIndex.Add(0); globalMapUI.AddUnitOnUI(units.Count - 1, unit.icon, isOnBattleField[units.Count - 1], BattleFieldIndex[units.Count - 1]); }
void Awake() { if (map == null) { map = UIGlobalMap.instance; } UICityNameText = Instantiate(Resources.Load("UnitAmountText"), UIGlobalMap.instance.MapObjectElementsPanel.transform) as GameObject; UICityNameText.name = CityName + "Name"; gameObject.GetComponent <MapObject>().GraphicElements.Add(UICityNameText); UICityNameText.GetComponent <TextMeshProUGUI>().text = CityName; }
void Awake() { if (instance == null) { instance = this; } else { Debug.Log("More than 1 instance " + this.GetType().ToString()); Destroy(this); } if (MapObjectElementsPanel == null) { MapObjectElementsPanel = new GameObject(); MapObjectElementsPanel.transform.SetParent(this.transform); } }