LAPTOP-OM1V99U2\永远de小亡灵 1 năm trước cách đây
mục cha
commit
794ffec381
1 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 6 1
      ActionTowerDefense/Assets/Scripts/Enemy.cs

+ 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;
                     }