mirror of
https://github.com/appen-isen/jeu-sans-image.git
synced 2026-03-18 21:50:42 +01:00
Merge pull request #5 from appen-isen/feature/SoundManagement
Feature/sound management
This commit is contained in:
8
Assets/Resources/Prefabs/Sound.meta
Normal file
8
Assets/Resources/Prefabs/Sound.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 48dcd50c6eacab640bcf38649d7f3a7d
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
131
Assets/Resources/Prefabs/Sound/Audio Source.prefab
Normal file
131
Assets/Resources/Prefabs/Sound/Audio Source.prefab
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &7070934177775682985
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 944501444550833281}
|
||||||
|
- component: {fileID: 3317408524915037535}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Audio Source
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &944501444550833281
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7070934177775682985}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, 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!82 &3317408524915037535
|
||||||
|
AudioSource:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7070934177775682985}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 4
|
||||||
|
OutputAudioMixerGroup: {fileID: 0}
|
||||||
|
m_audioClip: {fileID: 0}
|
||||||
|
m_Resource: {fileID: 0}
|
||||||
|
m_PlayOnAwake: 1
|
||||||
|
m_Volume: 1
|
||||||
|
m_Pitch: 1
|
||||||
|
Loop: 0
|
||||||
|
Mute: 0
|
||||||
|
Spatialize: 0
|
||||||
|
SpatializePostEffects: 0
|
||||||
|
Priority: 128
|
||||||
|
DopplerLevel: 1
|
||||||
|
MinDistance: 1
|
||||||
|
MaxDistance: 500
|
||||||
|
Pan2D: 0
|
||||||
|
rolloffMode: 0
|
||||||
|
BypassEffects: 0
|
||||||
|
BypassListenerEffects: 0
|
||||||
|
BypassReverbZones: 0
|
||||||
|
rolloffCustomCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 1
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 1
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
panLevelCustomCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 1
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
spreadCustomCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
reverbZoneMixCustomCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 1
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
7
Assets/Resources/Prefabs/Sound/Audio Source.prefab.meta
Normal file
7
Assets/Resources/Prefabs/Sound/Audio Source.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3758df6f658743a458b1e3406342e7de
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Resources/Sounds/Test-bruit-court.wav
Normal file
BIN
Assets/Resources/Sounds/Test-bruit-court.wav
Normal file
Binary file not shown.
23
Assets/Resources/Sounds/Test-bruit-court.wav.meta
Normal file
23
Assets/Resources/Sounds/Test-bruit-court.wav.meta
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2e41a111eebf71843a1cbf93be5a9e1c
|
||||||
|
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:
|
||||||
@@ -311,6 +311,96 @@ Rigidbody:
|
|||||||
m_Interpolate: 0
|
m_Interpolate: 0
|
||||||
m_Constraints: 112
|
m_Constraints: 112
|
||||||
m_CollisionDetection: 0
|
m_CollisionDetection: 0
|
||||||
|
--- !u!1 &169666004
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 169666005}
|
||||||
|
- component: {fileID: 169666006}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: MusicManager
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &169666005
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 169666004}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, 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!114 &169666006
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 169666004}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 4f4c60501663689458019872e34e9c48, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!1 &266152666
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 266152667}
|
||||||
|
- component: {fileID: 266152668}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: SoundManager
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &266152667
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 266152666}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, 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!114 &266152668
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 266152666}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: cc230848cf9fffe40aed130aeee564f8, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
initialPoolSize: 10
|
||||||
|
audioSourcePrefab: {fileID: 7070934177775682985, guid: 3758df6f658743a458b1e3406342e7de, type: 3}
|
||||||
--- !u!1 &272243392
|
--- !u!1 &272243392
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -669,6 +759,52 @@ MonoBehaviour:
|
|||||||
m_LightCookieSize: {x: 1, y: 1}
|
m_LightCookieSize: {x: 1, y: 1}
|
||||||
m_LightCookieOffset: {x: 0, y: 0}
|
m_LightCookieOffset: {x: 0, y: 0}
|
||||||
m_SoftShadowQuality: 1
|
m_SoftShadowQuality: 1
|
||||||
|
--- !u!1 &432444065
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 432444066}
|
||||||
|
- component: {fileID: 432444067}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Triggerable music
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &432444066
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 432444065}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children:
|
||||||
|
- {fileID: 1512154480}
|
||||||
|
m_Father: {fileID: 621578838}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &432444067
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 432444065}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 0c3454cc62eba27469e9581fb0fb8703, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
music: {fileID: 1512154481}
|
||||||
--- !u!1 &493760349
|
--- !u!1 &493760349
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -724,6 +860,130 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 5a895e8a798ee0b4a9a5ea33d6b07f4b, type: 3}
|
m_Script: {fileID: 11500000, guid: 5a895e8a798ee0b4a9a5ea33d6b07f4b, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!1 &621578834
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 621578838}
|
||||||
|
- component: {fileID: 621578837}
|
||||||
|
- component: {fileID: 621578836}
|
||||||
|
- component: {fileID: 621578835}
|
||||||
|
- component: {fileID: 621578839}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: TriggerZone
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!65 &621578835
|
||||||
|
BoxCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 621578834}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_LayerOverridePriority: 0
|
||||||
|
m_IsTrigger: 1
|
||||||
|
m_ProvidesContacts: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 3
|
||||||
|
m_Size: {x: 1, y: 1, z: 1}
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!23 &621578836
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 621578834}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_StaticShadowCaster: 0
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RayTraceProcedural: 0
|
||||||
|
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||||
|
m_RayTracingAccelStructBuildFlags: 1
|
||||||
|
m_SmallMeshCulling: 1
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
|
--- !u!33 &621578837
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 621578834}
|
||||||
|
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!4 &621578838
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 621578834}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 4.22, y: 0.71, z: -7.71}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children:
|
||||||
|
- {fileID: 432444066}
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &621578839
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 621578834}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: eb3300468ed86d74d9fce3c293a89442, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
activableTriggers:
|
||||||
|
- {fileID: 432444067}
|
||||||
--- !u!1 &990919146
|
--- !u!1 &990919146
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -767,6 +1027,7 @@ GameObject:
|
|||||||
- component: {fileID: 1192843595}
|
- component: {fileID: 1192843595}
|
||||||
- component: {fileID: 1192843594}
|
- component: {fileID: 1192843594}
|
||||||
- component: {fileID: 1192843593}
|
- component: {fileID: 1192843593}
|
||||||
|
- component: {fileID: 1192843596}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Slope
|
m_Name: Slope
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -786,7 +1047,8 @@ Transform:
|
|||||||
m_LocalPosition: {x: -5.5, y: 1.13, z: -6.62}
|
m_LocalPosition: {x: -5.5, y: 1.13, z: -6.62}
|
||||||
m_LocalScale: {x: 0.5, y: 1, z: 0.5}
|
m_LocalScale: {x: 0.5, y: 1, z: 0.5}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children:
|
||||||
|
- {fileID: 1646350200}
|
||||||
m_Father: {fileID: 90518572}
|
m_Father: {fileID: 90518572}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -28.7}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -28.7}
|
||||||
--- !u!64 &1192843593
|
--- !u!64 &1192843593
|
||||||
@@ -864,6 +1126,110 @@ MeshFilter:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1192843591}
|
m_GameObject: {fileID: 1192843591}
|
||||||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!114 &1192843596
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1192843591}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: ce02cde7ea924d943a1cae7e8fa23c97, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
triggerables:
|
||||||
|
- {fileID: 1646350201}
|
||||||
|
--- !u!1 &1512154479
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1512154480}
|
||||||
|
- component: {fileID: 1512154481}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Music
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1512154480
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1512154479}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 432444066}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &1512154481
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1512154479}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 287885c28387db147b2ed37b247e9fc2, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
sound: {fileID: 8300000, guid: 2e41a111eebf71843a1cbf93be5a9e1c, type: 3}
|
||||||
|
--- !u!1 &1646350199
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1646350200}
|
||||||
|
- component: {fileID: 1646350201}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Triggerable sound
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1646350200
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1646350199}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: -12.26, y: -0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 1192843592}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &1646350201
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1646350199}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: f05e67e6db6841f45b446a26d1d0d31d, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
audioSource: {fileID: 8300000, guid: 2e41a111eebf71843a1cbf93be5a9e1c, type: 3}
|
||||||
--- !u!1 &1697224667
|
--- !u!1 &1697224667
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -1015,7 +1381,7 @@ AudioSource:
|
|||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1883178833}
|
m_GameObject: {fileID: 1883178833}
|
||||||
m_Enabled: 1
|
m_Enabled: 0
|
||||||
serializedVersion: 4
|
serializedVersion: 4
|
||||||
OutputAudioMixerGroup: {fileID: 0}
|
OutputAudioMixerGroup: {fileID: 0}
|
||||||
m_audioClip: {fileID: 0}
|
m_audioClip: {fileID: 0}
|
||||||
@@ -1187,3 +1553,6 @@ SceneRoots:
|
|||||||
- {fileID: 99782795}
|
- {fileID: 99782795}
|
||||||
- {fileID: 1697224671}
|
- {fileID: 1697224671}
|
||||||
- {fileID: 90518572}
|
- {fileID: 90518572}
|
||||||
|
- {fileID: 266152667}
|
||||||
|
- {fileID: 169666005}
|
||||||
|
- {fileID: 621578838}
|
||||||
|
|||||||
8
Assets/Scripts/Sound.meta
Normal file
8
Assets/Scripts/Sound.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7f85cfcdf276f164e886755fa9ee019e
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
50
Assets/Scripts/Sound/ILoopableSound.cs
Normal file
50
Assets/Scripts/Sound/ILoopableSound.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
using NUnit.Framework;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public abstract class ILoopableSound : MonoBehaviour
|
||||||
|
{
|
||||||
|
protected AudioSource source;
|
||||||
|
|
||||||
|
protected void CreateSource()
|
||||||
|
{
|
||||||
|
source = Instantiate(SoundManager.Instance.audioSourcePrefab).GetComponent<AudioSource>();
|
||||||
|
source.loop = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void DestroySource()
|
||||||
|
{
|
||||||
|
if (source != null)
|
||||||
|
{
|
||||||
|
Destroy(source.gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void OnDestroy()
|
||||||
|
{
|
||||||
|
DestroySource();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PlayLoopableSound(Vector3 position)
|
||||||
|
{
|
||||||
|
CreateSource();
|
||||||
|
source.transform.position = position;
|
||||||
|
PlayLoopableSound();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PlayLoopableSound(Transform parent, bool spatial)
|
||||||
|
{
|
||||||
|
CreateSource();
|
||||||
|
source.transform.SetParent(parent, false);
|
||||||
|
source.spatialBlend = spatial ? 1 : 0;
|
||||||
|
PlayLoopableSound();
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void PlayLoopableSound() { }
|
||||||
|
|
||||||
|
public virtual void StopLoopableSound()
|
||||||
|
{
|
||||||
|
DestroySource();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsPlaying { get { return source != null; } }
|
||||||
|
}
|
||||||
2
Assets/Scripts/Sound/ILoopableSound.cs.meta
Normal file
2
Assets/Scripts/Sound/ILoopableSound.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a71883758609f8342858a3b5c4c641d8
|
||||||
43
Assets/Scripts/Sound/LoopablePlaylist.cs
Normal file
43
Assets/Scripts/Sound/LoopablePlaylist.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class LoopablePlaylist : ILoopableSound
|
||||||
|
{
|
||||||
|
[SerializeField] List<AudioClip> playlist;
|
||||||
|
Coroutine playlistCoroutine = null;
|
||||||
|
|
||||||
|
public override void PlayLoopableSound()
|
||||||
|
{
|
||||||
|
base.PlayLoopableSound();
|
||||||
|
|
||||||
|
if (playlist.Count == 0)
|
||||||
|
{
|
||||||
|
Debug.LogWarning("Playlist is empty");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
source.loop = false;
|
||||||
|
playlistCoroutine = StartCoroutine(PlaylistCoroutine());
|
||||||
|
source.clip = playlist[0];
|
||||||
|
source.Play();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void StopLoopableSound()
|
||||||
|
{
|
||||||
|
StopCoroutine(playlistCoroutine);
|
||||||
|
source.Stop();
|
||||||
|
base.StopLoopableSound();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IEnumerator PlaylistCoroutine()
|
||||||
|
{
|
||||||
|
int playlistIndex = 0;
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
source.clip = playlist[playlistIndex];
|
||||||
|
source.Play();
|
||||||
|
yield return new WaitForSeconds(playlist[playlistIndex].length);
|
||||||
|
playlistIndex = (playlistIndex + 1) % playlist.Count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/Scripts/Sound/LoopablePlaylist.cs.meta
Normal file
2
Assets/Scripts/Sound/LoopablePlaylist.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 914bb056e791dc74491ef6034c2a70dd
|
||||||
19
Assets/Scripts/Sound/LoopableSound.cs
Normal file
19
Assets/Scripts/Sound/LoopableSound.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class LoopableSound : ILoopableSound
|
||||||
|
{
|
||||||
|
[SerializeField] AudioClip sound;
|
||||||
|
|
||||||
|
public override void PlayLoopableSound()
|
||||||
|
{
|
||||||
|
base.PlayLoopableSound();
|
||||||
|
source.clip = sound;
|
||||||
|
source.Play();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void StopLoopableSound()
|
||||||
|
{
|
||||||
|
source.Stop();
|
||||||
|
base.StopLoopableSound();
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/Scripts/Sound/LoopableSound.cs.meta
Normal file
2
Assets/Scripts/Sound/LoopableSound.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 287885c28387db147b2ed37b247e9fc2
|
||||||
45
Assets/Scripts/Sound/MusicManager.cs
Normal file
45
Assets/Scripts/Sound/MusicManager.cs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The music manager is responsible for handling loopable sounds.
|
||||||
|
/// If you want to manage a non-looped sound, use the SoundManager.
|
||||||
|
/// </summary>
|
||||||
|
public class MusicManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
// Singleton pattern
|
||||||
|
[System.NonSerialized] public static MusicManager Instance = null;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
// Singleton pattern
|
||||||
|
if (Instance != null && Instance != this)
|
||||||
|
{
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
DontDestroyOnLoad(gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartMusic(ILoopableSound music)
|
||||||
|
{
|
||||||
|
music.PlayLoopableSound(transform, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartMusic(ILoopableSound music, Vector3 position)
|
||||||
|
{
|
||||||
|
music.PlayLoopableSound(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartMusic(ILoopableSound music, Transform parent)
|
||||||
|
{
|
||||||
|
music.PlayLoopableSound(parent, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StopMusic(ILoopableSound music)
|
||||||
|
{
|
||||||
|
music.StopLoopableSound();
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/Scripts/Sound/MusicManager.cs.meta
Normal file
2
Assets/Scripts/Sound/MusicManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4f4c60501663689458019872e34e9c48
|
||||||
83
Assets/Scripts/Sound/SoundManager.cs
Normal file
83
Assets/Scripts/Sound/SoundManager.cs
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The sound manager is responsible for handling short lived sounds.
|
||||||
|
/// Those are sounds that should not loop.
|
||||||
|
/// If you want to manage a looped sound, use the MusicManager or place
|
||||||
|
/// it in the scene "as-is" instead.
|
||||||
|
/// </summary>
|
||||||
|
public class SoundManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] private int initialPoolSize = 10;
|
||||||
|
[SerializeField] public GameObject audioSourcePrefab;
|
||||||
|
|
||||||
|
private List<AudioSource> audioPool;
|
||||||
|
private Queue<AudioSource> availableAudios;
|
||||||
|
|
||||||
|
// Singleton pattern
|
||||||
|
[System.NonSerialized] // Do not show it in editor and do not save its value
|
||||||
|
public static SoundManager Instance = null;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
// Singleton pattern
|
||||||
|
if (Instance != null && Instance != this)
|
||||||
|
{
|
||||||
|
Destroy(gameObject);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Instance = this;
|
||||||
|
DontDestroyOnLoad(gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
if (audioSourcePrefab == null)
|
||||||
|
{
|
||||||
|
Debug.LogWarning("Cannot create a pool of audio sources: audio source prefab not set");
|
||||||
|
}
|
||||||
|
|
||||||
|
audioPool = new List<AudioSource>(initialPoolSize);
|
||||||
|
availableAudios = new Queue<AudioSource>(initialPoolSize);
|
||||||
|
|
||||||
|
// For each initially pooled audio
|
||||||
|
for (int i=0; i<initialPoolSize; i++)
|
||||||
|
{
|
||||||
|
// Create a new pooled audio and mark it as available
|
||||||
|
availableAudios.Enqueue(ExtendPool());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private AudioSource ExtendPool()
|
||||||
|
{
|
||||||
|
AudioSource source = Instantiate(
|
||||||
|
audioSourcePrefab,
|
||||||
|
transform
|
||||||
|
).GetComponent<AudioSource>();
|
||||||
|
audioPool.Add(source);
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator DelayedBackToPoolCoroutine(AudioSource source)
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(source.clip.length);
|
||||||
|
availableAudios.Enqueue(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PlaySoundAt(Vector3 position, AudioClip sound)
|
||||||
|
{
|
||||||
|
// Take audio from pool if possible, extend pool otherwise
|
||||||
|
AudioSource source = Instance.availableAudios.Count == 0 ?
|
||||||
|
Instance.ExtendPool() :
|
||||||
|
Instance.availableAudios.Dequeue();
|
||||||
|
|
||||||
|
source.transform.position = position;
|
||||||
|
source.clip = sound;
|
||||||
|
source.loop = false;
|
||||||
|
source.Play();
|
||||||
|
StartCoroutine(Instance.DelayedBackToPoolCoroutine(source));
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/Scripts/Sound/SoundManager.cs.meta
Normal file
2
Assets/Scripts/Sound/SoundManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cc230848cf9fffe40aed130aeee564f8
|
||||||
8
Assets/Scripts/Trigger.meta
Normal file
8
Assets/Scripts/Trigger.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ff2572641226ba24f8e06342e11d6dc6
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/Scripts/Trigger/Trigger.meta
Normal file
8
Assets/Scripts/Trigger/Trigger.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b7081abff2504cd488ce34e2964895f5
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
26
Assets/Scripts/Trigger/Trigger/IActivableTrigger.cs
Normal file
26
Assets/Scripts/Trigger/Trigger/IActivableTrigger.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An abstract class for anything that needs to trigger activable events (on/off state)
|
||||||
|
/// </summary>
|
||||||
|
public abstract class IActivableTrigger : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] List<IActivableTriggerable> activableTriggers;
|
||||||
|
|
||||||
|
protected void OnTriggerActivate()
|
||||||
|
{
|
||||||
|
foreach (IActivableTriggerable activableTrigger in activableTriggers)
|
||||||
|
{
|
||||||
|
activableTrigger.OnTriggerActivate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void OnTriggerDeactivate()
|
||||||
|
{
|
||||||
|
foreach (IActivableTriggerable activableTrigger in activableTriggers)
|
||||||
|
{
|
||||||
|
activableTrigger.OnTriggerDeactivate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/Scripts/Trigger/Trigger/IActivableTrigger.cs.meta
Normal file
2
Assets/Scripts/Trigger/Trigger/IActivableTrigger.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a01a8874461ebab4fb27d80b3864597a
|
||||||
26
Assets/Scripts/Trigger/Trigger/ITrigger.cs
Normal file
26
Assets/Scripts/Trigger/Trigger/ITrigger.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An abstract class for anything that needs to trigger one-shot events
|
||||||
|
/// </summary>
|
||||||
|
public abstract class ITrigger : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] List<ITriggerable> triggerables;
|
||||||
|
|
||||||
|
protected void OnTrigger(Vector3 position)
|
||||||
|
{
|
||||||
|
foreach (ITriggerable triggerable in triggerables)
|
||||||
|
{
|
||||||
|
triggerable.Trigger(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void OnTrigger()
|
||||||
|
{
|
||||||
|
foreach (var triggerable in triggerables)
|
||||||
|
{
|
||||||
|
triggerable.Trigger();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/Scripts/Trigger/Trigger/ITrigger.cs.meta
Normal file
2
Assets/Scripts/Trigger/Trigger/ITrigger.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5b27634977cf89f4897128f2bfc9c40e
|
||||||
18
Assets/Scripts/Trigger/Trigger/TriggerArea.cs
Normal file
18
Assets/Scripts/Trigger/Trigger/TriggerArea.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An area that triggers when colliding (triggers once when entering, once when exiting)
|
||||||
|
/// </summary>
|
||||||
|
[RequireComponent(typeof(Collider))]
|
||||||
|
public class TriggerArea : IActivableTrigger
|
||||||
|
{
|
||||||
|
private void OnTriggerEnter(Collider other)
|
||||||
|
{
|
||||||
|
OnTriggerActivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTriggerExit(Collider other)
|
||||||
|
{
|
||||||
|
OnTriggerDeactivate();
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/Scripts/Trigger/Trigger/TriggerArea.cs.meta
Normal file
2
Assets/Scripts/Trigger/Trigger/TriggerArea.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: eb3300468ed86d74d9fce3c293a89442
|
||||||
17
Assets/Scripts/Trigger/Trigger/TriggerCollision.cs
Normal file
17
Assets/Scripts/Trigger/Trigger/TriggerCollision.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A collision trigger that triggers one-shot event when colliding with an object
|
||||||
|
/// </summary>
|
||||||
|
[RequireComponent(typeof(Collider))]
|
||||||
|
public class TriggerCollision : ITrigger
|
||||||
|
{
|
||||||
|
private void OnCollisionEnter(Collision collision)
|
||||||
|
{
|
||||||
|
if (collision.contactCount > 0)
|
||||||
|
{
|
||||||
|
Vector3 contactPoint = collision.GetContact(0).point;
|
||||||
|
OnTrigger(contactPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/Scripts/Trigger/Trigger/TriggerCollision.cs.meta
Normal file
2
Assets/Scripts/Trigger/Trigger/TriggerCollision.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ce02cde7ea924d943a1cae7e8fa23c97
|
||||||
8
Assets/Scripts/Trigger/Triggerable.meta
Normal file
8
Assets/Scripts/Trigger/Triggerable.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 923b6e673582c4b4487ef8daea9b0bd2
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
10
Assets/Scripts/Trigger/Triggerable/IActivableTriggerable.cs
Normal file
10
Assets/Scripts/Trigger/Triggerable/IActivableTriggerable.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An abstract class for any triggerable object that has an on/off state
|
||||||
|
/// </summary>
|
||||||
|
public abstract class IActivableTriggerable : MonoBehaviour
|
||||||
|
{
|
||||||
|
public abstract void OnTriggerActivate();
|
||||||
|
public abstract void OnTriggerDeactivate();
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 64b9105c3da058a4698864040a90a844
|
||||||
10
Assets/Scripts/Trigger/Triggerable/ITriggerable.cs
Normal file
10
Assets/Scripts/Trigger/Triggerable/ITriggerable.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An abstract class for any triggerable object
|
||||||
|
/// </summary>
|
||||||
|
public abstract class ITriggerable : MonoBehaviour
|
||||||
|
{
|
||||||
|
public abstract void Trigger();
|
||||||
|
public abstract void Trigger(Vector3 position);
|
||||||
|
}
|
||||||
2
Assets/Scripts/Trigger/Triggerable/ITriggerable.cs.meta
Normal file
2
Assets/Scripts/Trigger/Triggerable/ITriggerable.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: db3db78b9c1317d42abe3ef387daea90
|
||||||
25
Assets/Scripts/Trigger/Triggerable/TriggerableMusic.cs
Normal file
25
Assets/Scripts/Trigger/Triggerable/TriggerableMusic.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A triggerable music. Trigger can activate and deactivate the music.
|
||||||
|
/// </summary>
|
||||||
|
public class TriggerableMusic : IActivableTriggerable
|
||||||
|
{
|
||||||
|
[SerializeField] ILoopableSound music;
|
||||||
|
|
||||||
|
public override void OnTriggerActivate()
|
||||||
|
{
|
||||||
|
if (music != null)
|
||||||
|
{
|
||||||
|
MusicManager.Instance.StartMusic(music);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnTriggerDeactivate()
|
||||||
|
{
|
||||||
|
if (music != null)
|
||||||
|
{
|
||||||
|
MusicManager.Instance.StopMusic(music);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0c3454cc62eba27469e9581fb0fb8703
|
||||||
25
Assets/Scripts/Trigger/Triggerable/TriggerableSound.cs
Normal file
25
Assets/Scripts/Trigger/Triggerable/TriggerableSound.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A triggerable sound. Trigger plays the sound.
|
||||||
|
/// </summary>
|
||||||
|
public class TriggerableSound : ITriggerable
|
||||||
|
{
|
||||||
|
[SerializeField] AudioClip audioSource;
|
||||||
|
|
||||||
|
public override void Trigger()
|
||||||
|
{
|
||||||
|
if (audioSource != null)
|
||||||
|
{
|
||||||
|
SoundManager.Instance.PlaySoundAt(transform.position, audioSource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Trigger(Vector3 position)
|
||||||
|
{
|
||||||
|
if (audioSource != null)
|
||||||
|
{
|
||||||
|
SoundManager.Instance.PlaySoundAt(position, audioSource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f05e67e6db6841f45b446a26d1d0d31d
|
||||||
16
ProjectSettings/TimelineSettings.asset
Normal file
16
ProjectSettings/TimelineSettings.asset
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &1
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 53
|
||||||
|
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: a287be6c49135cd4f9b2b8666c39d999, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
assetDefaultFramerate: 60
|
||||||
|
m_DefaultFrameRate: 60
|
||||||
Reference in New Issue
Block a user