| | |
| | | return false; |
| | | } |
| | | |
| | | BuyTower(pointer, force, zeroCost); |
| | | |
| | | return true; |
| | | return BuyTower(pointer, force, zeroCost); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// Throws exception when not in a build mode or when tower is not a valid position |
| | | /// </exception> |
| | | /// </summary> |
| | | public void BuyTower(UIPointer pointer, bool force = false, bool zeroCost = false) |
| | | public bool BuyTower(UIPointer pointer, bool force = false, bool zeroCost = false) |
| | | { |
| | | if (!isBuilding) return; |
| | | if (!isBuilding) return false; |
| | | |
| | | // 判断是否格子上重复放置塔防 |
| | | if (!m_CurrentTower || !IsGhostAtValidPosition()) |
| | |
| | | if (!pointer.raycast.HasValue || pointer.raycast.Value.collider == null) |
| | | { |
| | | CancelGhostPlacement(); |
| | | return; |
| | | return false; |
| | | } |
| | | PlaceGhost(pointer); |
| | | } |
| | | return; |
| | | return true; |
| | | } |
| | | |
| | | // 这是判断是否超出了格子 |
| | |
| | | if (!pointer.raycast.HasValue || pointer.raycast.Value.collider == null) |
| | | { |
| | | CancelGhostPlacement(); |
| | | return; |
| | | return false; |
| | | } |
| | | |
| | | int cost = m_CurrentTower.controller.purchaseCost; |
| | |
| | | { |
| | | PlaceGhost(pointer); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /// <summary> |