Browse Source

修复落地后再次击落有落地伤害问题

wgl 5 months ago
parent
commit
ad7a2c3c8d

+ 7 - 4
ActionTowerDefense/Assets/Scripts/Characters/AttributeStatus.cs

@@ -124,7 +124,7 @@ public class AttributeStatus : MonoBehaviour
                         {
                             break;
                         }
-                        if (!character.canFly)
+                        if (!character.nowCanFly)
                         {
                             if (PriorityOrder(SpecialState.BlownUp, attackInfo.blowUp.ControlOrder))
                             {
@@ -138,7 +138,7 @@ public class AttributeStatus : MonoBehaviour
                         {
                             break;
                         }
-                        if (character.canFly)
+                        if (character.nowCanFly)
                         {
                             if (PriorityOrder(SpecialState.ShotDown, attackInfo.shotDown.ControlOrder))
                             {
@@ -271,7 +271,7 @@ public class AttributeStatus : MonoBehaviour
                         break;
                     case 0:
                         Vector3 vel = rb.velocity;
-                        if (foot.TrigGround && vel.y <= 0.01f)
+                        if (isFly && foot.TrigGround && vel.y <= 0.01f)
                         {
                             vel = Vector3.zero;
                             character.ani.Play("weak", 0, 0);
@@ -285,6 +285,7 @@ public class AttributeStatus : MonoBehaviour
                         {
                             vel.x -= decelerationRatioX * Time.deltaTime;
                             vel.y -= decelerationRatioY * Time.deltaTime;
+                            isFly = true;
                         }
                         rb.velocity = vel;
                         break;
@@ -293,7 +294,7 @@ public class AttributeStatus : MonoBehaviour
                         if (attributeTime <= 0)
                         {
                             character.isAdjustHeight = 1;
-                            isFly = true;
+                            character.nowCanFly = character.canFly;
                             OutSpecialState();
                         }
                         else
@@ -412,6 +413,7 @@ public class AttributeStatus : MonoBehaviour
         haveLandingDamage = blowUp.haveLandingDamage;
         landingDamage = blowUp.landingDamage;
         hitState = 0;
+        isFly = false;
         character.ani.Play("hitted", 0, 0);
     }
 
@@ -441,6 +443,7 @@ public class AttributeStatus : MonoBehaviour
         character.ani.Play("hitted", 0, 0);
         haveLandingDamage = shotDown.haveLandingDamage;
         landingDamage = shotDown.landingDamage;
+        character.nowCanFly = false;
 
         hitState = 0;
         isFly = false;

+ 2 - 0
ActionTowerDefense/Assets/Scripts/Characters/Character.cs

@@ -91,6 +91,7 @@ public class Character : MonoBehaviour
     public bool isBeHitBySummonAttack;
     public bool showInjuryNum;      //伤害跳字开关
     public bool canFly = false;
+    [HideInInspector]public bool nowCanFly; //当前是否能飞行
 
     [Header("状态显示")]
     public GameObject statePre;
@@ -145,6 +146,7 @@ public class Character : MonoBehaviour
 
         //血量重置
         hp = totalHp;
+        nowCanFly = canFly;
         uiHp.Show(hp, totalHp);
         ChangeState(CharacterState.Idle);