feat(audio): Integrated level-specific sound effects and music control

-Add LevelSpecificPlayerSFX prefabs for levels 1-1 and 1-2
-Configure checkpoints to activate sound effects, including pitch, volume, and audio editing
-Rename the checkpoint effect object to Checkpoint VFX
-Update the audio manager, the default value of the music target volume is 0.2
-Add SoundEffect structure to support sound parameter configuration
-Optimize audio source creation and crossfade logic
-Remove the old music control components and use the new audio management method
This commit is contained in:
Данил Ярош 2025-10-29 16:46:24 +03:00
parent 0f9c407d70
commit a845161079
57 changed files with 38460 additions and 768 deletions

View File

@ -9,6 +9,8 @@ Material:
m_PrefabAsset: {fileID: 0}
m_Name: Sky0006_NightMoon
m_Shader: {fileID: 108, guid: 0000000000000000f000000000000000, type: 0}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords:
- _MAPPING_LATITUDE_LONGITUDE_LAYOUT
@ -18,13 +20,38 @@ Material:
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BackTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DownTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FrontTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _LeftTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 00817bec0fc275d41897c8ba9937c695, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _RightTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _UpTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _Exposure: 1
@ -36,3 +63,4 @@ Material:
m_Colors:
- _Tint: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
m_BuildTextureStacks: []
m_AllowLocking: 1

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -67,7 +67,7 @@ BoxCollider2D:
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: 0, y: 1}
m_Offset: {x: 0, y: 1.8368388}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
@ -77,7 +77,7 @@ BoxCollider2D:
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Size: {x: 1, y: 2}
m_Size: {x: 3, y: 3.6736777}
m_EdgeRadius: 0
--- !u!1 &3389416862734085400
GameObject:
@ -105,8 +105,8 @@ Transform:
m_GameObject: {fileID: 3389416862734085400}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 1.3, z: -1}
m_LocalScale: {x: 0.185, y: 0.185, z: 0.185}
m_LocalPosition: {x: 0, y: 1.7, z: -1}
m_LocalScale: {x: 0.25, y: 0.25, z: 0.25}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 2891592954758516483}
@ -131,6 +131,8 @@ SpriteRenderer:
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
@ -152,8 +154,9 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 1712314021
m_SortingLayer: -2
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 96d583b182e4be4488f6bb2fe7012180, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}

View File

