소스 검색

空中单位进入虚弱状态落地

LAPTOP-OM1V99U2\永远de小亡灵 11 달 전
부모
커밋
d14e0b20b8
2개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      ActionTowerDefense/Assets/Scripts/Demonic.cs
  2. 2 0
      ActionTowerDefense/Assets/Scripts/Enemy.cs

+ 2 - 0
ActionTowerDefense/Assets/Scripts/Demonic.cs

@@ -725,6 +725,7 @@ public class Demonic : MoveCharacter
                 if (canFly)
                 {
                     rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezePositionY;
+                    rb.useGravity = false;
                 }
                 break;
             case CharacterState.Float:
@@ -790,6 +791,7 @@ public class Demonic : MoveCharacter
                 if (canFly)
                 {
                     rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
+                    rb.useGravity = true;
                     flyHeight = Random.Range(minHeight, maxHeight);
                 }
 

+ 2 - 0
ActionTowerDefense/Assets/Scripts/Enemy.cs

@@ -688,6 +688,7 @@ public class Enemy : MoveCharacter
                 if (canFly)
                 {
                     rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ |RigidbodyConstraints.FreezePositionY;
+                    rb.useGravity = false;
                 }
                 
                 break;
@@ -814,6 +815,7 @@ public class Enemy : MoveCharacter
                         if (canFly)
                         {
                             rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
+                            rb.useGravity = true;
                             flyHeight = Random.Range(minHeight, maxHeight);
                         }