示例#1
0
        /// <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();
        }
示例#2
0
        /// <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] Tower 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);
            }
        }