@ -0,0 +1,47 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &404954465884221010
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3117561262541012963}
- component: {fileID: 1393790780435193682}
m_Layer: 0
m_Name: LevelSpecificPlayerSFX
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3117561262541012963
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 404954465884221010}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 7.21873, y: -3.2098699, z: -0.19702429}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1393790780435193682
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 404954465884221010}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 01e0462d1726c8e47977e0bc4c86608a, type: 3}
m_Name:
m_EditorClassIdentifier: '::'
levelStepSounds: {fileID: 0}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4871f8ebaa803cd44900fa7f708836e4
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 44081d4997ebc78418c03a0fa021336d
AudioImporter:
externalObjects: {}
serializedVersion: 8
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 64a82f6dc3cfec746bcc23ded9a926ee
AudioImporter:
externalObjects: {}
serializedVersion: 8
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 6aedae21e708ea448b1ed0468415c094
AudioImporter:
externalObjects: {}
serializedVersion: 8
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 66f130eb74c4f9249ae760f50057506f
AudioImporter:
externalObjects: {}
serializedVersion: 8
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -83327,6 +83327,18 @@ PrefabInstance:
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateVfx
value:
objectReference: {fileID: 1528420257}
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateSfx.pitch
value: 1.2
objectReference: {fileID: 0}
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateSfx.sound
value:
objectReference: {fileID: 8300000, guid: cfbbacd3ef3f01743aa42aea3cb29270, type: 3}
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateSfx.volume
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5491244471745524865, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: m_LocalPosition.x
@ -85499,6 +85511,18 @@ PrefabInstance:
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateVfx
value:
objectReference: {fileID: 1528420257}
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateSfx.pitch
value: 1.2
objectReference: {fileID: 0}
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateSfx.sound
value:
objectReference: {fileID: 8300000, guid: cfbbacd3ef3f01743aa42aea3cb29270, type: 3}
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateSfx.volume
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5491244471745524865, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: m_LocalPosition.x
@ -113583,6 +113607,18 @@ PrefabInstance:
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateVfx
value:
objectReference: {fileID: 1528420257}
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateSfx.pitch
value: 1.2
objectReference: {fileID: 0}
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateSfx.sound
value:
objectReference: {fileID: 8300000, guid: cfbbacd3ef3f01743aa42aea3cb29270, type: 3}
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateSfx.volume
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5491244471745524865, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: m_LocalPosition.x
@ -117982,6 +118018,7 @@ Transform:
- {fileID: 94085880}
- {fileID: 105165846}
- {fileID: 1528420254}
- {fileID: 3607579658351639124}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1054736783
@ -180899,6 +180936,18 @@ PrefabInstance:
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateVfx
value:
objectReference: {fileID: 1528420257}
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateSfx.pitch
value: 1.2
objectReference: {fileID: 0}
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateSfx.sound
value:
objectReference: {fileID: 8300000, guid: cfbbacd3ef3f01743aa42aea3cb29270, type: 3}
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateSfx.volume
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5491244471745524865, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: m_LocalPosition.x
@ -186201,9 +186250,8 @@ GameObject:
- component: {fileID: 1528420254}
- component: {fileID: 1528420257}
- component: {fileID: 1528420256}
- component: {fileID: 1528420255}
m_Layer: 0
m_Name: CheckpointFX
m_Name: CheckpointVFX
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -186224,23 +186272,6 @@ Transform:
m_Children: []
m_Father: {fileID: 1053302775}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1528420255
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1528420253}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: edb963f0614ea6e4c88c887b3ef08ba6, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::RR.Game2D.FX.CheckPointFX
checkPointVFX: {fileID: 1528420257}
checkpointSFX:
sound: {fileID: 8300000, guid: cfbbacd3ef3f01743aa42aea3cb29270, type: 3}
volume: 0.25
pitch: 1.2
--- !u!73398921 &1528420256
VFXRenderer:
serializedVersion: 1
@ -383334,6 +383365,68 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1001 &3607579658351639123
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1053302775}
m_Modifications:
- target: {fileID: 404954465884221010, guid: 4871f8ebaa803cd44900fa7f708836e4, type: 3}
propertyPath: m_Name
value: LevelSpecificPlayerSFX
objectReference: {fileID: 0}
- target: {fileID: 3117561262541012963, guid: 4871f8ebaa803cd44900fa7f708836e4, type: 3}
propertyPath: m_LocalPosition.x
value: -24.01362
objectReference: {fileID: 0}
- target: {fileID: 3117561262541012963, guid: 4871f8ebaa803cd44900fa7f708836e4, type: 3}
propertyPath: m_LocalPosition.y
value: -4.47511
objectReference: {fileID: 0}
- target: {fileID: 3117561262541012963, guid: 4871f8ebaa803cd44900fa7f708836e4, type: 3}
propertyPath: m_LocalPosition.z
value: 0.12992167
objectReference: {fileID: 0}
- target: {fileID: 3117561262541012963, guid: 4871f8ebaa803cd44900fa7f708836e4, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3117561262541012963, guid: 4871f8ebaa803cd44900fa7f708836e4, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3117561262541012963, guid: 4871f8ebaa803cd44900fa7f708836e4, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3117561262541012963, guid: 4871f8ebaa803cd44900fa7f708836e4, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3117561262541012963, guid: 4871f8ebaa803cd44900fa7f708836e4, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3117561262541012963, guid: 4871f8ebaa803cd44900fa7f708836e4, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3117561262541012963, guid: 4871f8ebaa803cd44900fa7f708836e4, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 4871f8ebaa803cd44900fa7f708836e4, type: 3}
--- !u!4 &3607579658351639124 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 3117561262541012963, guid: 4871f8ebaa803cd44900fa7f708836e4, type: 3}
m_PrefabInstance: {fileID: 3607579658351639123}
m_PrefabAsset: {fileID: 0}
--- !u!4 &3916284953315205635
Transform:
m_ObjectHideFlags: 0
@ -383566,6 +383659,18 @@ PrefabInstance:
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateVfx
value:
objectReference: {fileID: 1528420257}
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateSfx.pitch
value: 1.2
objectReference: {fileID: 0}
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateSfx.sound
value:
objectReference: {fileID: 8300000, guid: cfbbacd3ef3f01743aa42aea3cb29270, type: 3}
- target: {fileID: 2823314259245713668, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: activateSfx.volume
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5491244471745524865, guid: 1c7455363049dbc4996e240f0bcdceff, type: 3}
propertyPath: m_LocalPosition.x

