コード例 #1
0
 //打开建造升级的模块
 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;
     }
 }
コード例 #2
0
ファイル: Town.cs プロジェクト: NillyTheKid/TheChainsProject
 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>();
 }
コード例 #3
0
 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;
     }
 }
コード例 #4
0
 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);
     }
 }
コード例 #5
0
ファイル: Tower.cs プロジェクト: 369713387/TowerDefenseDemo
 /// <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;
     }
 }
コード例 #6
0
 void Awake()
 {
     myTree = transform.GetComponentInParent <BuildingTree>();
     price  = GetComponentInChildren <Text>();
     if (towerPrefab == null)
     {
         gameObject.SetActive(false);
     }
     else
     {
         price.text = towerPrefab.GetComponent <Price>().price.ToString();
     }
 }
コード例 #7
0
 /// <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();
     }
 }
コード例 #8
0
ファイル: GameManager.cs プロジェクト: Daneelgames/lifehill
 private void Awake()
 {
     instance     = this;
     buildingTree = GetComponent <BuildingTree>();
 }