소스 검색

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

wgl 6 달 전
부모
커밋
64a68272d2
1개의 변경된 파일10개의 추가작업 그리고 1개의 파일을 삭제
  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);
         }