Browse Source

调整厨师移动脚本

SZAND\msx_2 1 year ago
parent
commit
e0376dcb43

+ 5 - 5
ActionTowerDefense/Assets/Resources/Prefab/ESpirits_Cook.prefab

@@ -338,7 +338,7 @@ MonoBehaviour:
   activeAniTime: 1.3
   larger: 1.2
   canMove: 0
-  lockEffect: {fileID: 0}
+  lockEffect: {fileID: 2123904437201259524, guid: 24cf2b33715a9e04b9aabcb789c31067, type: 3}
 --- !u!1 &3483054690158852324
 GameObject:
   m_ObjectHideFlags: 0
@@ -818,7 +818,7 @@ MonoBehaviour:
   attackTime: 0
   totalAttack1Time: 1.25
   totalAttack2Time: 1.8
-  isNonAttack: 0
+  isNonAttack: 1
   hptp: 0
   isDie: 0
   totalHp: 1000
@@ -855,7 +855,7 @@ MonoBehaviour:
   rope: {fileID: 0}
   hasHpUp: 0
   beLarger: 0
-  canMove: 1
+  canMove: 0
   foot: {fileID: 5440846222604650418}
   extraRiseGravity: -28.8
   extraFallGravity: -14.4
@@ -892,8 +892,8 @@ MonoBehaviour:
   minMoveSpeed: 15
   dropSoul: 3
   soulPrefab: {fileID: 1723151111827507807, guid: e2b65aa482f2f1447a4074208d72b778, type: 3}
-  soulStartSpeed: 30
-  dropSoulAngle: 0
+  soulStartSpeed: 1
+  dropSoulAngle: 90
   noOnSearchState: 0
   isFindingPlayer: 0
   isFindPlayer: 0

+ 33 - 30
ActionTowerDefense/Assets/Scripts/Enemy.cs

@@ -99,47 +99,50 @@ public class Enemy : MoveCharacter
     public override Vector3 GetMoveDir()
     {
         Vector3 moveDir = Vector3.zero;
-        switch (searchState)
+        if (canMove)
         {
-            case SearchState.NoTarget:
-                moveDir = Vector3.right;
-                break;
-            case SearchState.InSearchScope:
-                if (targetCharacter)
-                {
-                    if (targetCharacter.transform.position.x - transform.position.x < 0)
+            switch (searchState)
+            {
+                case SearchState.NoTarget:
+                    moveDir = Vector3.right;
+                    break;
+                case SearchState.InSearchScope:
+                    if (targetCharacter)
                     {
-                        moveDir = Vector3.left;
+                        if (targetCharacter.transform.position.x - transform.position.x < 0)
+                        {
+                            moveDir = Vector3.left;
+                        }
+                        else
+                        {
+                            moveDir = Vector3.right;
+                        }
                     }
                     else
                     {
-                        moveDir = Vector3.right;
+                        moveDir = Vector3.zero;
                     }
-                }
-                else
-                {
-                    moveDir = Vector3.zero;
-                }
-                break;
-            case SearchState.InAttackScope:
-                if (targetCharacter)
-                {
-                    if (targetCharacter.transform.position.x - transform.position.x < 0)
+                    break;
+                case SearchState.InAttackScope:
+                    if (targetCharacter)
                     {
-                        moveDir = Vector3.left;
+                        if (targetCharacter.transform.position.x - transform.position.x < 0)
+                        {
+                            moveDir = Vector3.left;
+                        }
+                        else
+                        {
+                            moveDir = Vector3.right;
+                        }
                     }
                     else
                     {
-                        moveDir = Vector3.right;
+                        moveDir = Vector3.zero;
                     }
-                }
-                else
-                {
-                    moveDir = Vector3.zero;
-                }
-                break;
-            default:
-                break;
+                    break;
+                default:
+                    break;
+            }
         }
         return moveDir;
     }

+ 7 - 1
ActionTowerDefense/Assets/Scripts/Spirits/ESpirits_Cook.cs

@@ -134,6 +134,8 @@ public class ESpirits_Cook : MonoBehaviour
                 {
                     g.SetActive(true);
                 }
+                ene.canMove = true;
+                ene.ChangeState(CharacterState.Run);
                 break;
             //ˇ˘ĎÖÄżąę
             case cookState.find:
@@ -185,7 +187,7 @@ public class ESpirits_Cook : MonoBehaviour
         switch (cs)
         {
             case cookState.walk:
-                ene.ChangeState(CharacterState.Run);
+                
                 break;
             case cookState.find:
                 break;
@@ -217,6 +219,10 @@ public class ESpirits_Cook : MonoBehaviour
                 col.enabled = true;
             }
         }
+        else
+        {
+            StateAct(state);
+        }
         if (die && !once)
         {
             once = true;