소스 검색

修复两只胖子头上交叉处会掉下去的问题

wgl 7 달 전
부모
커밋
f7606a312e
2개의 변경된 파일16개의 추가작업 그리고 21개의 파일을 삭제
  1. 10 15
      ActionTowerDefense/Assets/Scripts/Characters/Foot.cs
  2. 6 6
      ActionTowerDefense/Assets/Scripts/Platform.cs

+ 10 - 15
ActionTowerDefense/Assets/Scripts/Characters/Foot.cs

@@ -17,7 +17,7 @@ public class Foot : MonoBehaviour
     public List<GameObject> trigGroundList;
     public BaGuaTrigger myBaGuaTrigger;                                      //×Ô¼º
     public List<BaGuaTrigger> baGuaTrigger = new List<BaGuaTrigger>();       //½ÅÏÂµÄ°ËØÔÅÖ×Ó
-    public bool notOnGiant;
+
 
     private void Update()
     {
@@ -35,7 +35,7 @@ public class Foot : MonoBehaviour
         {
             if (haveGravity)
             {
-                if (rb.velocity.y < 0)
+                if (rb.velocity.y <= 0)
                 {
                     foreach (GameObject i in trigGroundList)
                     {
@@ -49,9 +49,7 @@ public class Foot : MonoBehaviour
                             break;
                         }
                     }
-
                 }
-
             }
             else
             {
@@ -61,10 +59,7 @@ public class Foot : MonoBehaviour
                     rb.GetComponent<MoveCharacter>().velocityAddition = platform.rb.velocity.x;
                 }
             }
-
         }
-
-        
     }
     private void FixedUpdate()
     {
@@ -82,14 +77,14 @@ public class Foot : MonoBehaviour
     {
         if (other.CompareTag("Plane"))
         {
-            if (notOnGiant)
-            {
-                Platform platform = other.gameObject.GetComponent<Platform>();
-                if (platform)
-                {
-                    return;
-                }
-            }
+            //if (notOnGiant)
+            //{
+            //    Platform platform = other.gameObject.GetComponent<Platform>();
+            //    if (platform)
+            //    {
+            //        return;
+            //    }
+            //}
             if (!trigGroundList.Exists(t => t == other.gameObject))
             {
                 trigGroundList.Add(other.gameObject);

+ 6 - 6
ActionTowerDefense/Assets/Scripts/Platform.cs

@@ -13,7 +13,7 @@ public class Platform : MonoBehaviour
             return feet.Count > 0;
         }
     }
-    public float edgeDistance;
+    //public float edgeDistance;
 
     public bool canDown;
     public BaGuaTrigger myBaGuaTrigger;                                  //×Ô¼º
@@ -23,12 +23,12 @@ public class Platform : MonoBehaviour
     {
         
         Foot foot = other.GetComponent<Foot>();
-        if (foot != null && foot.transform.parent.gameObject.layer != 8 && !foot.notOnGiant)
+        if (foot != null && foot.transform.parent.gameObject.layer != 8)
         {
-            if (Mathf.Abs(foot.transform.position.x - transform.position.x) > edgeDistance)
-            {
-                return;
-            }
+            //if (Mathf.Abs(foot.transform.position.x - transform.position.x) > edgeDistance)
+            //{
+            //    return;
+            //}
             if(!foot.trigGroundList.Exists(t=>t == gameObject))
             {
                 foot.trigGroundList.Add(gameObject);