Explorar el Código

修复抗性值为1的时候会直接解除状态

wgl hace 6 meses
padre
commit
207131af43

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

@@ -189,7 +189,7 @@ public class AttributeStatus : MonoBehaviour
                 switch (hitState) 
                 {
                     case 0:
-                        if(rb.velocity.magnitude > 0)
+                        if(rb.velocity.magnitude >= 0)
                         {
                             Vector3 vel = rb.velocity;
                             if (foot.TrigGround && vel.y <= 0.01f)
@@ -205,6 +205,12 @@ public class AttributeStatus : MonoBehaviour
                             }
                             rb.velocity = vel;
                         }
+                        else
+                        {
+                            rb.velocity = Vector3.zero;
+                            character.ani.Play("weak", 0, 0);
+                            hitState = 1;
+                        }
                         break;
                     case 1:
                         //Ñ£ÔÎ״̬

+ 16 - 0
ActionTowerDefense/Assets/Scripts/Characters/MoveCharacter.cs

@@ -230,10 +230,18 @@ public class MoveCharacter : Character
                     /*¿ØÖÆ*/
                     //Ư¸¡
                     case AttackEffect.FloatState:
+                        if (attributeStatus.resistances.Float == 1)
+                        {
+                            break;
+                        }
                         attributeStatus.PriorityOrder(SpecialState.FloatState, attackInfo, attackFrom);
                         break;
                     //»÷·É
                     case AttackEffect.BlowUp:
+                        if(attributeStatus.resistances.BlowUp == 1)
+                        {
+                            break;
+                        }
                         if (rb.useGravity)
                         {
                             attributeStatus.PriorityOrder(SpecialState.BlownUp, attackInfo, attackFrom);
@@ -241,6 +249,10 @@ public class MoveCharacter : Character
                         break;
                     //»÷Âä
                     case AttackEffect.ShotDown:
+                        if(attributeStatus.resistances.ShotDown == 1)
+                        {
+                            break;
+                        }
                         if (!rb.useGravity)
                         {
                             attributeStatus.PriorityOrder(SpecialState.ShotDown, attackInfo, attackFrom);
@@ -248,6 +260,10 @@ public class MoveCharacter : Character
                         break;
                     //»÷ÔÎ
                     case AttackEffect.Weak:
+                        if (attributeStatus.resistances.Weak == 1)
+                        {
+                            break;
+                        }
                         attributeStatus.PriorityOrder(SpecialState.Weak, attackInfo, attackFrom);
                         break;