View File

@ -831,6 +831,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7539278310704649697}
- {fileID: 3672286317840359603}
- {fileID: 260699644}
- {fileID: 386207812}
@ -5560,67 +5561,6 @@ Transform:
m_CorrespondingSourceObject: {fileID: 4535171522523579101, guid: 6ab87d9d9d9f20e4c86df42ae805f6f4, type: 3}
m_PrefabInstance: {fileID: 27567628}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &593214697
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 361486735828258013, guid: 9cee1e552b11c5844aca4d1e755b65f8, type: 3}
propertyPath: musicClip
value:
objectReference: {fileID: 8300000, guid: ff6aa1560276fae488e89d642928a57a, type: 3}
- target: {fileID: 4019462856715984920, guid: 9cee1e552b11c5844aca4d1e755b65f8, type: 3}
propertyPath: m_Name
value: Music
objectReference: {fileID: 0}
- target: {fileID: 7680842389916411230, guid: 9cee1e552b11c5844aca4d1e755b65f8, type: 3}
propertyPath: m_LocalPosition.x
value: 9.4576
objectReference: {fileID: 0}
- target: {fileID: 7680842389916411230, guid: 9cee1e552b11c5844aca4d1e755b65f8, type: 3}
propertyPath: m_LocalPosition.y
value: 1.61247
objectReference: {fileID: 0}
- target: {fileID: 7680842389916411230, guid: 9cee1e552b11c5844aca4d1e755b65f8, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7680842389916411230, guid: 9cee1e552b11c5844aca4d1e755b65f8, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7680842389916411230, guid: 9cee1e552b11c5844aca4d1e755b65f8, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7680842389916411230, guid: 9cee1e552b11c5844aca4d1e755b65f8, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7680842389916411230, guid: 9cee1e552b11c5844aca4d1e755b65f8, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7680842389916411230, guid: 9cee1e552b11c5844aca4d1e755b65f8, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7680842389916411230, guid: 9cee1e552b11c5844aca4d1e755b65f8, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7680842389916411230, guid: 9cee1e552b11c5844aca4d1e755b65f8, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9cee1e552b11c5844aca4d1e755b65f8, type: 3}
--- !u!1001 &593988813
PrefabInstance:
m_ObjectHideFlags: 0
@ -19805,6 +19745,24 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &361486735346282548
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4019462857232309489}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 66bc203e34559bc48a35861084992cf5, type: 3}
m_Name:
m_EditorClassIdentifier: '::'
audioManager: {fileID: 0}
musicClip: {fileID: 8300000, guid: ff6aa1560276fae488e89d642928a57a, type: 3}
musicVolume: 0.1
loop: 1
useCrossfade: 1
fadeDuration: 3
--- !u!1 &380738911231601503
GameObject:
m_ObjectHideFlags: 0
@ -64482,6 +64440,23 @@ Transform:
- {fileID: 6183155659300539433}
m_Father: {fileID: 6611089448804563399}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &4019462857232309489
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7680842389365283255}
- component: {fileID: 361486735346282548}
m_Layer: 0
m_Name: Music
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &4052001396589768985
GameObject:
m_ObjectHideFlags: 0
@ -116467,6 +116442,23 @@ Transform:
- {fileID: 5895621491565767764}
m_Father: {fileID: 317328332}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &5079364587827053648
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7539278310704649697}
- component: {fileID: 5815437439318111568}
m_Layer: 0
m_Name: LevelSpecificPlayerSFX
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &5120977597572568972
SpriteRenderer:
m_ObjectHideFlags: 0
@ -118368,6 +118360,19 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &5815437439318111568
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5079364587827053648}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 01e0462d1726c8e47977e0bc4c86608a, type: 3}
m_Name:
m_EditorClassIdentifier: '::'
levelStepSounds: {fileID: 11400000, guid: 7f4c15e584a7d854bb922b709c03043d, type: 2}
--- !u!114 &5819441190413568386
MonoBehaviour:
m_ObjectHideFlags: 0
@ -200089,6 +200094,21 @@ MonoBehaviour:
- {x: -0.89938307, y: 1.7228398, z: 0}
- {x: 0.8626542, y: 1.7262348, z: 0}
- {x: 1.3780866, y: 3.470371, z: 0}
--- !u!4 &7539278310704649697
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5079364587827053648}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 7.21873, y: -3.2098699, z: -0.19702429}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 88089423}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &7561824525930767536
SpriteRenderer:
m_ObjectHideFlags: 0
@ -200374,6 +200394,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c9bf14759f50fe840881e3893e823b55, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::RR.Game2D.Entities.Hazards.Trap
--- !u!4 &7680842389365283255
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4019462857232309489}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 9.4576, y: 1.61247, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &7682785430691710036
SpriteRenderer:
m_ObjectHideFlags: 0
@ -203574,4 +203609,4 @@ SceneRoots:
- {fileID: 88089423}
- {fileID: 2086062556}
- {fileID: 1685954871}
- {fileID: 593214697}
- {fileID: 7680842389365283255}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ef4d2872581fd9a47ad3ca34516c7fdb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

