Эх сурвалжийг харах

修复击飞旋转效果不明显的问题

WGL 2 сар өмнө
parent
commit
312f707fda

+ 6 - 11
ActionTowerDefense/Assets/Resources/Prefab/Enemy/Enemy_1001.prefab

@@ -306,6 +306,7 @@ MonoBehaviour:
   totalHp: 50
   hp: 0
   canFly: 0
+  canControlFly: 0
   nowCanFly: 0
   canNotShotDown: 1
   canNotAddForce: 0
@@ -367,9 +368,9 @@ MonoBehaviour:
   sustainedInjury_damage: 0
   heavyDamage: 0
   killer: {fileID: 0}
+  exp: 1
   tag: 0
   dieEffect: {fileID: 417478504669294145, guid: 2a4e7e280b9d19042ba0f57ae5edf736, type: 3}
-  exp: 1
   name: 
   baseSortingOrder: 3000
   isBack: 0
@@ -386,19 +387,11 @@ MonoBehaviour:
   type: -1
   searchState: 0
   attackRatio: 0
+  len: 0
   dropSoulMax: 1
   dropSoulMin: 1
+  dropProbability: 100
   dropSoulAngle: 90
-  canEscape: 0
-  stopEscapeCD: 0
-  escapeSpeed: 0
-  distanceToTowerDeviation: 0
-  distanceToTowerBase: 0
-  distanceToEnemyDeviation: 0
-  distanceToEnemyBase: 0
-  canClimb: 0
-  pathCreator: {fileID: 0}
-  climbSpeed: 0
 --- !u!114 &1837193195824484407
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -940,6 +933,7 @@ MonoBehaviour:
   owner: {fileID: 5720304588384615462}
   attackerID: 0
   curX: 0
+  mats: []
 --- !u!114 &2908060674811269511
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -1005,6 +999,7 @@ MonoBehaviour:
   isFly: 0
   decelerationRatioX: 2
   decelerationRatioY: 15
+  rotateCenterHeight: 0.5
   startFlyAngle: 15
   flyingRotateSpeedRange: {x: 45, y: 360}
   compressionDegree: 0.8

+ 7 - 2
ActionTowerDefense/Assets/Scripts/Characters/AttributeStatus.cs

@@ -48,6 +48,7 @@ public class AttributeStatus : MonoBehaviour
     private Character landingDamageFrom;
     private Vector3 startFlyPos;
 
+    [TabGroup("击飞击落")] [LabelText("旋转中心高度")] public float rotateCenterHeight = 1f;
     [TabGroup("击飞击落")] [LabelText("起飞预设角度")] public float startFlyAngle = 15f;
     [Tooltip("x为最小值,y为最大值")]
     [TabGroup("击飞击落")] [LabelText("飞行预设角速度随机范围")] public Vector2 flyingRotateSpeedRange = new Vector2(15, 45);
@@ -312,6 +313,7 @@ public class AttributeStatus : MonoBehaviour
                             character.bodyCollider.layer = character.gameObject.layer;
                             vel = vel / 5f;
                             vel.y = jumpVel;
+                            character.mecanim.transform.localPosition = Vector3.zero;
                             character.mecanim.transform.rotation = Quaternion.Euler(0, 0, 0);
                             character.transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, character.platformRotZ);
                             hitState = 1;
@@ -348,7 +350,10 @@ public class AttributeStatus : MonoBehaviour
                                 vel.x += decelerationRatioX * Time.deltaTime;
                             }
                             vel.y -= decelerationRatioY * Time.deltaTime;
-                            character.mecanim.transform.Rotate(0, 0, flyingRotateSpeed * Time.deltaTime);
+                            character.mecanim.transform.RotateAround(
+                                transform.position + rotateCenterHeight * Vector3.up, 
+                                Vector3.forward, 
+                                flyingRotateSpeed * Time.deltaTime);
                             isFly = true;
                         }
                         break;
@@ -510,7 +515,7 @@ public class AttributeStatus : MonoBehaviour
         rb.AddForce(vec3 * blowUp.force * (1 - resistances.BlowUp), ForceMode.Impulse);
         rb.transform.rotation = Quaternion.Euler(0, 0, 0);
         character.mecanim.transform.rotation = Quaternion.Euler(0, 0, startFlyAngle * attackDir);
-        flyingRotateSpeed = -UnityEngine.Random.Range(flyingRotateSpeedRange.x, flyingRotateSpeedRange.y) * attackDir;
+        flyingRotateSpeed = UnityEngine.Random.Range(flyingRotateSpeedRange.x, flyingRotateSpeedRange.y) * attackDir;
         startFlyPos = transform.position;
         hitState = 0;
         isFly = false;