Kaynağa Gözat

主角站在胖子上可以被胖子带着移动

LAPTOP-OM1V99U2\永远de小亡灵 1 yıl önce
ebeveyn
işleme
6ab61e45a3

+ 2 - 2
ActionTowerDefense/Assets/Scripts/Foot.cs

@@ -28,7 +28,7 @@ public class Foot : MonoBehaviour
             {
                 rb.useGravity = true;
                 haveGravity = true;
-                rb.GetComponent<MoveCharacter>().velocityAddition = Vector3.zero;
+                rb.GetComponent<MoveCharacter>().velocityAddition = 0;
             }
         }
         else
@@ -58,7 +58,7 @@ public class Foot : MonoBehaviour
                 Platform platform = trigGroundList[0].GetComponent<Platform>();
                 if (platform != null)
                 {
-                    rb.GetComponent<MoveCharacter>().velocityAddition = rb.velocity;
+                    rb.GetComponent<MoveCharacter>().velocityAddition = platform.rb.velocity.x;
                 }
             }
 

+ 1 - 1
ActionTowerDefense/Assets/Scripts/MoveCharacter.cs

@@ -88,7 +88,7 @@ public class MoveCharacter : Character
     public float soulStartSpeed = 1f;
     public bool isInvisible;
     public float invisibleTime;
-    public Vector3 velocityAddition;
+    public float velocityAddition;
 
     private void Awake()
     {

+ 15 - 6
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -331,6 +331,7 @@ public class PlayerController : MoveCharacter
 
     private void Update()
     {
+
         //if (Input.GetKeyDown(KeyCode.LeftShift))
         //{
         //    isClickBtnRush = true;
@@ -393,6 +394,7 @@ public class PlayerController : MoveCharacter
                 ChangeMat(1);
             }
         }
+
     }
 
 
@@ -862,6 +864,7 @@ public class PlayerController : MoveCharacter
                 {
                     break;
                 }
+                rb.velocity = Vector3.right * velocityAddition;
                 break;
             case CharacterState.Run:
                 if (CheckPlayerChangeState(CharacterState.Run))
@@ -877,11 +880,11 @@ public class PlayerController : MoveCharacter
                 {
                     if (leftDir.x > 0.3f)
                     {
-                        rb.velocity = Vector3.right * moveSpeed;
+                        rb.velocity = new Vector3(moveSpeed+velocityAddition,0,0);
                     }
                     else if (leftDir.x < -0.3f)
                     {
-                        rb.velocity = Vector3.left * moveSpeed;
+                        rb.velocity = new Vector3(-moveSpeed + velocityAddition,0,0);
                     }
                 }
 
@@ -1187,6 +1190,8 @@ public class PlayerController : MoveCharacter
                         break;
                     }
                 }
+                rb.velocity = Vector3.right * velocityAddition;
+               
                 break;
             case CharacterState.Rush:
                 if (rushTime <= 0)
@@ -1279,6 +1284,7 @@ public class PlayerController : MoveCharacter
                     ChangeState(CharacterState.Idle);
                     break;
                 }
+                rb.velocity = Vector3.right * velocityAddition;
                 break;
             case CharacterState.PullRope:
 
@@ -1353,6 +1359,7 @@ public class PlayerController : MoveCharacter
             mp = 0;
         }
         uiMp.Show(mp, totalMp);
+
     }
     public void PlayerDie()
     {
@@ -1493,7 +1500,8 @@ public class PlayerController : MoveCharacter
                 aniCollider.Play("NotAttack", 1, 0);
                 break;
             case CharacterState.Summon:
-                rb.isKinematic = false;
+                //rb.isKinematic = false;
+                rb.useGravity = false;
                 break;
             case CharacterState.Transfiguration:
                 rb.isKinematic = false;
@@ -1526,7 +1534,7 @@ public class PlayerController : MoveCharacter
                 {
                     ani.Play("idle", 0, 0);
                 }
-                velocity = Vector3.zero;
+                velocity = Vector3.right * velocityAddition;
                 //animalAni.SetInteger("state", (int)PlayerState.Idle);
                 break;
             case CharacterState.Run:
@@ -1569,8 +1577,9 @@ public class PlayerController : MoveCharacter
             case CharacterState.Summon:
                 aniCollider.Play("Summon", 0, 0);
                 ani.Play("summon", 0, 0);
-                velocity = Vector3.zero;
-                rb.isKinematic = true;
+                velocity = Vector3.right * velocityAddition;
+                //rb.isKinematic = true;
+                rb.useGravity = true;
                 break;
             case CharacterState.Transfiguration:
                 isTransfiguration = true;