示例#1
0
        /// <summary>
        /// Position the ghost tower at the given pointer
        /// </summary>
        /// <param name="pointerInfo">
        /// The pointer we're using to position the tower
        /// </param>
        /// <param name="hideWhenInvalid">
        /// Optional parameter for configuring if the ghost
        /// is hidden when in an invalid location
        /// </param>
        public void TryMoveGhost(PointerInfo pointerInfo, bool hideWhenInvalid = true)
        {
            if (m_CurrentTower == null)
            {
                throw new InvalidOperationException(
                          "Trying to move the tower ghost when we don't have one");
            }

            UIPointer pointer = WrapPointer(pointerInfo);

            // Do nothing if we're over UI
            if (pointer.overUI && hideWhenInvalid)
            {
                m_CurrentTower.Hide();
                return;
            }
            MoveGhost(pointer, hideWhenInvalid);
        }
示例#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] 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);
            }
        }