37169
Assets/Scenes/Levels/1-3.unity Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 970503f52fc318443aa802884a95f012
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,63 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
m_Name: Global Light Profile
m_EditorClassIdentifier: Unity.RenderPipelines.Core.Runtime::UnityEngine.Rendering.VolumeProfile
components:
- {fileID: 9167928885711641750}
--- !u!114 &9167928885711641750
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
m_Name: Bloom
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.Bloom
active: 1
skipIterations:
m_OverrideState: 0
m_Value: 1
threshold:
m_OverrideState: 0
m_Value: 0.9
intensity:
m_OverrideState: 1
m_Value: 0
scatter:
m_OverrideState: 0
m_Value: 0.7
clamp:
m_OverrideState: 0
m_Value: 65472
tint:
m_OverrideState: 0
m_Value: {r: 1, g: 1, b: 1, a: 1}
highQualityFiltering:
m_OverrideState: 0
m_Value: 0
downscale:
m_OverrideState: 0
m_Value: 0
maxIterations:
m_OverrideState: 0
m_Value: 6
dirtTexture:
m_OverrideState: 0
m_Value: {fileID: 0}
dimension: 1
dirtIntensity:
m_OverrideState: 0
m_Value: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3dae892882a893c4da58e8534a7452bb
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 54bf06b85c0d2a242ae6298259a1d7d4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 112000000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,169 @@
fileFormatVersion: 2
guid: 3a3c15d25031dcb4f9bd991bcfdd3719
TextureImporter:
internalIDToNameTable:
- first:
213: -6178708042526665401
second: ReflectionProbe-0_0
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 1
seamlessCubemap: 1
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 2
aniso: 0
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 2
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 100
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WindowsStoreApps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: ReflectionProbe-0_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 4
height: 4
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 745595285c1d04aa0800000000000000
internalID: -6178708042526665401
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
ReflectionProbe-0_0: -6178708042526665401
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,4 +1,6 @@
using RR.Common.Managers;
using System;
using RR.Common.Audio;
using RR.Common.Managers;
using RR.Game2D.Behaviour;
using RR.Game2D.Behaviour.ScriptableObjects;
using RR.Game2D.Core.Managers;
@ -13,14 +15,25 @@ namespace RR.Game2D.Animations
private SFXAsset _jumpSounds;
private Rigidbody2D _rb;
private void OnEnable() => LevelPlayerSFX.Instance.SFXChanged += UpdateSFX;
private void OnDisable() => LevelPlayerSFX.Instance.SFXChanged -= UpdateSFX;
private void Awake()
{
PlayerController controller = GetComponent<PlayerController>();
UpdateSFX();
_rb = GetComponent<Rigidbody2D>();
}
private void UpdateSFX()
{
PlayerController controller = GetComponent<PlayerController>();
_stepSounds = controller.stepSounds;
_hurtSounds = controller.hurtSounds;
_jumpSounds = controller.jumpSounds;
_rb = GetComponent<Rigidbody2D>();
}
public void OnDeathBegin()

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8c7d79d51add62e44b552fc4ae97d91b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,45 @@
using System;
using RR.Game2D.Behaviour;
using RR.Game2D.Behaviour.ScriptableObjects;
using RR.Game2D.Core.Managers;
using UnityEngine;
namespace RR.Common.Audio
{
public class LevelPlayerSFX : MonoBehaviour
{
public static LevelPlayerSFX Instance {get; private set; }
[SerializeField] private SFXAsset levelStepSounds;
public event Action SFXChanged;
private void OnEnable() => GameManager.Instance.PlayerSpawned += OnPlayerSpawned;
private void OnDisable() => GameManager.Instance.PlayerSpawned -= OnPlayerSpawned;
private void Awake()
{
if (Instance != null && Instance != this)
{
Destroy(gameObject);
return;
}
Instance = this;
DontDestroyOnLoad(gameObject);
}
private void OnPlayerSpawned(GameObject obj)
{
PlayerController playerController = obj.GetComponent<PlayerController>();
if (playerController == null) return;
if (levelStepSounds != null)
{
playerController.stepSounds = levelStepSounds;
SFXChanged?.Invoke();
}
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 01e0462d1726c8e47977e0bc4c86608a

View File

@ -0,0 +1,13 @@
using System;
using UnityEngine;
namespace RR.Common.Audio
{
[Serializable]
public struct SoundEffect
{
public AudioClip sound;
[Min(0f)]public float volume;
public float pitch;
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5e51918de3458024fa70e8968e61d91f

View File

@ -1,10 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
using Random = UnityEngine.Random;
using RR.Common.Audio;
namespace RR.Common.Managers
{
public class AudioManager : MonoBehaviour
@ -12,24 +13,24 @@ namespace RR.Common.Managers
// ==== Singleton ====
public static AudioManager Instance { get; private set; }
[Header("Music")]
[SerializeField] private AudioSource musicSource; // child: MusicSource
[SerializeField] private AudioSource tempMusicSource; // child: TempMusicSource
[Header("Music")] [SerializeField] private AudioSource musicSource; // child: MusicSource
[SerializeField] private AudioSource tempMusicSource; // child: TempMusicSource
[Tooltip("Группа микшера для музыки (необязательно)")]
[SerializeField] private AudioMixerGroup musicMixerGroup;
[Tooltip("Группа микшера для музыки (необязательно)")] [SerializeField]
private AudioMixerGroup musicMixerGroup;
[Tooltip("Целевой громкость музыки (после фейдов)")]
[Range(0f, 1.5f)] public float musicTargetVolume = 1f;
[Tooltip("Целевая громкость музыки (после фейдов)")] [Range(0f, 1.5f)]
public float musicTargetVolume = 0.2f;
[Tooltip("Длительность фейда по умолчанию (сек)")]
[SerializeField] private float defaultFadeDuration = 0.8f;
[Tooltip("Длительность фейда по умолчанию (сек)")] [SerializeField]
private float defaultFadeDuration = 0.8f;
[Header("SFX Pool")]
[SerializeField] private int sfxPoolSize = 8;
[Header("SFX Pool")] [SerializeField] private int sfxPoolSize = 8;
[SerializeField] private Transform sfxPoolParent; // child: SFX Pool
[Tooltip("Группа микшера для SFX (необязательно)")]
[SerializeField] private AudioMixerGroup sfxMixerGroup;
[Tooltip("Группа микшера для SFX (необязательно)")] [SerializeField]
private AudioMixerGroup sfxMixerGroup;
[Range(0f, 1.5f)] public float sfxDefaultVolume = 1f;
private readonly List<AudioSource> sfxPool = new List<AudioSource>(64);
@ -41,7 +42,8 @@ namespace RR.Common.Managers
private float storedMusicVolumeBeforePause = 1f;
private bool isPausedFaded = false;
#region Unity Lifetime
#region Unity Lifetime
public void Initialize()
{
// Singleton init
@ -50,6 +52,7 @@ namespace RR.Common.Managers
Destroy(gameObject);
return;
}
Instance = this;
DontDestroyOnLoad(gameObject);
@ -69,14 +72,17 @@ namespace RR.Common.Managers
var t = transform.Find("MusicSource");
if (t != null) musicSource = t.GetComponent<AudioSource>();
}
if (tempMusicSource == null)
{
var t = transform.Find("TempMusicSource");
if (t != null) tempMusicSource = t.GetComponent<AudioSource>();
}
if (musicSource == null) musicSource = CreateChildAudioSource("MusicSource", loop: true, output: musicMixerGroup);
if (tempMusicSource == null) tempMusicSource = CreateChildAudioSource("TempMusicSource", loop: true, output: musicMixerGroup);
if (musicSource == null)
musicSource = CreateChildAudioSource("MusicSource", loop: true, output: musicMixerGroup);
if (tempMusicSource == null)
tempMusicSource = CreateChildAudioSource("TempMusicSource", loop: true, output: musicMixerGroup);
PrepareMusicSource(musicSource);
PrepareMusicSource(tempMusicSource);
@ -112,6 +118,7 @@ namespace RR.Common.Managers
var t = transform.Find("SFX Pool");
if (t != null) sfxPoolParent = t;
}
if (sfxPoolParent == null)
{
var go = new GameObject("SFX Pool");
@ -153,9 +160,10 @@ namespace RR.Common.Managers
src.volume = sfxDefaultVolume;
if (sfxMixerGroup != null) src.outputAudioMixerGroup = sfxMixerGroup;
}
#endregion
#region Public API
#endregion
#region Public API
/// <summary>
/// Мгновенно запустить музыку (без фейда).
@ -178,7 +186,8 @@ namespace RR.Common.Managers
/// <summary>
/// 2) Плавно сменить музыку (кроссфейд A->B).
/// </summary>
public void CrossfadeMusic(AudioClip newClip, float duration = -1f, bool loop = true, float newTargetVolume = -1f)
public void CrossfadeMusic(AudioClip newClip, float duration = -1f, bool loop = true,
float newTargetVolume = -1f)
{
if (newClip == null) return;
@ -209,7 +218,8 @@ namespace RR.Common.Managers
if (!isPausedFaded) return;
StopCrossfadeAndFade();
musicSource.UnPause();
musicFadeCoroutine = StartCoroutine(Fade(musicSource, from: 0f, to: Mathf.Clamp01(musicTargetVolume), d));
musicFadeCoroutine =
StartCoroutine(Fade(musicSource, from: 0f, to: Mathf.Clamp01(musicTargetVolume), d));
isPausedFaded = false;
}
}
@ -227,7 +237,8 @@ namespace RR.Common.Managers
/// <summary>
/// 3) Воспроизвести SFX из пула в мире (3D).
/// </summary>
public void PlaySfxAt(AudioClip clip, Vector3 position, float volume = 1f, float pitch = 1f, float spatialBlend = 1f)
public void PlaySfxAt(AudioClip clip, Vector3 position, float volume = 1f, float pitch = 1f,
float spatialBlend = 1f)
{
if (clip == null) return;
var src = GetFreeSfxSource();
@ -245,7 +256,7 @@ namespace RR.Common.Managers
public void PlayRandomSfxAt(SoundEffect[] sfxAsset, Vector3 position)
{
if (sfxAsset.Length == 0) return;
SoundEffect chosenEffect = sfxAsset[Random.Range(0, sfxAsset.Length - 1)];
PlaySfxAt(chosenEffect.sound, position, chosenEffect.volume, chosenEffect.pitch);
}
@ -254,8 +265,17 @@ namespace RR.Common.Managers
private void StopCrossfadeAndFade()
{
if (crossfadeCoroutine != null) { StopCoroutine(crossfadeCoroutine); crossfadeCoroutine = null; }
if (musicFadeCoroutine != null) { StopCoroutine(musicFadeCoroutine); musicFadeCoroutine = null; }
if (crossfadeCoroutine != null)
{
StopCoroutine(crossfadeCoroutine);
crossfadeCoroutine = null;
}
if (musicFadeCoroutine != null)
{
StopCoroutine(musicFadeCoroutine);
musicFadeCoroutine = null;
}
}
private IEnumerator CrossfadeRoutine(AudioClip newClip, float duration, bool loop, float targetVol)
@ -318,6 +338,7 @@ namespace RR.Common.Managers
src.volume = Mathf.Lerp(from, to, k);
yield return null;
}
src.volume = to;
}
@ -340,7 +361,8 @@ namespace RR.Common.Managers
return src;
}
private void ConfigureAndPlaySfx(AudioSource src, AudioClip clip, float volume, float pitch, float spatialBlend, Vector3? position)
private void ConfigureAndPlaySfx(AudioSource src, AudioClip clip, float volume, float pitch, float spatialBlend,
Vector3? position)
{
src.clip = clip;
src.volume = Mathf.Clamp(volume * sfxDefaultVolume, 0f, 1.5f);
@ -357,15 +379,7 @@ namespace RR.Common.Managers
src.Play();
}
#endregion
}
[Serializable]
public struct SoundEffect
{
public AudioClip sound;
[Min(0f)]public float volume;
public float pitch;
#endregion
}
}
}

