Просмотр исходного кода

飞镖小猫可以被击落;修复小猫二段跳的bug

1243896040 2 недель назад
Родитель
Сommit
a6f8087494

+ 1 - 1
ActionTowerDefense/Assets/Resources/Prefab/Enemy/Enemy_Catninja_Far.prefab

@@ -347,7 +347,7 @@ MonoBehaviour:
   canFly: 0
   canControlFly: 0
   nowCanFly: 0
-  canNotShotDown: 1
+  canNotShotDown: 0
   canNotAddForce: 0
   canNotChangeHurt: 0
   isDie: 0

+ 13 - 6
ActionTowerDefense/Assets/Scripts/Enemy/Catninja_Far.cs

@@ -16,12 +16,19 @@ public class Catninja_Far : Enemy
         switch (state)
         {
             case CharacterState.Idle:
-                ChangeMoveDir(true);
-                Debug.Log(moveDir);
-                ChangeState(CharacterState.Rise);
-                Vector3 velocity = rb.velocity;
-                velocity.y = jumpForce;
-                rb.velocity = velocity;
+                if (foot.TrigGround)
+                {
+                    ChangeMoveDir(true);
+                    Debug.Log(moveDir);
+                    ChangeState(CharacterState.Rise);
+                    Vector3 velocity = rb.velocity;
+                    velocity.y = jumpForce;
+                    rb.velocity = velocity;
+                }
+                else
+                {
+                    ChangeState(CharacterState.Fall);
+                }
                 return;
             case CharacterState.Rise:
                 if(rb.velocity.y <= 0 && isAttack && pastAttackTime >= attackController.attackInterval)