コード例 #1
0
        /// <summary>
        /// Spawns a single build area cell.
        /// </summary>
        /// <param name="xPos">The x local position</param>
        /// <param name="zPos">The z local position</param>
        private void SpanwBuildAreaCell(Plot plot, FieldPlot prefab, Transform parent)
        {
            FieldPlot newCell = Instantiate(prefab);

            //Need to set the parent to this build generator
            newCell.transform.SetParent(parent);
            //Then set its local position based off parent. Y is zero for now.
            newCell.transform.localPosition = new Vector3(plot.xPos, 0, plot.zPos);

            newCell.SetUpPlot(plot.typeOfPlot);
        }
コード例 #2
0
 public void TurnOnTowerMenu(FieldPlot plot)
 {
     if (cardContrainer.childCount < 1)
     {
         foreach (Tower tower in allBuildableTowers)
         {
             TowerInfoCard newCard = Instantiate(towerInfoCardPrefab);
             newCard.transform.SetParent(cardContrainer);
             newCard.transform.localScale = new Vector3(1, 1, 1);
             newCard.AssignTowerToCard(this, tower);
         }
     }
     selectedFieldPLot = plot;
     towerMenu.SetActive(true);
 }