From bab6963d7ef3c2756aba44e4cc361d7948b3cc8d Mon Sep 17 00:00:00 2001 From: wuyanchen <307378529@qq.com> Date: Sat, 20 Dec 2025 16:39:01 +0800 Subject: [PATCH] =?UTF-8?q?=C2=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bullet_BlazingRed_Small_Impact.prefab | 2 +- ...Bullet_BlazingRed_Small_MuzzleFlare.prefab | 2 +- Assets/Game1/Scenes/Game1_Level1.unity | 116 +++++++++++++++--- Assets/Scripts/Enemy.cs | 4 +- Assets/Scripts/EnemyManager.cs | 3 + Assets/Scripts/Shot.cs | 12 +- ProjectSettings/ProjectSettings.asset | 2 +- 7 files changed, 116 insertions(+), 25 deletions(-) diff --git a/Assets/EffectCore/packs/StylizedProjectilePack1/prefabs/Bullet/Bullet_BlazingRed/Bullet_Small_BlazingRed/Bullet_BlazingRed_Small_Impact.prefab b/Assets/EffectCore/packs/StylizedProjectilePack1/prefabs/Bullet/Bullet_BlazingRed/Bullet_Small_BlazingRed/Bullet_BlazingRed_Small_Impact.prefab index bb24393..16f6d0b 100644 --- a/Assets/EffectCore/packs/StylizedProjectilePack1/prefabs/Bullet/Bullet_BlazingRed/Bullet_Small_BlazingRed/Bullet_BlazingRed_Small_Impact.prefab +++ b/Assets/EffectCore/packs/StylizedProjectilePack1/prefabs/Bullet/Bullet_BlazingRed/Bullet_Small_BlazingRed/Bullet_BlazingRed_Small_Impact.prefab @@ -38626,7 +38626,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6cb8e485123f7054e9c91be1408589e4, type: 3} m_Name: m_EditorClassIdentifier: - deathtimer: 3 + deathtimer: 2 --- !u!1 &1947723841646622 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/EffectCore/packs/StylizedProjectilePack1/prefabs/Bullet/Bullet_BlazingRed/Bullet_Small_BlazingRed/Bullet_BlazingRed_Small_MuzzleFlare.prefab b/Assets/EffectCore/packs/StylizedProjectilePack1/prefabs/Bullet/Bullet_BlazingRed/Bullet_Small_BlazingRed/Bullet_BlazingRed_Small_MuzzleFlare.prefab index 1d5295d..79c9017 100644 --- a/Assets/EffectCore/packs/StylizedProjectilePack1/prefabs/Bullet/Bullet_BlazingRed/Bullet_Small_BlazingRed/Bullet_BlazingRed_Small_MuzzleFlare.prefab +++ b/Assets/EffectCore/packs/StylizedProjectilePack1/prefabs/Bullet/Bullet_BlazingRed/Bullet_Small_BlazingRed/Bullet_BlazingRed_Small_MuzzleFlare.prefab @@ -4811,7 +4811,7 @@ Transform: serializedVersion: 2 m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalScale: {x: 0.6, y: 0.6, z: 0.6} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 4000012572821648} diff --git a/Assets/Game1/Scenes/Game1_Level1.unity b/Assets/Game1/Scenes/Game1_Level1.unity index bd7c33b..27e7684 100644 --- a/Assets/Game1/Scenes/Game1_Level1.unity +++ b/Assets/Game1/Scenes/Game1_Level1.unity @@ -673,7 +673,7 @@ MonoBehaviour: type: 3} muzzlePrefab: {fileID: 4000010921236120, guid: 66ce0f27574363a4dabe7162e2636e3f, type: 3} - shotAudioClip: {fileID: 8300000, guid: a6290313a43dc7c4fb5c684559b9b776, type: 3} + shotAudioClip: {fileID: 8300000, guid: 038911361e37ae84b8fdc585b7b83895, type: 3} --- !u!1 &260372503 GameObject: m_ObjectHideFlags: 0 @@ -1679,10 +1679,25 @@ PrefabInstance: value: objectReference: {fileID: 4000010921236120, guid: 2cc07ac0b88fafc40b730713b6dac672, type: 3} + - target: {fileID: 279031484294811146, guid: 435ba18295a2b0240b1511cd4d5a7bc3, + type: 3} + propertyPath: hitAudioClip + value: + objectReference: {fileID: 8300000, guid: 66e0e24e6ada67b4ba418891e0d2460a, type: 3} + - target: {fileID: 279031484294811146, guid: 435ba18295a2b0240b1511cd4d5a7bc3, + type: 3} + propertyPath: isShowMuzzle + value: 1 + objectReference: {fileID: 0} - target: {fileID: 279031484294811146, guid: 435ba18295a2b0240b1511cd4d5a7bc3, type: 3} propertyPath: shotDuration - value: 0.35 + value: 0.2 + objectReference: {fileID: 0} + - target: {fileID: 279031484294811146, guid: 435ba18295a2b0240b1511cd4d5a7bc3, + type: 3} + propertyPath: shotOffsetZMul + value: -1 objectReference: {fileID: 0} - target: {fileID: 1083892317890881295, guid: 435ba18295a2b0240b1511cd4d5a7bc3, type: 3} @@ -1762,10 +1777,25 @@ PrefabInstance: value: objectReference: {fileID: 4000010921236120, guid: 2cc07ac0b88fafc40b730713b6dac672, type: 3} + - target: {fileID: 2521485966335614540, guid: 435ba18295a2b0240b1511cd4d5a7bc3, + type: 3} + propertyPath: hitAudioClip + value: + objectReference: {fileID: 8300000, guid: 66e0e24e6ada67b4ba418891e0d2460a, type: 3} + - target: {fileID: 2521485966335614540, guid: 435ba18295a2b0240b1511cd4d5a7bc3, + type: 3} + propertyPath: isShowMuzzle + value: 1 + objectReference: {fileID: 0} - target: {fileID: 2521485966335614540, guid: 435ba18295a2b0240b1511cd4d5a7bc3, type: 3} propertyPath: shotDuration - value: 0.35 + value: 0.2 + objectReference: {fileID: 0} + - target: {fileID: 2521485966335614540, guid: 435ba18295a2b0240b1511cd4d5a7bc3, + type: 3} + propertyPath: shotOffsetZMul + value: -1 objectReference: {fileID: 0} - target: {fileID: 4123303403043117342, guid: 435ba18295a2b0240b1511cd4d5a7bc3, type: 3} @@ -1820,10 +1850,25 @@ PrefabInstance: value: objectReference: {fileID: 4000010921236120, guid: 2cc07ac0b88fafc40b730713b6dac672, type: 3} + - target: {fileID: 5445074278298902311, guid: 435ba18295a2b0240b1511cd4d5a7bc3, + type: 3} + propertyPath: hitAudioClip + value: + objectReference: {fileID: 8300000, guid: 66e0e24e6ada67b4ba418891e0d2460a, type: 3} + - target: {fileID: 5445074278298902311, guid: 435ba18295a2b0240b1511cd4d5a7bc3, + type: 3} + propertyPath: isShowMuzzle + value: 1 + objectReference: {fileID: 0} - target: {fileID: 5445074278298902311, guid: 435ba18295a2b0240b1511cd4d5a7bc3, type: 3} propertyPath: shotDuration - value: 0.35 + value: 0.2 + objectReference: {fileID: 0} + - target: {fileID: 5445074278298902311, guid: 435ba18295a2b0240b1511cd4d5a7bc3, + type: 3} + propertyPath: shotOffsetZMul + value: -1 objectReference: {fileID: 0} - target: {fileID: 5684374028056023295, guid: 435ba18295a2b0240b1511cd4d5a7bc3, type: 3} @@ -1848,10 +1893,25 @@ PrefabInstance: value: objectReference: {fileID: 4000010921236120, guid: 2cc07ac0b88fafc40b730713b6dac672, type: 3} + - target: {fileID: 5684374028056023295, guid: 435ba18295a2b0240b1511cd4d5a7bc3, + type: 3} + propertyPath: hitAudioClip + value: + objectReference: {fileID: 8300000, guid: 66e0e24e6ada67b4ba418891e0d2460a, type: 3} + - target: {fileID: 5684374028056023295, guid: 435ba18295a2b0240b1511cd4d5a7bc3, + type: 3} + propertyPath: isShowMuzzle + value: 1 + objectReference: {fileID: 0} - target: {fileID: 5684374028056023295, guid: 435ba18295a2b0240b1511cd4d5a7bc3, type: 3} propertyPath: shotDuration - value: 0.35 + value: 0.2 + objectReference: {fileID: 0} + - target: {fileID: 5684374028056023295, guid: 435ba18295a2b0240b1511cd4d5a7bc3, + type: 3} + propertyPath: shotOffsetZMul + value: -1 objectReference: {fileID: 0} - target: {fileID: 7381137082989080464, guid: 435ba18295a2b0240b1511cd4d5a7bc3, type: 3} @@ -1921,10 +1981,25 @@ PrefabInstance: value: objectReference: {fileID: 4000010921236120, guid: 2cc07ac0b88fafc40b730713b6dac672, type: 3} + - target: {fileID: 8361625887681834942, guid: 435ba18295a2b0240b1511cd4d5a7bc3, + type: 3} + propertyPath: hitAudioClip + value: + objectReference: {fileID: 8300000, guid: 66e0e24e6ada67b4ba418891e0d2460a, type: 3} + - target: {fileID: 8361625887681834942, guid: 435ba18295a2b0240b1511cd4d5a7bc3, + type: 3} + propertyPath: isShowMuzzle + value: 1 + objectReference: {fileID: 0} - target: {fileID: 8361625887681834942, guid: 435ba18295a2b0240b1511cd4d5a7bc3, type: 3} propertyPath: shotDuration - value: 0.35 + value: 0.2 + objectReference: {fileID: 0} + - target: {fileID: 8361625887681834942, guid: 435ba18295a2b0240b1511cd4d5a7bc3, + type: 3} + propertyPath: shotOffsetZMul + value: -1 objectReference: {fileID: 0} - target: {fileID: 8610239330163254585, guid: 435ba18295a2b0240b1511cd4d5a7bc3, type: 3} @@ -2263,6 +2338,7 @@ MonoBehaviour: - {fileID: 1524927940} enemyAppearDuration: 0.4 boomClip: {fileID: 0} + boomVolumeScale: 0.5 enemyPrefabList: - {fileID: 9189720110917698241, guid: a0ea8c1b8af081a459ef66f94c2fb8a9, type: 3} - {fileID: 3945929085796109409, guid: c3dd86b0185852f46870c47a20c55de6, type: 3} @@ -2600,7 +2676,7 @@ MonoBehaviour: type: 3} muzzlePrefab: {fileID: 4000010921236120, guid: 6a0a0f7a97e0e7747accda091cb14743, type: 3} - shotAudioClip: {fileID: 8300000, guid: a6290313a43dc7c4fb5c684559b9b776, type: 3} + shotAudioClip: {fileID: 8300000, guid: 038911361e37ae84b8fdc585b7b83895, type: 3} --- !u!1 &1138813630 GameObject: m_ObjectHideFlags: 0 @@ -2630,7 +2706,7 @@ RectTransform: m_GameObject: {fileID: 1138813630} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1.9131944, y: 1.9131944, z: 1} + m_LocalScale: {x: 4.2899303, y: 4.2899303, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 97192695} @@ -2744,7 +2820,7 @@ MonoBehaviour: type: 3} muzzlePrefab: {fileID: 4000010921236120, guid: 033d08e548a8e0c4b85a2110d068aaa0, type: 3} - shotAudioClip: {fileID: 8300000, guid: a6290313a43dc7c4fb5c684559b9b776, type: 3} + shotAudioClip: {fileID: 8300000, guid: 038911361e37ae84b8fdc585b7b83895, type: 3} --- !u!1 &1291040292 GameObject: m_ObjectHideFlags: 0 @@ -3261,7 +3337,7 @@ MonoBehaviour: type: 3} muzzlePrefab: {fileID: 4000010921236120, guid: 3735129208580034781b585da5229bda, type: 3} - shotAudioClip: {fileID: 8300000, guid: a6290313a43dc7c4fb5c684559b9b776, type: 3} + shotAudioClip: {fileID: 8300000, guid: 038911361e37ae84b8fdc585b7b83895, type: 3} --- !u!1 &1647833152 GameObject: m_ObjectHideFlags: 0 @@ -3667,17 +3743,17 @@ MonoBehaviour: turret: {fileID: 0} gun: {fileID: 0} shotAudioClip: {fileID: 8300000, guid: 038911361e37ae84b8fdc585b7b83895, type: 3} - hitAudioClip: {fileID: 8300000, guid: a6290313a43dc7c4fb5c684559b9b776, type: 3} - shotDuration: 0.35 + hitAudioClip: {fileID: 8300000, guid: 66e0e24e6ada67b4ba418891e0d2460a, type: 3} + shotDuration: 0.2 shotNextDuration: 0.1 shotDistance: 18 shotSpeed: 20 initBulletCount: 15 - shotOffsetZMul: 0 + shotOffsetZMul: -1 shotFixAngleX: 0 lerpSpeed: 8 isAutoLock: 0 - isShowMuzzle: 0 + isShowMuzzle: 1 pressAction: {fileID: 76562581802851548, guid: 50486e0197319e948b872b25ef15b507, type: 3} --- !u!114 &1866826697 stripped @@ -3758,17 +3834,17 @@ MonoBehaviour: turret: {fileID: 0} gun: {fileID: 0} shotAudioClip: {fileID: 8300000, guid: 038911361e37ae84b8fdc585b7b83895, type: 3} - hitAudioClip: {fileID: 8300000, guid: a6290313a43dc7c4fb5c684559b9b776, type: 3} - shotDuration: 0.35 + hitAudioClip: {fileID: 8300000, guid: 66e0e24e6ada67b4ba418891e0d2460a, type: 3} + shotDuration: 0.2 shotNextDuration: 0.1 shotDistance: 18 shotSpeed: 20 initBulletCount: 15 - shotOffsetZMul: 0 + shotOffsetZMul: -1 shotFixAngleX: 0 lerpSpeed: 8 isAutoLock: 0 - isShowMuzzle: 0 + isShowMuzzle: 1 pressAction: {fileID: 76562581802851548, guid: 50486e0197319e948b872b25ef15b507, type: 3} --- !u!1 &1940277531 @@ -3896,7 +3972,7 @@ RectTransform: m_GameObject: {fileID: 2083258305} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1.9131944, y: 1.9131944, z: 1} + m_LocalScale: {x: 4.2899303, y: 4.2899303, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 97192695} @@ -4010,7 +4086,7 @@ MonoBehaviour: type: 3} muzzlePrefab: {fileID: 4000010921236120, guid: 2cc07ac0b88fafc40b730713b6dac672, type: 3} - shotAudioClip: {fileID: 8300000, guid: a6290313a43dc7c4fb5c684559b9b776, type: 3} + shotAudioClip: {fileID: 8300000, guid: 038911361e37ae84b8fdc585b7b83895, type: 3} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Enemy.cs b/Assets/Scripts/Enemy.cs index 1f5a69e..7fd91d4 100644 --- a/Assets/Scripts/Enemy.cs +++ b/Assets/Scripts/Enemy.cs @@ -20,6 +20,8 @@ public class Enemy : MonoBehaviour public int health = 100; [Tooltip("爆炸音效")] public AudioClip boomClip; + [Tooltip("爆炸音效的音量")] + public float boomVolumeScale = 1f; [Tooltip("X角度偏移")] public float addEulerX = 0f; [Tooltip("是否开始的时候修改主材质颜色")] @@ -161,7 +163,7 @@ public class Enemy : MonoBehaviour { if (boomClip != null) { - AudioTool.AudioSource.PlayOneShot(boomClip); + AudioTool.AudioSource.PlayOneShot(boomClip, boomVolumeScale); } gameObject.transform.DOKill(true); Global.LockedEnemies.Remove(GetHashCode()); diff --git a/Assets/Scripts/EnemyManager.cs b/Assets/Scripts/EnemyManager.cs index 91a0d3d..5a9bcd0 100644 --- a/Assets/Scripts/EnemyManager.cs +++ b/Assets/Scripts/EnemyManager.cs @@ -15,6 +15,8 @@ public class EnemyManager : MonoBehaviour public float enemyAppearDuration = 0.1f; [Tooltip("爆炸音效")] public AudioClip boomClip; + [Tooltip("爆炸音效的音量")] + public float boomVolumeScale = 1f; //public Transform endLoc; public Transform[] enemyPrefabList = new Transform[] { }; @@ -156,6 +158,7 @@ public class EnemyManager : MonoBehaviour if (boomClip != null) { enemyComp.boomClip = boomClip; + enemyComp.boomVolumeScale = boomVolumeScale; } //Debug.Log(enemy.eulerAngles); Global.Enemies.Add(enemyComp); diff --git a/Assets/Scripts/Shot.cs b/Assets/Scripts/Shot.cs index 90e44b2..20d7cca 100644 --- a/Assets/Scripts/Shot.cs +++ b/Assets/Scripts/Shot.cs @@ -1,5 +1,6 @@ using Assets.Scripts; using DG.Tweening; +using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; @@ -80,6 +81,11 @@ public class Shot : MonoBehaviour private List activeBulletPool = new(); private List activeImpactPool = new(); + /// + /// 上一次发射的时间 + /// + private static DateTime beforeShotTime = DateTime.Now; + private Camera _cam = null; void Awake() @@ -449,7 +455,11 @@ public class Shot : MonoBehaviour // 1. 播放音效 if (!isNextLineShot && shotAudioClip != null) { - AudioTool.AudioSource.PlayOneShot(shotAudioClip, 0.5f); + if(DateTime.Now - beforeShotTime > TimeSpan.FromSeconds(shotDuration)) + { + beforeShotTime = DateTime.Now; + AudioTool.AudioSource.PlayOneShot(shotAudioClip); + } } // 2. 计算发射位置(确保使用世界坐标) diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index af283e0..71bd6ec 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -1020,7 +1020,7 @@ PlayerSettings: -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s TOTAL_MEMORY=256MB -s EXPORTED_RUNTIME_METHODS=''["ccall","cwrap","stackTrace","addRunDependency","removeRunDependency","FS_createPath","FS_createDataFile","stackTrace","writeStackCookie","checkStackCookie","lengthBytesUTF8","stringToUTF8"]'' --profiling-funcs ' weixinMiniGameModulesDirectory: - weixinMiniGameTemplate: PATH:E:\Dev3\UMiniGame\Library\PackageCache\com.qq.weixin.minigame@4443e5a9bc\WebGLTemplates\WXTemplate2022TJ + weixinMiniGameTemplate: PATH:H:\Dev\UMiniGame\Library\PackageCache\com.qq.weixin.minigame@4443e5a9bc\WebGLTemplates\WXTemplate2022TJ weixinMiniGameAnalyzeBuildSize: 0 weixinMiniGameUseEmbeddedResources: 0 weixinMiniGameCompressionFormat: 2