Sfoglia il codice sorgente

激光+特殊砖块bug

SZAND\msx_2 1 anno fa
parent
commit
3bad33f2c0

+ 3 - 1
ActionTowerDefense/Assets/Resources/Prefab/Boss/YuMenGuan/EyeLaser/Effc_Laser.prefab

@@ -34415,7 +34415,9 @@ MonoBehaviour:
   end: {fileID: 458535148706196034}
   headPos: {fileID: 0}
   endPos: {fileID: 0}
-  angle: 0
+  deltaAngle1: 30
+  deltaAngle2: -30
+  lineLen: 30
   lines: {fileID: 3976506043168544685}
   lineMats:
   - {fileID: 2100000, guid: 36c58060d3457564289dfc602e3b32a4, type: 2}

+ 1 - 0
ActionTowerDefense/Assets/Scripts/Boss/YuMenGuan/Block.cs

@@ -106,6 +106,7 @@ public class Block : Character
                 {
                     ChangeAttackState(State.none);
                 }
+                curWarning.SetActive(false);
                 dieKeepTime = totalDieKeepTime;
                 break;
             default:

+ 24 - 12
ActionTowerDefense/Assets/Scripts/Boss/YuMenGuan/EyeLaser.cs

@@ -10,8 +10,8 @@ public class EyeLaser : MonoBehaviour
     private GameObject end1, end2;
     public Transform headPos;
     public Transform endPos;
-    public float deltaDis1, deltaDis2;
-    public float maxX;
+    public float deltaAngle1, deltaAngle2;
+    public float lineLen;
 
     [Header("ÌØÐ§")]
     private bool hasPrepared;
@@ -135,29 +135,41 @@ public class EyeLaser : MonoBehaviour
         col2.right = -left2;
     }
 
+    //µãAÈÆµãBתºó×ø±ê
+    Vector2 RotatePointAroundPivot(Vector2 point, Vector2 pivot, float angleDegrees)
+    {
+        float angleRadians = angleDegrees * Mathf.Deg2Rad;
+        float dx = point.x - pivot.x;
+        float dy = point.y - pivot.y;
+        float cosTheta = Mathf.Cos(angleRadians);
+        float sinTheta = Mathf.Sin(angleRadians);
+        float newX = cosTheta * dx - sinTheta * dy;
+        float newY = sinTheta * dx + cosTheta * dy;
+        return new Vector2(pivot.x + newX, pivot.y + newY);
+    }
+
     private Vector3 TranEnd(int id)
     {
-        Vector2 dis = endPos.position - headPos.position;
+        Vector3 pos = (endPos.position - headPos.position).normalized * lineLen + headPos.position;
+        pos.z = 0;
         switch (id)
         {
             case 1:
-                dis.x -= deltaDis1;
+                pos = RotatePointAroundPivot(pos, headPos.position, deltaAngle1);
                 break;
             case 2:
-                dis.x += deltaDis2;
+                pos = RotatePointAroundPivot(pos, headPos.position, deltaAngle2);
                 break;
             default:
                 break;
         }
-        float k = dis.x / dis.y;
-        Vector3 en = endPos.position;
-        en.x += (-2 - en.y) * k;
-        if (en.x - headPos.position.x > maxX)
+        if (pos.y < -1)
         {
-            en.x = headPos.position.x + maxX;
+            float k = (headPos.position.y + 1) / (headPos.position.y - pos.y);
+            pos.x = k * (pos.x - headPos.position.x) + headPos.position.x;
+            pos.y = -1;
         }
-        en.y = -1;
-        return en;
+        return pos;
     }
 
     private void Update()

+ 3 - 0
ActionTowerDefense/Assets/Scripts/Boss/YuMenGuan/YuMenGuan.cs

@@ -379,6 +379,8 @@ public class YuMenGuan : Boss
 
     public void BlocksOut()
     {
+        mostHeight = 0;
+        print(mostHeight);
         curBlocks = Random.Range(minBlocks, maxBlocks);
         blocks = new Block[curBlocks];
         for(int i = curBlocks; i > 0; i--)
@@ -389,6 +391,7 @@ public class YuMenGuan : Boss
             blocks[i - 1].ymg = this;
             blocks[i - 1].Ready();
         }
+        print(mostHeight);
         EndCurAttackState(true);
     }
 

+ 1 - 1
ActionTowerDefense/Assets/material/line.mat

@@ -43,7 +43,7 @@ Material:
     - _MainTex:
         m_Texture: {fileID: 2800000, guid: 53e9fd48a689b264d9a7741adfe8e9b2, type: 3}
         m_Scale: {x: 1, y: 1}
-        m_Offset: {x: -2269.1106, y: 0}
+        m_Offset: {x: -3043.5063, y: 0}
     - _MetallicGlossMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}

+ 1 - 1
ActionTowerDefense/Assets/material/line_air.mat

@@ -43,7 +43,7 @@ Material:
     - _MainTex:
         m_Texture: {fileID: 2800000, guid: c8aeee0a826afe14a8bc88cc6309b437, type: 3}
         m_Scale: {x: 1, y: 1}
-        m_Offset: {x: -1993.3241, y: 0}
+        m_Offset: {x: -2640.3918, y: 0}
     - _MetallicGlossMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}

+ 1 - 1
ActionTowerDefense/Assets/material/line_back.mat

@@ -43,7 +43,7 @@ Material:
     - _MainTex:
         m_Texture: {fileID: 2800000, guid: f3e88fd2fe21e374582525302db1f9ec, type: 3}
         m_Scale: {x: 1, y: 1}
-        m_Offset: {x: -1901.9392, y: 0}
+        m_Offset: {x: -2559.7534, y: 0}
     - _MetallicGlossMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}