From 4950827515e3479d594ce5487a68febd6af870cb Mon Sep 17 00:00:00 2001
From: wangguan <wangguan@kt007.com>
Date: Fri, 11 Dec 2020 16:23:28 +0800
Subject: [PATCH] 把BuyTower中的MoveGhost(pointer)删了

---
 Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs b/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
index 00c0ff2..89510c1 100644
--- a/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
+++ b/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
@@ -643,7 +643,7 @@
 
             if ((m_GridPosition.x >= 0) && (m_GridPosition.y >= 0))
             {
-                if (m_CurrentArea.isFreeAtackPos(m_GridPosition.x, m_GridPosition.y))
+                if ((m_CurrentArea as TowerPlacementGridEndless).isFreeAtackPos(m_GridPosition.x, m_GridPosition.y))
                 {
                     return true;
                 }
@@ -1119,7 +1119,7 @@
                 {
                     if (m_GridPosition.y == 0 || m_GridPosition.y == 1)
                     {
-                        Debug.Log("未上阵区域,不管有没有塔,都强行吸附");
+                        //Debug.Log("未上阵区域,不管有没有塔,都强行吸附");
                         (m_CurrentArea as TowerPlacementGridEndless).CheckCanPlaceUpdate(m_GridPosition.x, m_GridPosition.y, true, "");
 
                         m_CurrentTower.transform.position = (m_CurrentArea as TowerPlacementGridEndless).GridToWorld(m_GridPosition, m_CurrentTower.controller.dimensions);
@@ -1301,11 +1301,14 @@
             // 判断目标位置是否有Tower且类型和等级一致,如果没有,则GhostTower删除,原Tower显示。
             if (isValidateCombineTarget(pointerInfo))
             {
+                //Debug.Log("isValidateCombineTarget");
                 TryPlaceTower(pointerInfo);
                 EndlessRandomTower.instance.UpdateDescDisplay();
             }
             else if (isFreeAttackGrid(pointerInfo))
             {
+                //Debug.Log("isFreeAttackGrid:" + m_GridPosition);
+
                 if (!TryPlaceTower(pointerInfo, false))
                 {
                     CancelPlaceTower(pointerInfo);
@@ -1326,6 +1329,8 @@
             }
             else if (EndlessLevelManager.instanceExists && IsSubstitute(pointerInfo))
             {
+                //Debug.Log("IsSubstitute");
+
                 CheckCanChangePos(pointerInfo);
                 if (EndlessUIStart.instance.GameStartTime >= JsonDataCenter.DOUBLE_GEM_TIME)
                     UpgradeAllTowerMinLevel(1);
@@ -1733,6 +1738,7 @@
         {
             if (!isBuilding) return false;
 
+            //Debug.Log("开始造塔" + m_GridPosition);
             // 判断是否格子上重复放置塔防
             if (!m_CurrentTower || !IsGhostAtValidPosition())
             {
@@ -1765,6 +1771,7 @@
                         CancelGhostPlacement();
                         return false;
                     }
+                    
                     PlaceGhost(pointer);
                 }
                 return true;
@@ -2627,6 +2634,7 @@
                 return;
             }
             m_GridPosition = m_CurrentArea.WorldToGrid(raycast.point, m_CurrentTower.controller.dimensions);
+            //Debug.Log("修改了m_GridPosition:" + m_GridPosition);
             TowerFitStatus fits = m_CurrentArea.Fits(m_GridPosition, m_CurrentTower.controller.dimensions);
 
             m_CurrentTower.Show();
@@ -2677,10 +2685,12 @@
         /// <exception cref="InvalidOperationException">If we're not in the correct state</exception>
         protected void PlaceGhost(UIPointer pointer)
         {
-            MoveGhost(pointer);
+            //MoveGhost(pointer);
 
             if (m_CurrentArea != null)
             {
+                //Debug.Log("开始检测PlaceGhost:" + m_GridPosition);
+
                 TowerFitStatus fits = m_CurrentArea.Fits(m_GridPosition, m_CurrentTower.controller.dimensions);
 
                 if (fits == TowerFitStatus.Fits)
@@ -2843,10 +2853,6 @@
 
             m_CurrentTower = Instantiate(towerToBuild.towerGhostPrefab);
             m_CurrentTower.Initialize(towerToBuild);
-            Debug.Log("SetUpGhostTower:" + towerToBuild.gridPosition);
-
-            Debug.Log("SetUpGhostTower:" + m_CurrentTower.controller.gridPosition);
-
         }
 
         /// <summary>

--
Gitblit v1.9.1