Procházet zdrojové kódy

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

wgl před 6 měsíci
rodič
revize
64a68272d2

+ 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);
         }