Browse Source

背面击打僵直会播放hittedback动画

wgl 6 months ago
parent
commit
64a68272d2
1 changed files with 10 additions and 1 deletions
  1. 10 1
      ActionTowerDefense/Assets/Scripts/Characters/HitFeedbackSystem.cs

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

@@ -93,7 +93,16 @@ public class HitFeedbackSystem : MonoBehaviour
         if (canHitStun)
         {
             canHitStun = false;
-            character.ani.Play("hitted", 0, 0);
+            float dir1 = attributeStatus.attackFrom.transform.position.x <= character.transform.position.x? 1:-1;
+            float dir2 = character.bodyTrans.localScale.x >= 0? 1:-1;
+            if(dir1 == dir2)
+            {
+                character.ani.Play("hitted", 0, 0);
+            }
+            else
+            {
+                character.ani.Play("hitted_back", 0, 0);
+            }
             character.ChangeState(CharacterState.HitStun);
             character.ChangeStateText(CharacterState.HitStun);
         }