فهرست منبع

修复foot短暂检测不到platform的问题

WGL 4 ماه پیش
والد
کامیت
29be055966
1فایلهای تغییر یافته به همراه6 افزوده شده و 6 حذف شده
  1. 6 6
      ActionTowerDefense/Assets/Scripts/Characters/Foot.cs

+ 6 - 6
ActionTowerDefense/Assets/Scripts/Characters/Foot.cs

@@ -26,7 +26,7 @@ public class Foot : MonoBehaviour
         moveCharacter = rb.transform.GetComponent<MoveCharacter>();
     }
 
-    private void FixedUpdate()
+    private void Update()
     {
         if (trigGroundList.Count == 0)
         {
@@ -41,7 +41,7 @@ public class Foot : MonoBehaviour
         }
         else
         {
-            platform = null;
+            Platform plf = null;
             foreach (var item in trigGroundList)
             {
                 Platform newPlatform = item.GetComponent<Platform>();
@@ -50,19 +50,19 @@ public class Foot : MonoBehaviour
                     if (moveCharacter.transform.position.x < newPlatform.right.position.x 
                         && moveCharacter.transform.position.x > newPlatform.left.position.x)
                     {
-                        if(platform == null)
+                        if(plf == null)
                         {
-                            platform = newPlatform;
+                            plf = newPlatform;
                         }
                         else if (newPlatform.haveMagnetic)
                         {
-                            platform = newPlatform;
+                            plf = newPlatform;
                         }
                         
                     }
                 }
             }
-            
+            platform = plf;
 
             if (platform != null)
             {