From 4373445b5da5997b9d73e63cd7c2ceaa3788c92b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A3=AE2003?= <2384017988@qq.com> Date: Mon, 17 Aug 2026 22:23:54 +0800 Subject: [PATCH] 01 --- ..._Settle_IronFist_Self_XingJiXunHang.prefab | 94 ++++-- .../PW_Prop_IronFist Variant.prefab | 11 +- .../Boss/XingJiXunHang/XingJiXunHangEvent.cs | 310 +++++++++++++++++- .../XingJiXunHang/dieFXPrefabAwardTmp.prefab | 19 ++ 4 files changed, 406 insertions(+), 28 deletions(-) diff --git a/Assets/MyGame/aa/Game/XJMH/Boss/BJ/BJEnd/PW_Effect_Settle_IronFist_Self_XingJiXunHang.prefab b/Assets/MyGame/aa/Game/XJMH/Boss/BJ/BJEnd/PW_Effect_Settle_IronFist_Self_XingJiXunHang.prefab index 34dc862f5..4d00dd2b3 100644 --- a/Assets/MyGame/aa/Game/XJMH/Boss/BJ/BJEnd/PW_Effect_Settle_IronFist_Self_XingJiXunHang.prefab +++ b/Assets/MyGame/aa/Game/XJMH/Boss/BJ/BJEnd/PW_Effect_Settle_IronFist_Self_XingJiXunHang.prefab @@ -12,88 +12,140 @@ PrefabInstance: propertyPath: m_Name value: PW_Effect_Settle_IronFist_Self_XingJiXunHang objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_Pivot.x value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_Pivot.y value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_AnchorMax.x value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_AnchorMax.y value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_AnchorMin.x value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_AnchorMin.y value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_SizeDelta.x value: 100 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_SizeDelta.y value: 100 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_LocalPosition.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_AnchoredPosition.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_LocalEulerAnglesHint.y value: -0 objectReference: {fileID: 0} - - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} + - target: {fileID: 224843675838272296, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} propertyPath: m_LocalEulerAnglesHint.z value: -0 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 1528097044962012, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} + insertIndex: -1 + addedObject: {fileID: 7814067992762775313} m_SourcePrefab: {fileID: 100100000, guid: d257b8461bbd510438787bdd0a8e2d49, type: 3} +--- !u!1 &1650187392735260276 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 1528097044962012, guid: d257b8461bbd510438787bdd0a8e2d49, + type: 3} + m_PrefabInstance: {fileID: 1649383419158475944} + m_PrefabAsset: {fileID: 0} +--- !u!114 &7814067992762775313 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1650187392735260276} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f0df2f946ba608449970c84418dade5, type: 3} + m_Name: + m_EditorClassIdentifier: + tMP_beishu: {fileID: 0} + tMP_score: {fileID: 0} + goldSprite: {fileID: 0} + SilverSprite: {fileID: 0} + img_BaoJiangZhong: {fileID: 0} + useScoreAnim: 0 + autoDestroyDelay: 5 + animTrigger_Appear: Appear + animTrigger_Loop: Loop + animTrigger_Close: Close diff --git a/Assets/MyGame/aa/Game/XJMH/Boss/XingJiXunHang/PW_Prop_IronFist Variant.prefab b/Assets/MyGame/aa/Game/XJMH/Boss/XingJiXunHang/PW_Prop_IronFist Variant.prefab index f1c6d2a5a..07ba7b883 100644 --- a/Assets/MyGame/aa/Game/XJMH/Boss/XingJiXunHang/PW_Prop_IronFist Variant.prefab +++ b/Assets/MyGame/aa/Game/XJMH/Boss/XingJiXunHang/PW_Prop_IronFist Variant.prefab @@ -10,12 +10,16 @@ PrefabInstance: m_Modifications: - target: {fileID: 1158706302637583, guid: 8a3eb92f5b88a6645b2e7c4719e73521, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 1403006993094469, guid: 8a3eb92f5b88a6645b2e7c4719e73521, type: 3} propertyPath: m_Name value: PW_Prop_IronFist Variant objectReference: {fileID: 0} + - target: {fileID: 1585511287684814, guid: 8a3eb92f5b88a6645b2e7c4719e73521, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 4837804086439315, guid: 8a3eb92f5b88a6645b2e7c4719e73521, type: 3} propertyPath: m_LocalScale.x value: -5 @@ -72,6 +76,11 @@ PrefabInstance: propertyPath: m_ConstrainProportionsScale value: 1 objectReference: {fileID: 0} + - target: {fileID: 4627758090278655303, guid: 8a3eb92f5b88a6645b2e7c4719e73521, + type: 3} + propertyPath: _animationName + value: zadi + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] diff --git a/Assets/MyGame/aa/Game/XJMH/Boss/XingJiXunHang/XingJiXunHangEvent.cs b/Assets/MyGame/aa/Game/XJMH/Boss/XingJiXunHang/XingJiXunHangEvent.cs index 49b587bef..66390256c 100644 --- a/Assets/MyGame/aa/Game/XJMH/Boss/XingJiXunHang/XingJiXunHangEvent.cs +++ b/Assets/MyGame/aa/Game/XJMH/Boss/XingJiXunHang/XingJiXunHangEvent.cs @@ -154,6 +154,18 @@ public class XingJiXunHangEvent : BJEventBase [Tooltip("光子-laser 激活后上下摆动来回次数(0=不摆动)")] public int laserSwingCycles = 0; + [Header("光子 - 4条激光伸展")] + [Tooltip("laser1 子物体名(向 X 正方向伸到屏幕最右)")] + public string laser1Name = "laser1"; + [Tooltip("laser2 子物体名(向 -Y 方向伸到屏幕最下)")] + public string laser2Name = "laser2"; + [Tooltip("laser3 子物体名(向 +Y 方向伸到屏幕最上)")] + public string laser3Name = "laser3"; + [Tooltip("laser4 子物体名(向 -X 方向伸到屏幕最左)")] + public string laser4Name = "laser4"; + [Tooltip("4条激光伸展到最长位置的耗时(秒)")] + public float laserExpandSpeed = 0.6f; + [Header("光子 - 电网扫动杀鱼")] [Tooltip("电网(Prop整体)上下扫动幅度(世界单位)")] public float netSweepAmplitude = 5f; @@ -173,6 +185,22 @@ public class XingJiXunHangEvent : BJEventBase [Tooltip("电网是否杀鱼(碰到飞机飞机爆炸)")] public bool netKillFish = true; + [Header("伽马风暴 - 四射线旋转")] + [Tooltip("四根射线子物体名(伽马风暴激光,按顺序填;预制体内为小写 laser1~4)")] + public string[] gammaLaserNames = { "laser1", "laser2", "laser3", "laser4" }; + [Tooltip("射线显示后到开始旋转的等待(秒,默认1)")] + public float gammaRotateDelay = 1f; + [Tooltip("总旋转角度(度,默认80°)")] + public float gammaRotateAngle = 80f; + [Tooltip("转到该角度后激光开始缩短(度,默认45°)")] + public float gammaShrinkStartAngle = 45f; + [Tooltip("旋转速度(度/秒,正=逆时针)")] + public float gammaRotateSpeed = 45f; + [Tooltip("伽马风暴射线杀鱼检测层(Fish)")] + public LayerMask gammaKillLayer; + [Tooltip("伽马风暴射线是否杀鱼(碰到激光的飞机直接死亡)")] + public bool gammaKillFish = true; + // ==================== 爆奖配置 ==================== [Header("爆奖配置")] @@ -343,7 +371,7 @@ public class XingJiXunHangEvent : BJEventBase /// 根据武器 ID 选择对应的预制体和标签 private void SelectWeaponPrefabs() { - //_weaponId = 8; + _weaponId = 6; switch (_weaponId) { case 0: @@ -842,6 +870,9 @@ public class XingJiXunHangEvent : BJEventBase } } + // ⭐ 4条激光沿各自方向伸展到最长位置(laser1:+X → laser2:-Y → laser3:+Y → laser4:-X) + yield return StartCoroutine(LaserExpand(propObj)); + // ⭐ 电网:Prop 整体上下扫动 + 碰到飞机(鱼)爆炸 if (netSweepCycles > 0) { @@ -851,6 +882,53 @@ public class XingJiXunHangEvent : BJEventBase yield return new WaitForSeconds(0.3f); } + /// + /// 4条激光伸展:laser1 向 +X(屏幕最右)、laser2 向 -Y(屏幕最下)、 + /// laser3 向 +Y(屏幕最上)、laser4 向 -X(屏幕最左),到达最长位置。 + /// + private IEnumerator LaserExpand(GameObject propObj) + { + if (propObj == null) yield break; + + Transform l1 = FindChildRecursive(propObj.transform, laser1Name); + Transform l2 = FindChildRecursive(propObj.transform, laser2Name); + Transform l3 = FindChildRecursive(propObj.transform, laser3Name); + Transform l4 = FindChildRecursive(propObj.transform, laser4Name); + + int count = 0; + // laser1 → +X 正方向(保持当前 Y,X 到屏幕最右) + if (l1 != null) + { + Vector3 dest = new Vector3(GetScreenRight().x, l1.position.y, 0); + StartCoroutine(MoveTo(l1, dest, laserExpandSpeed)); + count++; + } + // laser2 → -Y 方向(保持当前 X,Y 到屏幕最下) + if (l2 != null) + { + Vector3 dest = new Vector3(l2.position.x, GetScreenBottom().y, 0); + StartCoroutine(MoveTo(l2, dest, laserExpandSpeed)); + count++; + } + // laser3 → +Y 方向(保持当前 X,Y 到屏幕最上) + if (l3 != null) + { + Vector3 dest = new Vector3(l3.position.x, GetScreenTop().y, 0); + StartCoroutine(MoveTo(l3, dest, laserExpandSpeed)); + count++; + } + // laser4 → -X 方向(保持当前 Y,X 到屏幕最左) + if (l4 != null) + { + Vector3 dest = new Vector3(GetScreenLeft().x, l4.position.y, 0); + StartCoroutine(MoveTo(l4, dest, laserExpandSpeed)); + count++; + } + + yield return new WaitForSeconds(laserExpandSpeed + 0.2f); + Debug.Log($"[XingJiXunHang] 光子: 4条激光伸展完成 找到{count}条({laser1Name}/{laser2Name}/{laser3Name}/{laser4Name})"); + } + /// /// 电网扫动:Prop 整体上下移动(幅度 netSweepAmplitude,来回 netSweepCycles 次), /// 扫动过程中每帧检测 PropL~PropR 之间的矩形区域,碰到普通鱼 → 爆炸(Id_DieFish_FX)。 @@ -957,7 +1035,9 @@ public class XingJiXunHangEvent : BJEventBase /// /// 伽马风暴道具动画(美术规格): /// 1. Prop 从死亡位置移动到屏幕中心 - /// 2. 根据视频内容激活特效(由动画事件或Timeline驱动) + /// 2. 显示四根射线(激光) + /// 3. 等待 gammaRotateDelay(默认1秒) + /// 4. 开始旋转(Prop 整体绕 Z 轴),旋转中碰到激光的普通鱼直接死亡 /// private IEnumerator GammaStormPropAnim(GameObject propObj) { @@ -966,8 +1046,193 @@ public class XingJiXunHangEvent : BJEventBase yield return StartCoroutine(MoveTo(propObj.transform, Vector3.zero, propAnimDuration)); Debug.Log("[XingJiXunHang] 伽马风暴: 移动到屏幕中心"); - // 2. 特效由预制体自身的动画/Timeline驱动,这里只等待 - yield return new WaitForSeconds(0.5f); + // 2. 显示四根射线(激光,默认隐藏则激活) + Transform[] lasers = FindGammaLasers(propObj); + int shown = 0; + foreach (var l in lasers) + { + if (l != null) + { + l.gameObject.SetActive(true); + shown++; + } + } + Debug.Log($"[XingJiXunHang] 伽马风暴: 显示激光 {shown}/{lasers.Length} 根"); + + // ⭐ 射线长度 = 斜边(直角边 = 屏幕宽度一半 / 高度一半),延伸到屏幕角落 + float diag = GetScreenHalfDiagonal(); + UpdateGammaLaserEndpoints(lasers, propObj.transform.position, diag); + Debug.Log($"[XingJiXunHang] 伽马风暴: 射线长度设为斜边 {diag}"); + + // 3. 等待 1 秒(Tip 隐藏后停顿,让玩家看清激光) + yield return new WaitForSeconds(gammaRotateDelay); + Debug.Log($"[XingJiXunHang] 伽马风暴: 激光显示等待 {gammaRotateDelay}s 后开始旋转"); + + // 4. 旋转 + 射线杀鱼 + yield return StartCoroutine(GammaRotateAndKill(propObj, lasers, diag)); + } + + /// 按 gammaLaserNames 查找四根射线子物体 + private Transform[] FindGammaLasers(GameObject propObj) + { + if (propObj == null || gammaLaserNames == null || gammaLaserNames.Length == 0) + return new Transform[0]; + + Transform[] lasers = new Transform[gammaLaserNames.Length]; + for (int i = 0; i < gammaLaserNames.Length; i++) + { + // ⭐ 先忽略大小写找(预制体实际小写 laser1~4),找不到再精确匹配 + lasers[i] = FindChildIgnoreCase(propObj.transform, gammaLaserNames[i]); + if (lasers[i] == null) + lasers[i] = FindChildRecursive(propObj.transform, gammaLaserNames[i]); + if (lasers[i] == null) + Debug.LogWarning($"[XingJiXunHang] 伽马风暴: 找不到射线子物体 {gammaLaserNames[i]}"); + } + return lasers; + } + + /// + /// 伽马风暴:Prop 整体旋转 gammaRotateAngle 度(默认80°)。 + /// 转到 gammaShrinkStartAngle(45°)后激光开始慢慢缩短,转到终点时缩到看不见(长度 0)。 + /// 旋转中射线扫到的普通鱼死亡。 + /// + private IEnumerator GammaRotateAndKill(GameObject propObj, Transform[] lasers, float laserLength) + { + if (propObj == null) yield break; + + float rotated = 0f; + int killCount = 0; + float shrinkSpan = Mathf.Max(0.01f, gammaRotateAngle - gammaShrinkStartAngle); + + while (rotated < gammaRotateAngle) + { + float step = gammaRotateSpeed * Time.deltaTime; + propObj.transform.Rotate(0f, 0f, step); + rotated += step; + + // ⭐ 激光长度:前 gammaShrinkStartAngle 度保持全斜边,之后线性缩短到 0(看不见) + float curLen = laserLength; + if (rotated > gammaShrinkStartAngle) + { + float t = (rotated - gammaShrinkStartAngle) / shrinkSpan; + curLen = laserLength * (1f - Mathf.Clamp01(t)); + } + + // 每帧更新射线端点(LineRenderer 世界坐标不随父旋转,必须跟随激光新朝向) + UpdateGammaLaserEndpoints(lasers, propObj.transform.position, curLen); + + if (gammaKillFish) + KillFishByGammaLasers(propObj.transform, lasers, curLen, ref killCount); + yield return null; + } + + // 终点:激光缩到 0 长度(隐藏) + UpdateGammaLaserEndpoints(lasers, propObj.transform.position, 0f); + Debug.Log($"[XingJiXunHang] 伽马风暴: 旋转完成 {rotated:0.#}°(45°后激光缩短至消失)炸鱼 {killCount} 条"); + } + + /// + /// 设置四根射线长度为斜边:LineRenderer 端点 = 中心 → 中心 + 射线朝向×长度。 + /// 射线朝向优先取"激光当前位置-中心"(随 Prop 旋转自动更新),零向量时用激光本地 Y 轴方向。 + /// + private void UpdateGammaLaserEndpoints(Transform[] lasers, Vector3 center, float length) + { + if (lasers == null) return; + + foreach (var laser in lasers) + { + if (laser == null) continue; + + // 射线方向:激光相对中心的位置(旋转后自动更新);为 0 则用激光自身的朝向 + Vector2 dir = (Vector2)laser.position - (Vector2)center; + if (dir.sqrMagnitude < 0.0001f) + dir = laser.up; // 本地 Y 轴世界方向(或 right,按预制体实际朝向) + if (dir.sqrMagnitude < 0.0001f) dir = Vector2.right; + dir.Normalize(); + + Vector3 endWorld = center + (Vector3)dir * length; + + var lr = laser.GetComponent(); + if (lr != null) + { + lr.positionCount = 2; + if (lr.useWorldSpace) + { + lr.SetPosition(0, center); + lr.SetPosition(1, endWorld); + } + else + { + lr.SetPosition(0, laser.InverseTransformPoint(center)); + lr.SetPosition(1, laser.InverseTransformPoint(endWorld)); + } + } + else + { + // 非 LineRenderer:把激光整体拉伸到目标长度(假定沿本地 Y 轴伸长) + float curLen = laser.localScale.y; + if (curLen < 0.001f) curLen = 1f; + laser.localScale = new Vector3(laser.localScale.x, length / curLen, laser.localScale.z); + } + } + } + + /// 屏幕半宽半高为直角边的斜边长度(世界单位)= 屏幕中心到角落的距离 + private float GetScreenHalfDiagonal() + { + var cam = Camera.main; + if (cam == null) return 10f; + + float z = cam.transform.position.z * -1f; + Vector3 center = cam.ScreenToWorldPoint(new Vector3(Screen.width * 0.5f, Screen.height * 0.5f, z)); + Vector3 corner = cam.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, z)); + float halfW = Mathf.Abs(corner.x - center.x); + float halfH = Mathf.Abs(corner.y - center.y); + return Mathf.Sqrt(halfW * halfW + halfH * halfH); + } + + /// 沿每根射线方向 Raycast 检测(长度=斜边),扫到的普通鱼直接爆炸(防重复) + private void KillFishByGammaLasers(Transform center, Transform[] lasers, float laserLength, ref int killCount) + { + if (center == null || lasers == null || lasers.Length == 0) return; + if (gammaKillLayer.value == 0) + { + Debug.LogWarning("[XingJiXunHang] 伽马风暴杀鱼层 gammaKillLayer 未设置(Inspector 选 Fish 层),跳过杀鱼"); + gammaKillFish = false; // 只提示一次 + return; + } + + Vector3 sitPos = GetSeatPosition(); + foreach (var laser in lasers) + { + if (laser == null) continue; + + // 射线:从 Prop 中心朝激光朝向,距离 = 斜边长度(整根激光覆盖范围) + Vector2 origin = center.position; + Vector2 toEnd = (Vector2)laser.position - origin; + Vector2 dir = toEnd.sqrMagnitude < 0.0001f ? (Vector2)laser.up : toEnd.normalized; + if (dir.sqrMagnitude < 0.0001f) dir = Vector2.right; + dir.Normalize(); + + RaycastHit2D[] hits = Physics2D.RaycastAll(origin, dir, laserLength, gammaKillLayer); + if (hits == null || hits.Length == 0) continue; + + foreach (var hit in hits) + { + if (hit.collider == null || !hit.collider.CompareTag("Fish")) continue; + var monster = hit.collider.GetComponentInParent(); + if (monster == null) continue; + if (monster.fishenum != FishTypeEnum.普通鱼) continue; // 只炸普通鱼 + if (!_netKilledFish.Add(monster.guid)) continue; // 已炸过跳过 + + var coinNum = new RedPacketRecord + { + Amount = paoBei * monster.monsterData.fishTypeConfig.fishScore + }; + CreateFishManager.Instance.Id_DieFish_FX(monster.guid, coinNum, sitPos, isLocal: isSelf); + killCount++; + } + } } // ==================== 满屏暴击文字 ==================== @@ -1082,10 +1347,11 @@ public class XingJiXunHangEvent : BJEventBase return obj; } - /// 递归查找子物体 + /// 递归查找子物体(⭐ 忽略大小写,防预制体命名 laser1/Laser1 不一致) private Transform FindChildRecursive(Transform parent, string name) { - if (parent.name == name) return parent; + if (parent.name == name) + return parent; for (int i = 0; i < parent.childCount; i++) { @@ -1095,6 +1361,20 @@ public class XingJiXunHangEvent : BJEventBase return null; } + /// 递归查找子物体(忽略大小写版本,找不到再试精确) + private Transform FindChildIgnoreCase(Transform parent, string name) + { + if (string.Equals(parent.name, name, System.StringComparison.OrdinalIgnoreCase)) + return parent; + + for (int i = 0; i < parent.childCount; i++) + { + var result = FindChildIgnoreCase(parent.GetChild(i), name); + if (result != null) return result; + } + return null; + } + /// 物体移动协程 private IEnumerator MoveTo(Transform target, Vector3 destination, float duration) { @@ -1141,6 +1421,24 @@ public class XingJiXunHangEvent : BJEventBase return new Vector3(5, 0, 0); } + /// 获取屏幕顶部世界坐标 + private Vector3 GetScreenTop() + { + var cam = Camera.main; + if (cam != null) + return cam.ScreenToWorldPoint(new Vector3(Screen.width * 0.5f, Screen.height, cam.transform.position.z * -1f)); + return new Vector3(0, 5, 0); + } + + /// 获取屏幕底部世界坐标 + private Vector3 GetScreenBottom() + { + var cam = Camera.main; + if (cam != null) + return cam.ScreenToWorldPoint(new Vector3(Screen.width * 0.5f, 0, cam.transform.position.z * -1f)); + return new Vector3(0, -5, 0); + } + // ==================== 销毁 ==================== /// diff --git a/Assets/MyGame/aa/Game/XJMH/Boss/XingJiXunHang/dieFXPrefabAwardTmp.prefab b/Assets/MyGame/aa/Game/XJMH/Boss/XingJiXunHang/dieFXPrefabAwardTmp.prefab index 5d7d3fef6..d0b370dbd 100644 --- a/Assets/MyGame/aa/Game/XJMH/Boss/XingJiXunHang/dieFXPrefabAwardTmp.prefab +++ b/Assets/MyGame/aa/Game/XJMH/Boss/XingJiXunHang/dieFXPrefabAwardTmp.prefab @@ -116,6 +116,7 @@ MonoBehaviour: type: 3} tapTipName: tap_tip knockTipName: knock_tip + tipContainerName: Tip ironFistHoleName: Hole ironFistHandName: Hand ironFistCornerOffset: {x: 15, y: 10, z: 0} @@ -126,6 +127,11 @@ MonoBehaviour: symmetraLaserName: laser laserSwingAmplitude: 0.5 laserSwingCycles: 0 + laser1Name: laser1 + laser2Name: laser2 + laser3Name: laser3 + laser4Name: laser4 + laserExpandSpeed: 0.6 netSweepAmplitude: 20 netSweepCycles: 3 netSweepSpeed: 3 @@ -134,6 +140,19 @@ MonoBehaviour: serializedVersion: 2 m_Bits: 64 netKillFish: 1 + gammaLaserNames: + - Laser1 + - Laser2 + - Laser3 + - Laser4 + gammaRotateDelay: 1 + gammaRotateAngle: 90 + gammaShrinkStartAngle: 45 + gammaRotateSpeed: 120 + gammaKillLayer: + serializedVersion: 2 + m_Bits: 64 + gammaKillFish: 1 bjCount: 1 bjMinCount: 10 bjMaxCount: 15