Browse Source

修复飞行怪物击落落地后位置信息不对问题

WGL 3 months ago
parent
commit
516cbccd58
1 changed files with 12 additions and 5 deletions
  1. 12 5
      ActionTowerDefense/Assets/Scripts/Characters/AttributeStatus.cs

+ 12 - 5
ActionTowerDefense/Assets/Scripts/Characters/AttributeStatus.cs

@@ -46,6 +46,7 @@ public class AttributeStatus : MonoBehaviour
     private bool haveLandingDamage;
     private int landingDamage;
     private Character landingDamageFrom;
+    private Vector3 startFlyPos;
 
     [TabGroup("Ò×ÉË")]
     [DisplayOnly] public bool haveVulnerable;
@@ -279,13 +280,21 @@ public class AttributeStatus : MonoBehaviour
                             vel = Vector3.zero;
                             if (!foot.haveGravity)
                             {
-                                transform.position = new Vector3(transform.position.x, character.platformPosY, transform.position.z);
+                                character.transform.position = new Vector3(transform.position.x, character.platformPosY, transform.position.z);
+                            }
+                            else
+                            {
+                                character.transform.position = new Vector3(transform.position.x, 0, transform.position.z);
                             }
                             character.ani.Play("weak", 0, 0);
                             character.bodyCollider.layer = character.gameObject.layer;
+                            rb.useGravity = false;
+                            rb.velocity = Vector3.zero;
+                            character.transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, character.platformRotZ);
                             hitState = 1;
                             if (haveLandingDamage)
                             {
+                                //if()
                                 character.BeHit(landingDamage, landingDamageFrom);
                             }
                         }
@@ -308,9 +317,7 @@ public class AttributeStatus : MonoBehaviour
                         }
                         else
                         {
-                            rb.velocity = Vector3.zero;
-                            rb.useGravity = false;
-                            character.transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y,character.platformRotZ); ;
+                            
                             attributeTime -= Time.deltaTime;
                         }
                         break;
@@ -422,7 +429,7 @@ public class AttributeStatus : MonoBehaviour
         rb.AddForce(vec3 * blowUp.force * (1 - resistances.BlowUp), ForceMode.Impulse);
         rb.transform.rotation = Quaternion.Euler(0, 0, 0);
         haveLandingDamage = blowUp.haveLandingDamage;
-        landingDamage = blowUp.landingDamage;
+        startFlyPos = transform.position;
         hitState = 0;
         isFly = false;
         character.ani.Play("hitted", 0, 0);