소스 검색

使魔方向逻辑修改

wulifu 1 년 전
부모
커밋
fbba0d874d
2개의 변경된 파일32개의 추가작업 그리고 9개의 파일을 삭제
  1. 32 8
      ActionTowerDefense/Assets/Scripts/Demonic.cs
  2. 0 1
      ActionTowerDefense/Assets/Scripts/Enemy.cs

+ 32 - 8
ActionTowerDefense/Assets/Scripts/Demonic.cs

@@ -119,14 +119,15 @@ public class Demonic : MoveCharacter
         switch (searchState)
         {
             case SearchState.NoTarget:
-                if (PlayerController.instance.bodyTrans.localScale.x > 0)
-                {
-                    moveDir = Vector3.left;
-                }
-                else
-                {
-                    moveDir = Vector3.right;
-                }
+                //if (PlayerController.instance.bodyTrans.localScale.x > 0)
+                //{
+                //    moveDir = Vector3.left;
+                //}
+                //else
+                //{
+                //    moveDir = Vector3.right;
+                //}
+                moveDir = Vector3.left;
                 break;
             case SearchState.InSearchScope:
                 if (targetCharacter)
@@ -417,6 +418,29 @@ public class Demonic : MoveCharacter
     public override void Attack1()
     {
         base.Attack1();
+        Vector3 moveDir;
+        if (PlayerController.instance.bodyTrans.localScale.x > 0)
+        {
+            moveDir = Vector3.left;
+        }
+        else
+        {
+            moveDir = Vector3.right;
+        }
+        if (moveDir.x > 0.3f)
+        {
+            if (bodyTrans.localScale.x > 0)
+            {
+                Turn();
+            }
+        }
+        else if (moveDir.x < -0.3f)
+        {
+            if (bodyTrans.localScale.x < 0)
+            {
+                Turn();
+            }
+        }
         invincibleTime = totalAttack1Time;
         attackTarget = targetCharacter;
     }

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

@@ -369,7 +369,6 @@ public class Enemy : MoveCharacter
             angle = angle / 180 * Mathf.PI;
             GameObject soulObj = PoolManager.Instantiate(soulPrefab, transform.position);
             Vector3 dir = new Vector3(Mathf.Cos(angle), Mathf.Sin(angle), 0);
-            print("dir:" + dir);
             soulObj.GetComponent<Soul>().Burst(dir * soulStartSpeed);
         }
     }