Ver código fonte

士兵起手式结束后才落地

SZAND\msx_2 5 meses atrás
pai
commit
933f20455d

+ 0 - 1
ActionTowerDefense/Assets/Scripts/Bullet.cs

@@ -186,7 +186,6 @@ public class Bullet : MonoBehaviour
         if (effect)
         {
             Instantiate(effect, bht.owner.bodyTrans.position, new Quaternion(0, 0, 0, 0), bht.owner.bodyTrans);
-            print(1);
         }
     }
 

+ 10 - 0
ActionTowerDefense/Assets/Scripts/Characters/Demonic.cs

@@ -16,6 +16,7 @@ public class Demonic : MoveCharacter
     public int baseSortingOrder;
     public float runSpeed;
     public float summonTime;
+    private bool isFreeze;              //¶³½árb
 
     [Header("Ëø»êËþ")]
     public bool isReturnSoulTower;
@@ -623,6 +624,10 @@ public class Demonic : MoveCharacter
                 rb.velocity = Vector3.zero;
                 break;
             case CharacterState.Attack:
+                if (isFreeze)
+                {
+                    rb.constraints = RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotation;
+                }
                 if (attackController.effect)
                 {
                     attackController.effect.SetActive(false);
@@ -683,6 +688,11 @@ public class Demonic : MoveCharacter
             flyHeight = Random.Range(minFlyHeight, maxFlyHeight);
             isAdjustHeight = 1;
         }
+        if (!canFly)
+        {
+            rb.constraints = RigidbodyConstraints.FreezeAll;
+            isFreeze = true;
+        }
         attackController.Attack_summon();
         Vector3 moveDir;
         if (PlayersInput.instance[playerID].bodyTrans.localScale.x > 0)