//打开建造升级的模块 private void OpenBuildingTree() { if (buildingTreePrefab != null) { activeBuildingTree = Instantiate <GameObject>(buildingTreePrefab, canvas.transform).GetComponent <BuildingTree>(); activeBuildingTree.transform.position = Camera.main.WorldToScreenPoint(transform.position); activeBuildingTree.myTower = this; bodyCollider.enabled = false; } }
void Awake() { _BuildingTree = GetComponent <BuildingTree>(); _BuildQueue = new List <BuildingTreeNode>(); _Garrison = new GC_Army(); _Garrison.Position = transform.position; _TrainableUnits = new List <UnitData>(); _RecruitmentQueue = new Queue <GC_Unit>(); _RecruitsPerTurn = new List <int>(); }
private void OpenBuildingTree() { if (buildingTreePrefab != null) { activeBuildingTree = Instantiate <GameObject>(buildingTreePrefab, gameObject.transform).GetComponent <BuildingTree>(); activeBuildingTree.transform.position = gameObject.transform.position; activeBuildingTree.myTower = this; bodyCollider.enabled = false; } }
void Start() { _BuildQueue = new List <BuildingTreeNode>(); _Tree = GetComponent <BuildingTree>(); _Towns = new List <Town>(); foreach (var town in gameObject.GetComponentsInChildren <Town>()) { _Towns.Add(town); town.SetRegion(this); } }
/// <summary> /// Opens the building tree. /// </summary> private void OpenBuildingTree() { if (buildingTreePrefab != null) { // Create building tree activeBuildingTree = Instantiate <GameObject>(buildingTreePrefab, canvas.transform).GetComponent <BuildingTree>(); // Set it over the tower activeBuildingTree.transform.position = Camera.main.WorldToScreenPoint(transform.position); activeBuildingTree.myTower = this; // Disable tower raycast bodyCollider.enabled = false; } }
void Awake() { myTree = transform.GetComponentInParent <BuildingTree>(); price = GetComponentInChildren <Text>(); if (towerPrefab == null) { gameObject.SetActive(false); } else { price.text = towerPrefab.GetComponent <Price>().price.ToString(); } }
/// <summary> /// Awake this instance. /// </summary> void Awake() { // Get building tree from parent object myTree = transform.GetComponentInParent <BuildingTree>(); price = GetComponentInChildren <Text>(); Debug.Assert(price && myTree, "Wrong initial parameters"); if (towerPrefab == null) { // If this icon have no tower prefab - hide icon gameObject.SetActive(false); } else { // Display tower price price.text = towerPrefab.GetComponent <Price>().price.ToString(); } }
private void Awake() { instance = this; buildingTree = GetComponent <BuildingTree>(); }