From 5caa573ce573fa0427845b2224b3a6005781e80e Mon Sep 17 00:00:00 2001 From: chenxin <chenxin6991@163.com> Date: Tue, 24 Nov 2020 11:33:40 +0800 Subject: [PATCH] 放置丢塔问题 --- Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs b/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs index e74ef6b..ab5cf5a 100644 --- a/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs +++ b/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs @@ -1363,9 +1363,7 @@ return false; } - BuyTower(pointer, force, zeroCost); - - return true; + return BuyTower(pointer, force, zeroCost); } /// <summary> @@ -1573,9 +1571,9 @@ /// 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()) @@ -1607,11 +1605,11 @@ if (!pointer.raycast.HasValue || pointer.raycast.Value.collider == null) { CancelGhostPlacement(); - return; + return false; } PlaceGhost(pointer); } - return; + return true; } // 这是判断是否超出了格子 @@ -1619,7 +1617,7 @@ if (!pointer.raycast.HasValue || pointer.raycast.Value.collider == null) { CancelGhostPlacement(); - return; + return false; } int cost = m_CurrentTower.controller.purchaseCost; @@ -1630,6 +1628,8 @@ { PlaceGhost(pointer); } + + return true; } /// <summary> -- Gitblit v1.9.1