Quellcode durchsuchen

修复了塔攻击会报错的问题,修复了冲刺条满的时候松开冲刺键才扣能量的问题

WGL vor 2 Monaten
Ursprung
Commit
6e1e431ba4

+ 13 - 10
ActionTowerDefense/Assets/Scripts/Characters/HitFeedbackSystem.cs

@@ -94,7 +94,6 @@ public class HitFeedbackSystem : MonoBehaviour
             canFreeze = false;
             if (!isFreeze)
             {
-                HitFeedbackSystem hitFeedbackSystem = (attackFrom as MoveCharacter).hitFeedbackSystem;
                 origRC = character.rb.constraints;
                 velocity = character.rb.velocity;
                 curCharacterState = character.state;
@@ -102,16 +101,20 @@ public class HitFeedbackSystem : MonoBehaviour
                 character.rb.constraints = RigidbodyConstraints.FreezeAll;
                 character.ChangeState(CharacterState.FramePause);
                 isFreeze = true;
-                if (attackFromHasFreezeFrame && !hitFeedbackSystem.isFreeze)
+                if(attackFrom is MoveCharacter)
                 {
-                    hitFeedbackSystem.freezeFrame = freezeFrame;
-                    hitFeedbackSystem.origRC = attackFrom.rb.constraints;
-                    hitFeedbackSystem.velocity = attackFrom.rb.velocity;
-                    hitFeedbackSystem.curCharacterState = attackFrom.state;
-                    attackFrom.ani.speed = 0;
-                    attackFrom.rb.constraints = RigidbodyConstraints.FreezeAll;
-                    attackFrom.ChangeState(CharacterState.FramePause);
-                    hitFeedbackSystem.isFreeze = true;
+                    HitFeedbackSystem hitFeedbackSystem = (attackFrom as MoveCharacter).hitFeedbackSystem;
+                    if (attackFromHasFreezeFrame && !hitFeedbackSystem.isFreeze)
+                    {
+                        hitFeedbackSystem.freezeFrame = freezeFrame;
+                        hitFeedbackSystem.origRC = attackFrom.rb.constraints;
+                        hitFeedbackSystem.velocity = attackFrom.rb.velocity;
+                        hitFeedbackSystem.curCharacterState = attackFrom.state;
+                        attackFrom.ani.speed = 0;
+                        attackFrom.rb.constraints = RigidbodyConstraints.FreezeAll;
+                        attackFrom.ChangeState(CharacterState.FramePause);
+                        hitFeedbackSystem.isFreeze = true;
+                    }
                 }
             }
         }

+ 3 - 2
ActionTowerDefense/Assets/Scripts/Characters/PlayerController.cs

@@ -932,7 +932,7 @@ public class PlayerController : MoveCharacter
         {
             AttackSummonChangeTime -= Time.deltaTime;
         }
-        if (rushChargeNums < rushChargeTotalNums) 
+        if (rushChargeNums < rushChargeTotalNums && state != CharacterState.Rush && state  != CharacterState.Sprint) 
         {
             rushChargeTime += Time.deltaTime;
             UIController.ChangeImageFill(uiRush.GetChild(rushChargeNums).GetComponent<Image>(), rushChargeTime, rushChargeAddTime);
@@ -1411,7 +1411,8 @@ public class PlayerController : MoveCharacter
                 velocity = rushDir * rushSpeed;
                 //mp -= rushCostMp;
                 rushChargeNums--;
-                if(rushChargeNums != 2)
+                UIController.ChangeImageFill(uiRush.GetChild(rushChargeNums).GetComponent<Image>(), rushChargeTime, rushChargeAddTime);
+                if (rushChargeNums != 2)
                 {
                     UIController.ChangeImageFill(uiRush.GetChild(rushChargeNums + 1).GetComponent<Image>(), 0);
                 }