View File

@ -1,37 +1,41 @@
using System;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.VFX;
using RR.Common.Audio;
using RR.Game2D.Core.Managers;
using Unity.VisualScripting;
namespace RR.Game2D.Entities
{
[RequireComponent(typeof(Collider2D))]
public class Checkpoint : MonoBehaviour
{
[Tooltip("Уникальное имя в пределах сцены (например CP_01). Если пусто — возьмём имя объекта.")]
public string checkpointId;
[Tooltip("Опционально: куда и как смотреть после респавна.")]
public Vector2 spawnForward = Vector2.right;
[SerializeField, Tooltip("Тег объекта игрока, который активирует чекпоинт")] private string playerTag = "Player";
[SerializeField] private string playerTag = "Player";
[Header("FX (необязательно)")]
public GameObject activateVfx;
public AudioClip activateSfx;
public VisualEffect activateVfx;
public SoundEffect activateSfx;
private bool _activated;
private Collider2D _col;
void Awake()
private void Awake()
{
_col = GetComponent<Collider2D>();
_col.isTrigger = true;
if (String.IsNullOrWhiteSpace(checkpointId))
checkpointId = gameObject.name;
if (!activateVfx.enabled) activateVfx.enabled = true;
activateVfx.Stop();
}
void OnTriggerEnter2D(Collider2D other)
private void OnTriggerEnter2D(Collider2D other)
{
if (_activated) return;
@ -46,9 +50,21 @@ namespace RR.Game2D.Entities
if (activateVfx)
{
activateVfx.transform.position = _col.bounds.center;
activateSfx.GetComponent<VisualEffect>().Play();
activateVfx.Play();
}
if (activateSfx) AudioSource.PlayClipAtPoint(activateSfx, transform.position);
if (activateSfx.sound != null) GameManager.Instance.Audio.PlaySfxAt(activateSfx.sound,
_col.bounds.center,
activateSfx.volume,
activateSfx.pitch);
}
private void OnTriggerExit2D(Collider2D other)
{
var source = other.attachedRigidbody ? other.attachedRigidbody.gameObject : other.gameObject;
if (!source.CompareTag(playerTag)) return;
if (activateVfx) activateVfx.Stop();
}
public Vector3 GetSpawnPosition() => transform.position;

View File

@ -1,7 +1,8 @@
using UnityEngine;
using RR.Game2D.Core.Managers;
using RR.Game2D.Entities.Projectiles;
using RR.Game2D.Behaviour.ScriptableObjects;
using RR.Game2D.Core.Managers;
namespace RR.Game2D.Behaviour
{

View File

@ -1,7 +1,8 @@
using UnityEngine;
using System;
using UnityEngine;
using UnityEngine.VFX;
using RR.Common.Managers;
using RR.Common.Audio;
using RR.Game2D.Behaviour;
using RR.Game2D.Entities;
using RR.Game2D.Core.Managers;
@ -20,6 +21,11 @@ namespace RR.Game2D.FX
private Rigidbody2D _playerRB;
private PlayerController _playerController;
private void OnEnable()
{
throw new NotSupportedException("This script is deprecated, please use Checkpoint instead.");
}
private void OnDestroy()
{
CheckpointSystem.Instance.ActiveChanged -= PlayFX;
@ -41,6 +47,8 @@ namespace RR.Game2D.FX
private void PlayFX(Checkpoint previous,Checkpoint current)
{
if (current == previous) return;
transform.position = current.transform.position;
transform.rotation = current.transform.rotation;
checkPointVFX.Play();

View File

@ -367,14 +367,14 @@ namespace RR.Game2D.Core.Managers
IsPaused = pause;
Time.timeScale = pause ? 0f : 1f;
AudioListener.pause = pause;
Audio.SmoothPauseMusic(pause);
PauseStateChanged?.Invoke(IsPaused);
}
// Можно заменить на другое поведение
/// <summary>
/// Метод переключателя паузы
/// Метод переключателя паузы.
/// </summary>
public void TogglePause() => SetPause(!IsPaused);
// --

View File

@ -1,6 +1,7 @@
using System;
using UnityEngine;
using RR.Common.Managers;
using RR.Common.Audio;
using RR.Game2D.Entities.Projectiles;
namespace RR.Game2D.Behaviour.ScriptableObjects

View File

@ -10,7 +10,7 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8b7a812250cb02a439b8c382ae42dd27, type: 3}
m_Name: StepsSounds_Level_1
m_Name: StepSoundsGrass
m_EditorClassIdentifier: Assembly-CSharp::RR.Game2D.Behaviour.ScriptableObjects.SFXAsset
soundEffects:
- sound: {fileID: 8300000, guid: 144cba17f4a47274d834d5e1fc28acb9, type: 3}

View File

@ -0,0 +1,24 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8b7a812250cb02a439b8c382ae42dd27, type: 3}
m_Name: StepSoundsMetal
m_EditorClassIdentifier: Assembly-CSharp::RR.Game2D.Behaviour.ScriptableObjects.SFXAsset
soundEffects:
- sound: {fileID: 8300000, guid: 44081d4997ebc78418c03a0fa021336d, type: 3}
volume: 1
pitch: 1
- sound: {fileID: 8300000, guid: 64a82f6dc3cfec746bcc23ded9a926ee, type: 3}
volume: 1
pitch: 1
- sound: {fileID: 8300000, guid: 6aedae21e708ea448b1ed0468415c094, type: 3}
volume: 1
pitch: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7f4c15e584a7d854bb922b709c03043d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,6 +1,6 @@
using UnityEngine;
using RR.Common.Managers;
using RR.Common.Audio;
namespace RR.Game2D.Behaviour.ScriptableObjects
{

View File

@ -114,7 +114,7 @@ MonoBehaviour:
m_UICollapsed: 0
m_UISuperCollapsed: 0
m_InputSlots:
- {fileID: 8926484042661614879}
- {fileID: 8926484042661615018}
m_OutputSlots: []
m_Label: Spawn system
m_Data: {fileID: 8926484042661614702}
@ -125,8 +125,8 @@ MonoBehaviour:
- link:
- context: {fileID: 8926484042661614707}
slotIndex: 0
loopDuration: 1
loopCount: 0
loopDuration: 0
loopCount: 1
delayBeforeLoop: 0
delayAfterLoop: 0
--- !u!114 &8926484042661614702
@ -786,40 +786,6 @@ MonoBehaviour:
PublicKeyToken=b77a5c561934e089
m_Direction: 0
m_LinkedSlots: []
--- !u!114 &8926484042661614879
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f780aa281814f9842a7c076d436932e7, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UIIgnoredErrors: []
m_Parent: {fileID: 0}
m_Children: []
m_UIPosition: {x: 0, y: 0}
m_UICollapsed: 1
m_UISuperCollapsed: 0
m_MasterSlot: {fileID: 8926484042661614879}
m_MasterData:
m_Owner: {fileID: 8926484042661614700}
m_Value:
m_Type:
m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
m_SerializableObject: 10
m_Space: -1
m_Property:
name: LoopDuration
m_serializedType:
m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
m_Direction: 0
m_LinkedSlots: []
--- !u!114 &8926484042661614880
MonoBehaviour:
m_ObjectHideFlags: 0
@ -2807,3 +2773,37 @@ MonoBehaviour:
PublicKeyToken=b77a5c561934e089
m_Direction: 0
m_LinkedSlots: []
--- !u!114 &8926484042661615018
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4d246e354feb93041a837a9ef59437cb, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.VisualEffectGraph.Editor::UnityEditor.VFX.VFXSlotInt
m_UIIgnoredErrors: []
m_Parent: {fileID: 0}
m_Children: []
m_UIPosition: {x: 0, y: 0}
m_UICollapsed: 1
m_UISuperCollapsed: 0
m_MasterSlot: {fileID: 8926484042661615018}
m_MasterData:
m_Owner: {fileID: 8926484042661614700}
m_Value:
m_Type:
m_SerializableType: System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
m_SerializableObject: 1
m_Space: -1
m_Property:
name: LoopCount
m_serializedType:
m_SerializableType: System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
m_Direction: 0
m_LinkedSlots: []