LAPTOP-OM1V99U2\永远de小亡灵 1 жил өмнө
parent
commit
794ffec381

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

@@ -141,7 +141,12 @@ public class Enemy : MoveCharacter
                             id = i;
                         }
                     }
-                    if(bodyTrans.position.x > TowerMap.myTowers[id].transform.position.x)
+                    if (id == -1)
+                    {
+                        moveDir = Vector3.right;
+                        break;
+                    }
+                    if (bodyTrans.position.x > TowerMap.myTowers[id].transform.position.x)
                     {
                         moveDir = Vector3.left;
                     }