Răsfoiți Sursa

击飞、击落、击晕优先级

wgl 6 luni în urmă
părinte
comite
d0bd7633b1

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

@@ -16,10 +16,9 @@ public class AttributeStatus : MonoBehaviour
     {
         Null = -1,
         Float = 0,
-        BlownUp = 1,
-        ShotDown = 2,
+        ShotDown = 1,
+        BlownUp = 2,
         Stun = 3,
-        Weak = 3,
         Coma = 4,
     }
     public List<SpecialState> curSpecialStates = new List<SpecialState> {SpecialState.Null};    //[0]存放控制类状态,没有则为SpecialState.Null,[1:]存放其他状态
@@ -63,7 +62,12 @@ public class AttributeStatus : MonoBehaviour
                 else
                 {
                     //眩晕状态
-                    if(strikeStunTime > 0)
+                    if (strikeStunTime <= 0)
+                    {
+                        curSpecialStates[0] = SpecialState.Null;
+                        character.ChangeState(CharacterState.Idle);
+                    }
+                    else
                     {
                         rb.velocity = Vector3.zero;
                         strikeStunTime -= Time.deltaTime;
@@ -97,6 +101,7 @@ public class AttributeStatus : MonoBehaviour
                         rb.useGravity = false;
                         if (character.AdjustHeight())
                         {
+                            curSpecialStates[0] = SpecialState.Null;
                             character.ChangeState(CharacterState.Idle);
                         }
                     }
@@ -109,7 +114,12 @@ public class AttributeStatus : MonoBehaviour
                 break;
             //眩晕
             case SpecialState.Stun:
-                if (strikeStunTime > 0)
+                if (strikeStunTime <= 0)
+                {
+                    curSpecialStates[0] = SpecialState.Null;
+                    character.ChangeState(CharacterState.Idle);
+                }
+                else
                 {
                     rb.velocity = Vector3.zero;
                     strikeStunTime -= Time.deltaTime;
@@ -123,6 +133,10 @@ public class AttributeStatus : MonoBehaviour
     {
         if (rb.useGravity)
         {
+            if(curSpecialStates[0]!=SpecialState.Null && curSpecialStates[0] < SpecialState.BlownUp)
+            {
+                return;
+            }
             strikeStunTime = blowUp.time;
             Vector3 vec3 = blowUp.dir.normalized;
             if(dir < 0)
@@ -140,6 +154,10 @@ public class AttributeStatus : MonoBehaviour
     {
         if (!rb.useGravity)
         {
+            if (curSpecialStates[0] != SpecialState.Null && curSpecialStates[0] < SpecialState.ShotDown)
+            {
+                return;
+            }
             strikeStunTime = shotDown.time;
             Vector3 vec3 = shotDown.dir.normalized;
             if (dir < 0)
@@ -157,6 +175,10 @@ public class AttributeStatus : MonoBehaviour
     //受到击晕
     public void AddStun(AttackInfo.Stun stun)
     {
+        if (curSpecialStates[0] != SpecialState.Null && curSpecialStates[0] < SpecialState.Stun)
+        {
+            return;
+        }
         strikeStunTime = stun.time;
         curSpecialStates[0] = SpecialState.Stun;
         character.ChangeState(CharacterState.SpecialStatus);