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

修复飞行单位攻击时会落地bug

LAPTOP-OM1V99U2\永远de小亡灵 11 сар өмнө
parent
commit
3b474f99b2

+ 2 - 1
ActionTowerDefense/Assets/Resources/Prefab/Demonic_Arrow.prefab

@@ -1133,6 +1133,7 @@ MonoBehaviour:
   dropSoulMax: 3
   dropSoulMin: 1
   dropSoulAngle: 60
+  upFirstAfterWeaknessOrNot: 0
 --- !u!54 &8639832132491289349
 Rigidbody:
   m_ObjectHideFlags: 0
@@ -1147,5 +1148,5 @@ Rigidbody:
   m_UseGravity: 0
   m_IsKinematic: 0
   m_Interpolate: 0
-  m_Constraints: 120
+  m_Constraints: 124
   m_CollisionDetection: 0

+ 2 - 1
ActionTowerDefense/Assets/Resources/Prefab/ESpirits_Float.prefab

@@ -998,7 +998,7 @@ Rigidbody:
   m_UseGravity: 0
   m_IsKinematic: 0
   m_Interpolate: 0
-  m_Constraints: 120
+  m_Constraints: 124
   m_CollisionDetection: 0
 --- !u!114 &3755986111268942620
 MonoBehaviour:
@@ -1188,3 +1188,4 @@ MonoBehaviour:
   rushHaveAttack: 0
   downRushTime: 0
   finishRushTime: 0
+  upFirstAfterWeaknessOrNot: 0

+ 1 - 1
ActionTowerDefense/Assets/Resources/Prefab/Enemy_Arrow.prefab

@@ -1160,5 +1160,5 @@ Rigidbody:
   m_UseGravity: 0
   m_IsKinematic: 0
   m_Interpolate: 0
-  m_Constraints: 120
+  m_Constraints: 124
   m_CollisionDetection: 0

+ 2 - 1
ActionTowerDefense/Assets/Resources/Prefab/MySpirit/Spirits_Float.prefab

@@ -1152,6 +1152,7 @@ MonoBehaviour:
   dropSoulMax: 3
   dropSoulMin: 1
   dropSoulAngle: 60
+  upFirstAfterWeaknessOrNot: 0
 --- !u!54 &8639832132491289349
 Rigidbody:
   m_ObjectHideFlags: 0
@@ -1166,5 +1167,5 @@ Rigidbody:
   m_UseGravity: 0
   m_IsKinematic: 0
   m_Interpolate: 0
-  m_Constraints: 120
+  m_Constraints: 124
   m_CollisionDetection: 0

+ 10 - 1
ActionTowerDefense/Assets/Scripts/Demonic.cs

@@ -718,6 +718,10 @@ public class Demonic : MoveCharacter
                 break;
             case CharacterState.Weak:
                 beRepelValue = totalBeRepelValue;
+                if (canFly)
+                {
+                    rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezePositionY;
+                }
                 break;
             case CharacterState.Float:
                 canMove = true;
@@ -779,7 +783,12 @@ public class Demonic : MoveCharacter
                 break;
             case CharacterState.Weak:
                 weakTime = totalWeakTime;
-                flyHeight = Random.Range(minHeight, maxHeight);
+                if (canFly)
+                {
+                    rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
+                    flyHeight = Random.Range(minHeight, maxHeight);
+                }
+
                 break;
             case CharacterState.Float:
                 canMove = false;

+ 11 - 1
ActionTowerDefense/Assets/Scripts/Enemy.cs

@@ -685,6 +685,11 @@ public class Enemy : MoveCharacter
                 break;
             case CharacterState.Weak:
                 beRepelValue = totalBeRepelValue;
+                if (canFly)
+                {
+                    rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ |RigidbodyConstraints.FreezePositionY;
+                }
+                
                 break;
             case CharacterState.Float:
                 canMove = true;
@@ -806,7 +811,12 @@ public class Enemy : MoveCharacter
                         break;
                     default:
                         weakTime = totalWeakTime;
-                        flyHeight = Random.Range(minHeight, maxHeight);
+                        if (canFly)
+                        {
+                            rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
+                            flyHeight = Random.Range(minHeight, maxHeight);
+                        }
+                        
                         //hurtKeepTime = minHurtKeepTime;
                         break;
                 }