Bläddra i källkod

修复刺客冲刺后受到顿帧会卡住的问题

WGL 2 månader sedan
förälder
incheckning
0c4fe15c73

+ 8 - 3
ActionTowerDefense/Assets/Scripts/Characters/HitFeedbackSystem.cs

@@ -13,7 +13,7 @@ public class HitFeedbackSystem : MonoBehaviour
     [TabGroup("śŮÖĄ")] public bool attackFromHasFreezeFrame;
     [TabGroup("śŮÖĄ")] [DisplayOnly] public bool isFreeze;
     [HideInInspector] public bool canFreeze;
-    [HideInInspector] public bool canBeFreeze = true;
+    
     private RigidbodyConstraints origRC;
     private Vector3 velocity;   //śŮ֥ǰËŮśČ
     public CharacterState curCharacterState;  //śŮ֥ǰ״̏
@@ -22,12 +22,13 @@ public class HitFeedbackSystem : MonoBehaviour
 
     [TabGroup("˝ŠÖą")] [DisplayOnly] public float hitStunTime;
     [HideInInspector] public bool canHitStun;
+    [DisplayOnly] public bool canBeHitStun = true;
 
     private void Awake()
     {
         character = GetComponentInParent<MoveCharacter>();
         attributeStatus = GetComponent<AttributeStatus>();
-        canBeFreeze = true;
+        canBeHitStun = true;
     }
 
     void Start()
@@ -43,7 +44,7 @@ public class HitFeedbackSystem : MonoBehaviour
     void FixedUpdate()
     {
         //śŮÖĄ
-        if (canBeFreeze && isFreeze)
+        if (isFreeze)
         {
             if (character.rb == null)
             {
@@ -123,6 +124,10 @@ public class HitFeedbackSystem : MonoBehaviour
     //˝ŠÖą
     public void EnterHitStun(Character attackFrom)
     {
+        if (!canBeHitStun)
+        {
+            return;
+        }
         if (canHitStun)
         {
             canHitStun = false;

+ 4 - 4
ActionTowerDefense/Assets/Scripts/Spirits/ESpirits_Assassin.cs

@@ -74,11 +74,11 @@ public class ESpirits_Assassin : Enemy
                             {
                                 ChangeState(CharacterState.Attack);
                                 eSpiritsState = ESpiritsState.Ready;
-                                rb.velocity = Vector3.zero;
                                 hitResistance = 100;
                                 attributeStatus.resistances.controlOrder = 1;
-                                bodyCollider.SetActive(false);
                                 rb.useGravity = false;
+                                rb.velocity = Vector3.zero;
+                                bodyCollider.SetActive(false);
                                 ani.Play("charge", 0, 0);
                                 aimPrefab.transform.localScale = new Vector3(rushDistance / 1.5f, 1, 1);
                                 directionToTarget = (playerController.transform.position + Vector3.up - aimPrefab.transform.position).normalized;
@@ -86,7 +86,7 @@ public class ESpirits_Assassin : Enemy
                                 aimPrefab.transform.rotation = Quaternion.Euler(0, 0, angleToTarget);
                                 aimPrefab.SetActive(true);
                                 time = 0;
-                                hitFeedbackSystem.canBeFreeze = false;
+                                hitFeedbackSystem.canBeHitStun = false;
                             }
                         }
                         break;
@@ -187,7 +187,7 @@ public class ESpirits_Assassin : Enemy
                             time = 0;
                             hitResistance = oldHitResistance;
                             attributeStatus.resistances.controlOrder = 0;
-                            hitFeedbackSystem.canBeFreeze = true;
+                            hitFeedbackSystem.canBeHitStun = true;
                             ChangeState(CharacterState.Idle);
                         }
                         break;