コード例 #1
0
ファイル: GameUIYfb.cs プロジェクト: Yangfb91/yfb_fp_20200423
        /// <summary>
        /// Creates and hides the tower and shows the buildInfoUI
        /// </summary>
        /// <exception cref="ArgumentNullException">
        /// Throws exception if the <paramref name="towerToBuild"/> is null
        /// </exception>
        void SetUpGhostTower([NotNull] TowerYfb towerToBuild)
        {
            if (towerToBuild == null)
            {
                throw new ArgumentNullException("towerToBuild");
            }

            m_CurrentTower = Instantiate(towerToBuild.towerGhostPrefab);
            m_CurrentTower.Initialize(towerToBuild);
            m_CurrentTower.Hide();

            //activate build info
            if (buildInfoUI != null)
            {
                buildInfoUI.Show(towerToBuild);
            }
        }
コード例 #2
0
ファイル: GameUIYfb.cs プロジェクト: Yangfb91/yfb_fp_20200423
        /// <summary>
        /// Cancel placing the ghost
        /// </summary>
        public void CancelGhostPlacement()
        {
            if (!isBuilding)
            {
                throw new InvalidOperationException("Can't cancel out of " +
                                                    "ghost placement when not in the building state.");
            }

            if (buildInfoUI != null)
            {
                buildInfoUI.Hide();
            }

            Destroy(m_CurrentTower.gameObject);
            m_CurrentTower = null;
            SetState(State.Normal);
            DeselectTower();
        }