Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acd9cc1a32 | ||
|
|
b7e9a26462 | ||
|
|
000985ee9b | ||
|
|
abde1d5ba9 | ||
|
|
52b18967a1 | ||
|
|
79d03528f6 | ||
|
|
4a547f1348 | ||
|
|
7130513471 | ||
|
|
ee7cf3946f | ||
|
|
175567e4dd | ||
|
|
97c60c0925 | ||
|
|
bd495a644f | ||
|
|
cea36c0cda | ||
|
|
ff8ed96138 | ||
|
|
95cb51db79 | ||
|
|
2b9fd70c85 | ||
|
|
cd384239ff | ||
|
|
f3a83eb909 | ||
|
|
35f703a8d2 | ||
|
|
e5f4f292c2 | ||
|
|
efad72b4d9 | ||
|
|
855108d88b | ||
|
|
388773129d | ||
|
|
e654a0daf4 | ||
|
|
cfe5b39cc9 | ||
|
|
c14880457d | ||
|
|
344470978d | ||
|
|
dab970737a | ||
|
|
afdd523682 | ||
|
|
575e66425a | ||
|
|
c470f63409 | ||
|
|
5da64a7b3d | ||
|
|
c4ab11488b | ||
|
|
cb968d782b | ||
|
|
522f51be3f | ||
|
|
01505de4c3 | ||
|
|
7024e1daf0 | ||
|
|
020934e07f | ||
|
|
52edef92e3 | ||
|
|
d3fbd4c5c3 | ||
|
|
5b09068b0c | ||
|
|
ddb76a5b93 | ||
|
|
c6b097a879 | ||
|
|
0f708ff4cb | ||
|
|
721d5ebf9c | ||
|
|
3bb99aaf1e | ||
|
|
a2acea39dc | ||
|
|
5c1fd1510d | ||
|
|
e128ee59f9 | ||
|
|
5c81bde5db | ||
|
|
05449642d5 | ||
|
|
3020140360 | ||
|
|
e67fea2051 | ||
|
|
d1aad440f5 | ||
|
|
0e1c274677 | ||
|
|
346dc97fef | ||
|
|
557c4c3dee | ||
|
|
dbabd847c1 | ||
|
|
a243ad53d6 | ||
|
|
874280741c | ||
|
|
b13cf8cfc0 | ||
|
|
177464cc09 | ||
|
|
f8448ba922 | ||
|
|
85a07065d9 | ||
|
|
0f8a629e4b | ||
|
|
7bc15cc03d | ||
|
|
d861e06caf | ||
|
|
f940cbffe0 | ||
|
|
6b1f24b72e | ||
|
|
1ad87e7432 | ||
|
|
09219d9091 | ||
|
|
37f5d15410 | ||
|
|
019da8cfd3 | ||
|
|
edf3821c0d | ||
|
|
45fe19be24 | ||
|
|
bea109175b | ||
|
|
b214bb0f63 | ||
|
|
0ac5ba1e1c | ||
|
|
ab9d444072 | ||
|
|
2335908a90 | ||
|
|
ae76edb0d0 | ||
|
|
6f2b063700 | ||
|
|
0e188efe59 | ||
|
|
c6d1c3bffd | ||
|
|
07ce27618c | ||
|
|
fb85b22e96 | ||
|
|
665114b7dc | ||
|
|
4549617275 | ||
|
|
db541fed8a | ||
|
|
085429d5ca | ||
|
|
981d081bed | ||
|
|
6148889fc1 | ||
|
|
7538ce81af | ||
|
|
9a3743988d |
No files matched your search
Generated
+13
@@ -0,0 +1,13 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Rider ignored files
|
||||||
|
/contentModel.xml
|
||||||
|
/projectSettingsUpdater.xml
|
||||||
|
/modules.xml
|
||||||
|
/.idea.CourierOldRe.iml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
Generated
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
%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: dea69d41f90c6ea4fa55c27c1d60c145, type: 3}
|
||||||
|
m_Name: AddressableAssetGroupSortSettings
|
||||||
|
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.GroupSchemas.AddressableAssetGroupSortSettings
|
||||||
|
sortOrder:
|
||||||
|
- 7e9d70e73e500eb9287683466ebf646f
|
||||||
|
- d447fc60305c17a17bf20948ab295a45
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 6938984fc7d25285abb4922dd46d9272
|
guid: 88c15d5f41d582974a9b7218c493e4a7
|
||||||
NativeFormatImporter:
|
NativeFormatImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
mainObjectFileID: 11400000
|
mainObjectFileID: 11400000
|
||||||
@@ -15,7 +15,7 @@ MonoBehaviour:
|
|||||||
m_DefaultGroup: d447fc60305c17a17bf20948ab295a45
|
m_DefaultGroup: d447fc60305c17a17bf20948ab295a45
|
||||||
m_currentHash:
|
m_currentHash:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
Hash: 44f191e9f235d5420c20a51f93ead7da
|
Hash: 00000000000000000000000000000000
|
||||||
m_OptimizeCatalogSize: 0
|
m_OptimizeCatalogSize: 0
|
||||||
m_BuildRemoteCatalog: 0
|
m_BuildRemoteCatalog: 0
|
||||||
m_CatalogRequestsTimeout: 0
|
m_CatalogRequestsTimeout: 0
|
||||||
@@ -54,12 +54,13 @@ MonoBehaviour:
|
|||||||
m_Id:
|
m_Id:
|
||||||
m_RemoteCatalogLoadPath:
|
m_RemoteCatalogLoadPath:
|
||||||
m_Id:
|
m_Id:
|
||||||
m_ContentStateBuildPathProfileVariableName:
|
m_ContentStateBuildPathProfileVariableName: <default settings path>
|
||||||
m_CustomContentStateBuildPath:
|
m_CustomContentStateBuildPath:
|
||||||
m_ContentStateBuildPath:
|
m_ContentStateBuildPath:
|
||||||
m_BuildAddressablesWithPlayerBuild: 0
|
m_BuildAddressablesWithPlayerBuild: 0
|
||||||
m_overridePlayerVersion: '[UnityEditor.PlayerSettings.bundleVersion]'
|
m_overridePlayerVersion: '[UnityEditor.PlayerSettings.bundleVersion]'
|
||||||
m_GroupAssets:
|
m_GroupAssets:
|
||||||
|
- {fileID: 11400000, guid: ba51c0b85beab267d8f41a72df4fb657, type: 2}
|
||||||
- {fileID: 11400000, guid: 7c592a6445170e8379910601b962cb30, type: 2}
|
- {fileID: 11400000, guid: 7c592a6445170e8379910601b962cb30, type: 2}
|
||||||
m_BuildSettings:
|
m_BuildSettings:
|
||||||
m_LogResourceManagerExceptions: 1
|
m_LogResourceManagerExceptions: 1
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
%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: bbb281ee3bf0b054c82ac2347e9e782c, type: 3}
|
||||||
|
m_Name: Audio
|
||||||
|
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.AddressableAssetGroup
|
||||||
|
m_GroupName: Audio
|
||||||
|
m_GUID: 7e9d70e73e500eb9287683466ebf646f
|
||||||
|
m_SerializeEntries: []
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_Settings: {fileID: 11400000, guid: 2588e84eb64800d0781c574a37fa48d8, type: 2}
|
||||||
|
m_SchemaSet:
|
||||||
|
m_Schemas: []
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ba51c0b85beab267d8f41a72df4fb657
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
+204
-1
@@ -14,7 +14,210 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.AddressableAssetGroup
|
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.AddressableAssetGroup
|
||||||
m_GroupName: Default Local Group
|
m_GroupName: Default Local Group
|
||||||
m_GUID: d447fc60305c17a17bf20948ab295a45
|
m_GUID: d447fc60305c17a17bf20948ab295a45
|
||||||
m_SerializeEntries: []
|
m_SerializeEntries:
|
||||||
|
- m_GUID: 144ab5188f8ad7a0a92c75703bd12e60
|
||||||
|
m_Address: launch_upmenu1
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 16562a5c87213914cad415f10c65a3b0
|
||||||
|
m_Address: "Assets/Resources_moved/Audio/Music/LASKX3I - \u041F\u0440\u043E\u0442\u0438\u0432
|
||||||
|
\u0446\u0430\u0440\u044F (\u041A\u0430\u0440\u0430\u043E\u043A\u0435).mp3"
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 170b1a70ddee4d948abea041b9b805e4
|
||||||
|
m_Address: Assets/Resources_moved/Audio/Music/Half Life Original Soundtrack -
|
||||||
|
Track 8 - Diabolical Adrenaline Guitar.mp3
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 1d4767c722c05b5d6b96bb226d378c65
|
||||||
|
m_Address: Assets/Resources_moved/Prefabs/Player/ArmsMesh.prefab
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 1d7110a045075b22fa27d62bd5f2784e
|
||||||
|
m_Address: 357_shot1
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 1f79c7b1e492a4ea2a8d666cdead0c52
|
||||||
|
m_Address: Audio/Dispatcher/take_damage4
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 23e11d2c8a4f12f4ea9a7a43d1118464
|
||||||
|
m_Address: Gameplay
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 28a6c7a4124141341ab7c2b7dfd3e95b
|
||||||
|
m_Address: Assets/Resources_moved/Prefabs/Levels/Level1 2.prefab
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 29bff8011973e4e519906b9da8fca0fc
|
||||||
|
m_Address: Audio/Dispatcher/late3
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 29ee630aab7bbef8799dc76ed0c239f7
|
||||||
|
m_Address: Audio/Dispatcher/late4
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 2ed2d93a9f39d4edba511cb7396c7bb6
|
||||||
|
m_Address: Assets/Resources_moved/Prefabs/Enemies/Cockroach.prefab
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 2f6134357dc2a5641a846a7478ce4c2c
|
||||||
|
m_Address: bravo!
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 31f16c866d3224ab8a7e0fabf3745ec5
|
||||||
|
m_Address: Audio/Dispatcher/late5
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 3831a36e0c8e48f659517a6bb99378b6
|
||||||
|
m_Address: cbar_hit1
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 3d195945b1fbf114a88457cba466bc2b
|
||||||
|
m_Address: Assets/Resources_moved/Rooms/Room2.prefab
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 4472dd84628855c4085cacaec19efa29
|
||||||
|
m_Address: Assets/Resources_moved/Rooms/Room1.prefab
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 48aebfe8826dc0df79d047b5afbf8f5b
|
||||||
|
m_Address: Canvas
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 4bd64d1fcecc9c6b09d81e78b7dcfebe
|
||||||
|
m_Address: Audio/Dispatcher/take_damage1
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 4f660559d76c3ed42a7c34a0b16487f7
|
||||||
|
m_Address: Assets/Resources_moved/Rooms/Room3.prefab
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 735f38402ea347fa381408293503a24e
|
||||||
|
m_Address: Audio/Dispatcher/receiving_an_order1
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 751890caa1647ec6689f24933fbcb770
|
||||||
|
m_Address: "Prefabs/Furniture/\u0442\u0440\u0443\u0431\u0430"
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 7c5caf3ceee44f71588860c5c1fbdbe0
|
||||||
|
m_Address: Audio/Dispatcher/take_damage3
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 803e40b883c823b89a91aa8b9d9fc483
|
||||||
|
m_Address: valve_sound
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 81844a99f5b786b41b831174f8fb6d3a
|
||||||
|
m_Address: Prefabs/Player/CharacterController
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 8187ea542d6ed824d81230966a3b7499
|
||||||
|
m_Address: Assets/Resources_moved/Audio/Music/Bauhaus - Bela Lugosi's Dead (No
|
||||||
|
Vocals Remix).mp3
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 82c71411174bfa86ca1f676b9d389f94
|
||||||
|
m_Address: bastard!
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 8c2be26d359d54063825fedfad7a493b
|
||||||
|
m_Address: Audio/Dispatcher/late2
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 8fa89a492fc3a3768a0f0ba1bb7080e0
|
||||||
|
m_Address: Audio/Dispatcher/late1
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 9293380a88bf6736889be29722b94269
|
||||||
|
m_Address: Audio/AudioSource
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: a306df57f348ce7cf900d0b9431739ee
|
||||||
|
m_Address: launch_selectmenu
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: b2e8dc2aeb0311cd8a826b51cf8e94dc
|
||||||
|
m_Address: GameOver
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: b33855c694de89386a25c56cbe463a0e
|
||||||
|
m_Address: Assets/Resources_moved/Prefabs/Enemies/DrunkenGrandpa.prefab
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: b3471d165fe389f479380f61034bea57
|
||||||
|
m_Address: Assets/Resources_moved/Prefabs/Levels/Level1 1.prefab
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: c566fc932edefbbee9e53271eac3c560
|
||||||
|
m_Address: MainMenu
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: cab4b1ff78dd6b1fba61aa165aa17b4d
|
||||||
|
m_Address: Audio/Dispatcher/receiving_an_order2
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: d4eaf1439c2788c458127b9ba67e4fbf
|
||||||
|
m_Address: Prefabs/Levels/Level1
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: ebe18293a5ef86704b23dad3a1786476
|
||||||
|
m_Address: Half-Life01
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: f23b9fce9594618e5b75845f1cae50de
|
||||||
|
m_Address: LoadingScreen
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: f3d7dc64b34919ad7b50a3dd307a935b
|
||||||
|
m_Address: Assets/Resources_moved/Prefabs/Enemies/Fog.prefab
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: f74a409bf11b25148ad305acc05b14f5
|
||||||
|
m_Address: Audio/Dispatcher/take_damage2
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
m_ReadOnly: 0
|
m_ReadOnly: 0
|
||||||
m_Settings: {fileID: 11400000, guid: 2588e84eb64800d0781c574a37fa48d8, type: 2}
|
m_Settings: {fileID: 11400000, guid: 2588e84eb64800d0781c574a37fa48d8, type: 2}
|
||||||
m_SchemaSet:
|
m_SchemaSet:
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
%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: 7e3976da977cb49238499ea3b4c237ae, type: 3}
|
||||||
|
m_Name: ProfileDataSourceSettings
|
||||||
|
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.ProfileDataSourceSettings
|
||||||
|
profileGroupTypes:
|
||||||
|
- m_GroupTypePrefix: Built-In
|
||||||
|
m_Variables:
|
||||||
|
- m_Suffix: BuildPath
|
||||||
|
m_Value: '[UnityEngine.AddressableAssets.Addressables.BuildPath]/[BuildTarget]'
|
||||||
|
- m_Suffix: LoadPath
|
||||||
|
m_Value: '{UnityEngine.AddressableAssets.Addressables.RuntimePath}/[BuildTarget]'
|
||||||
|
environments: []
|
||||||
|
currentEnvironment:
|
||||||
|
id:
|
||||||
|
projectId:
|
||||||
|
projectGenesisId:
|
||||||
|
name:
|
||||||
|
isDefault: 0
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7e2b0e48c9649284a9541c4d1dad59c2
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Code.App.StateMachine;
|
||||||
|
using Code.StateMachine;
|
||||||
|
|
||||||
|
namespace Code.App.AppStates
|
||||||
|
{
|
||||||
|
public class BootstrapState : BaseState<AppStateMachineContext>
|
||||||
|
{
|
||||||
|
public BootstrapState(AppStateMachineContext context) : base(context)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0183e73a08c64332babded3df3d06b95
|
||||||
|
timeCreated: 1762122962
|
||||||
@@ -1,23 +1,76 @@
|
|||||||
using Code.App.StateMachine;
|
using Code.App.StateMachine;
|
||||||
|
using Code.Gameplay.Player;
|
||||||
|
using Code.Input;
|
||||||
using Code.StateMachine;
|
using Code.StateMachine;
|
||||||
|
using Code.UI;
|
||||||
|
using Cysharp.Threading.Tasks;
|
||||||
|
using Reflex.Core;
|
||||||
|
using Reflex.Extensions;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.InputSystem;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
namespace Code.App.AppStates
|
namespace Code.App.AppStates
|
||||||
{
|
{
|
||||||
public class GameOverState : BaseState<AppStateMachineContext>
|
public class GameOverState : BaseState<AppStateMachineContext>
|
||||||
{
|
{
|
||||||
public GameOverState(AppStateMachineContext context) : base(context)
|
public GameOverState(AppStateMachineContext context) : base(context)
|
||||||
{ }
|
{
|
||||||
|
}
|
||||||
|
private IPlayerScore _playerScore;
|
||||||
|
|
||||||
|
private GameOverPanel _gameOverPanel;
|
||||||
|
|
||||||
public override void EnterState()
|
public override void EnterState()
|
||||||
{
|
{
|
||||||
|
Container sceneContainer = SceneManager.GetActiveScene().GetSceneContainer();
|
||||||
|
_playerScore = sceneContainer.Resolve<IPlayerScore>();
|
||||||
|
_scoreCounter = 0;
|
||||||
|
|
||||||
|
Context.InputService.EnableMap(ActionMappings.UI);
|
||||||
|
Context.InputService.DebugBindAction((int)ActionMappings.UI,(int)UIActions.Continue, TryToExit);
|
||||||
|
|
||||||
|
GameOver();
|
||||||
|
|
||||||
base.EnterState();
|
base.EnterState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Tick()
|
private void TryToExit(InputAction.CallbackContext context)
|
||||||
{ }
|
{
|
||||||
|
ToMainMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async UniTaskVoid GameOver()
|
||||||
|
{
|
||||||
|
await Context.UIService.AsyncSwitchPanelTo(UIPanel.GameOver);
|
||||||
|
|
||||||
|
_gameOverPanel = (GameOverPanel)Context.UIService.CurrentPanel;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ToMainMenu()
|
||||||
|
{
|
||||||
|
Context.StateMachine.SwitchState(AppState.MainMenu)
|
||||||
|
.AllowStateTransition(AppState.Gameplay);
|
||||||
|
}
|
||||||
|
private float _scoreCounter;
|
||||||
|
public override void Tick()
|
||||||
|
{
|
||||||
|
if (!_gameOverPanel) return;
|
||||||
|
|
||||||
|
_scoreCounter += Time.deltaTime * 100;
|
||||||
|
// UnityEngine.Debug.Log($"Score: {_scoreCounter}");
|
||||||
|
if((int)_scoreCounter >= _playerScore.Score)
|
||||||
|
{
|
||||||
|
_gameOverPanel.UpdateScoreText(_playerScore.Score);
|
||||||
|
}
|
||||||
|
else _gameOverPanel.UpdateScoreText((int)_scoreCounter);
|
||||||
|
}
|
||||||
public override void ExitState()
|
public override void ExitState()
|
||||||
{
|
{
|
||||||
|
Context.InputService.DisableMap(ActionMappings.UI);
|
||||||
|
Context.InputService.DebugUnbindAction((int)ActionMappings.UI,(int)UIActions.Continue, TryToExit);
|
||||||
|
|
||||||
base.ExitState();
|
base.ExitState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,38 +1,254 @@
|
|||||||
|
using Code.App.Loading;
|
||||||
using Code.App.StateMachine;
|
using Code.App.StateMachine;
|
||||||
|
using Code.Audio;
|
||||||
|
using Code.Gameplay.Camera;
|
||||||
|
using Code.Gameplay.Camera.CameraStates;
|
||||||
|
using Code.Gameplay.Character.Core;
|
||||||
|
using Code.Gameplay.Orders.Order;
|
||||||
|
using Code.Gameplay.Player;
|
||||||
using Code.Input;
|
using Code.Input;
|
||||||
using Code.Scenes;
|
using Code.Scenes;
|
||||||
|
using Code.Scenes.SceneEnvironments;
|
||||||
using Code.StateMachine;
|
using Code.StateMachine;
|
||||||
|
using Code.UI;
|
||||||
|
using Code.UI.Panels;
|
||||||
|
using Cysharp.Threading.Tasks;
|
||||||
|
using Reflex.Core;
|
||||||
|
using Reflex.Extensions;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.InputSystem;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
namespace Code.App.AppStates
|
namespace Code.App.AppStates
|
||||||
{
|
{
|
||||||
public class GameplayState : BaseState<AppStateMachineContext>
|
public class GameplayState : BaseState<AppStateMachineContext>
|
||||||
{
|
{
|
||||||
|
private PlayerHealth _playerHealth;
|
||||||
|
private IPlayerScore _playerScore;
|
||||||
|
|
||||||
|
private IOrderService _orderService;
|
||||||
|
|
||||||
|
private CharacterProvider _playerCharacter;
|
||||||
public GameplayState(AppStateMachineContext context) : base(context)
|
public GameplayState(AppStateMachineContext context) : base(context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void EnterState()
|
public override void EnterState()
|
||||||
{
|
{
|
||||||
Context.SceneLoaderService.LoadScene((int)SceneIds.Gameplay, SceneLoaded);
|
Context.UIService.LoadingScreen.Show();
|
||||||
|
|
||||||
|
Context.LoadingManager
|
||||||
|
.RegisterLoading(LoadingWork.LoadScene)
|
||||||
|
.RegisterLoading(LoadingWork.LoadUI)
|
||||||
|
.RegisterLoading(LoadingWork.LoadModelResource)
|
||||||
|
.RegisterLoading(LoadingWork.LoadAudio);
|
||||||
|
|
||||||
|
//_playerHealth = Context.PlayerFactory.CreatePlayerHealth();
|
||||||
|
|
||||||
|
//_playerHealth.OnDamage += PlayerDamageTaken;
|
||||||
|
//_playerHealth.OnDeath += EndGame;
|
||||||
|
|
||||||
|
Context.AudioService.TransitToSnapshot(AudioSnapshotState.None);
|
||||||
|
|
||||||
Context.InputService.EnableMap(ActionMappings.Gameplay);
|
Context.InputService.EnableMap(ActionMappings.Gameplay);
|
||||||
}
|
|
||||||
|
|
||||||
private void SceneLoaded()
|
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.Debug1, InstaKillDEBUG);
|
||||||
|
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.Debug4, RoomPassedDEBUG);
|
||||||
|
|
||||||
|
Context.SceneLoaderService.LoadSceneAsyncAwaitable((int)SceneIds.DevGen);
|
||||||
|
Context.LoadingManager.OnLoadingEnded += AfterSceneLoaded;
|
||||||
|
|
||||||
|
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||||
|
WaitForLoad();
|
||||||
|
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||||
|
}
|
||||||
|
private async UniTask WaitForPlayerCharacterLoad() => _playerCharacter = await Context.PlayerFactory.CreatePlayer();
|
||||||
|
|
||||||
|
private async UniTaskVoid WaitForLoad()
|
||||||
{
|
{
|
||||||
|
await UniTask.WhenAll(
|
||||||
|
Context.UIService.AsyncSwitchPanelTo(UIPanel.Gameplay),
|
||||||
|
Context.AudioFactory.WarmGameplayMusic(),
|
||||||
|
Context.AudioFactory.WarmSFX(),
|
||||||
|
Context.AudioFactory.WarmDispatcher()
|
||||||
|
);
|
||||||
|
|
||||||
base.EnterState();
|
Context.LoadingManager
|
||||||
|
.UnregisterLoading(LoadingWork.LoadUI)
|
||||||
|
.UnregisterLoading(LoadingWork.LoadAudio);
|
||||||
|
|
||||||
|
InputServiceInitialize();
|
||||||
|
|
||||||
|
MusicInitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void AfterSceneLoaded()
|
||||||
|
{
|
||||||
|
Context.LoadingManager
|
||||||
|
.RegisterLoading(LoadingWork.LoadModelResource);
|
||||||
|
|
||||||
|
Context.LoadingManager.OnLoadingEnded -= AfterSceneLoaded;
|
||||||
|
Context.LoadingManager.OnLoadingEnded += AfterPlayerLoaded;
|
||||||
|
|
||||||
|
await UniTask.WhenAll(
|
||||||
|
WaitForPlayerArmsToInitialize(),
|
||||||
|
WaitForPlayerCharacterLoad()
|
||||||
|
);
|
||||||
|
|
||||||
|
_playerHealth = Context.PlayerProvider.Health;
|
||||||
|
_playerHealth.OnDamage += PlayerDamageTaken;
|
||||||
|
_playerHealth.OnDeath += EndGame;
|
||||||
|
|
||||||
|
Context.LoadingManager
|
||||||
|
.UnregisterLoading(LoadingWork.LoadModelResource);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AfterPlayerLoaded()
|
||||||
|
{
|
||||||
|
Container sceneContainer = SceneManager.GetActiveScene().GetSceneContainer();
|
||||||
|
|
||||||
|
_playerScore = sceneContainer.Resolve<IPlayerScore>();
|
||||||
|
|
||||||
|
GameplaySceneEnvironment sceneEnvironment = SceneEnvironmentVariables(sceneContainer);
|
||||||
|
|
||||||
|
PlayerInitialize(sceneEnvironment);
|
||||||
|
|
||||||
|
CameraInitialize();
|
||||||
|
|
||||||
|
GameplayServicesInitialize(sceneContainer);
|
||||||
|
|
||||||
|
UIInitialize();
|
||||||
|
|
||||||
|
Context.LoadingManager.OnLoadingEnded -= AfterPlayerLoaded;
|
||||||
|
|
||||||
|
_tickEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async UniTask WaitForPlayerArmsToInitialize() => _armsMesh = await Context.PlayerFactory.CreateArms(Context.CameraStateMachine.Camera.transform);
|
||||||
|
|
||||||
|
private void OrderGiven(float time)
|
||||||
|
{
|
||||||
|
_gameplayPanel.ShowTimer();
|
||||||
|
Context.AudioService.TransitToSnapshot(AudioSnapshotState.Action);
|
||||||
|
}
|
||||||
|
private void OrderFailure()
|
||||||
|
{
|
||||||
|
_playerHealth.InstaKill();
|
||||||
|
}
|
||||||
|
private void OrderRecieved(float time)
|
||||||
|
{
|
||||||
|
Context.AudioService.PlayDispatcher((DispatcherSounds)Random.Range((int)DispatcherSounds.Recieve1,(int)DispatcherSounds.Recieve2));
|
||||||
|
}
|
||||||
|
private void OrderDelivered(int score, float time)
|
||||||
|
{
|
||||||
|
_gameplayPanel.HideTimer();
|
||||||
|
|
||||||
|
if(time < 0f) Context.AudioService.PlayDispatcher((DispatcherSounds)Random.Range((int)DispatcherSounds.Late1,(int)DispatcherSounds.Late2));
|
||||||
|
_playerScore.UpdateScore(score);
|
||||||
|
|
||||||
|
Context.AudioService.TransitToSnapshot(AudioSnapshotState.Peaceful);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PlayerDamageTaken(int damage, PlayerHealth health)
|
||||||
|
{
|
||||||
|
Context.AudioService.PlayDispatcher((DispatcherSounds)Random.Range((int)DispatcherSounds.TakeDamage1,(int)DispatcherSounds.TakeDamage4));
|
||||||
|
}
|
||||||
|
// DEBUG
|
||||||
|
private void InstaKillDEBUG(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
_playerHealth.InstaKill();
|
||||||
|
}
|
||||||
|
private void RoomPassedDEBUG(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
_orderService.RoomPassed();
|
||||||
|
}
|
||||||
|
// DEBUG
|
||||||
|
private bool _tickEnabled;
|
||||||
public override void Tick()
|
public override void Tick()
|
||||||
{
|
{
|
||||||
|
if (!_tickEnabled) return;
|
||||||
|
|
||||||
|
_orderService.DecreaseTimer(Time.deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EndGame()
|
||||||
|
{
|
||||||
|
Context.StateMachine.SwitchState(AppState.GameOver)
|
||||||
|
.AllowStateTransition(AppState.MainMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ExitState()
|
public override void ExitState()
|
||||||
{
|
{
|
||||||
|
_playerHealth = null;
|
||||||
|
_playerScore = null;
|
||||||
|
|
||||||
|
_tickEnabled = false;
|
||||||
|
|
||||||
|
Context.PlayerFactory.ReleasePlayer(_playerCharacter);
|
||||||
|
_playerCharacter = null;
|
||||||
|
Context.PlayerFactory.ReleaseArms(_armsMesh);
|
||||||
|
_armsMesh = null;
|
||||||
|
_orderService = null;
|
||||||
|
|
||||||
|
Context.AudioService.OnDispatcherStarted -= _gameplayPanel.SummonDispatcher;
|
||||||
|
Context.AudioService.OnDispatcherEnded -= _gameplayPanel.CloseDispatcher;
|
||||||
|
|
||||||
Context.InputService.DisableMap(ActionMappings.Gameplay);
|
Context.InputService.DisableMap(ActionMappings.Gameplay);
|
||||||
|
Context.AudioService.GladlyAskToStopMusic(MusicType.Action, callback: Context.AudioFactory.ReleaseActionMusic);
|
||||||
|
Context.AudioService.GladlyAskToStopMusic(MusicType.Peaceful, callback: Context.AudioFactory.ReleasePeacefulMusic);
|
||||||
|
|
||||||
|
|
||||||
|
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.Debug1, InstaKillDEBUG);
|
||||||
|
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.Debug4, RoomPassedDEBUG);
|
||||||
|
|
||||||
base.ExitState();
|
base.ExitState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void InputServiceInitialize()
|
||||||
|
{
|
||||||
|
Context.InputService.EnableMap(ActionMappings.Gameplay);
|
||||||
|
}
|
||||||
|
private void CameraInitialize()
|
||||||
|
{
|
||||||
|
Context.CameraStateMachine.SwitchState(CameraMode.FirstPerson);
|
||||||
|
((BaseCameraState)Context.CameraStateMachine.CurrentBaseState).SetFollowTransform(_playerCharacter.GetFollowTransform());
|
||||||
|
}
|
||||||
|
|
||||||
|
private GameplayPanel _gameplayPanel;
|
||||||
|
private ArmsMeshProvider _armsMesh;
|
||||||
|
|
||||||
|
private void UIInitialize()
|
||||||
|
{
|
||||||
|
_gameplayPanel = (GameplayPanel)Context.UIService.CurrentPanel;
|
||||||
|
_gameplayPanel.Initialize(_playerScore, _playerHealth, _orderService);
|
||||||
|
Context.AudioService.OnDispatcherStarted += _gameplayPanel.SummonDispatcher;
|
||||||
|
Context.AudioService.OnDispatcherEnded += _gameplayPanel.CloseDispatcher;
|
||||||
|
}
|
||||||
|
private void MusicInitialize()
|
||||||
|
{
|
||||||
|
Context.AudioService.PlayRandomMusicUntilHumanityWillBeDestroyedForTheySins(MusicType.Peaceful);
|
||||||
|
Context.AudioService.PlayRandomMusicUntilHumanityWillBeDestroyedForTheySins(MusicType.Action);
|
||||||
|
Context.AudioService.TransitToSnapshot(AudioSnapshotState.Peaceful);
|
||||||
|
}
|
||||||
|
private void PlayerInitialize(GameplaySceneEnvironment sceneEnvironment)
|
||||||
|
{
|
||||||
|
_playerCharacter.Teleport(sceneEnvironment.playerSpawnPoint.position, sceneEnvironment.playerSpawnPoint.rotation);
|
||||||
|
_playerCharacter.PlayerAnimator.SetAnimator(_armsMesh.ArmsAnimator);
|
||||||
|
}
|
||||||
|
private void GameplayServicesInitialize(Container sceneContainer)
|
||||||
|
{
|
||||||
|
_orderService = sceneContainer.Resolve<IOrderService>();
|
||||||
|
|
||||||
|
_orderService.OnOrderGiven += OrderGiven;
|
||||||
|
_orderService.OnOrderRecieved += OrderRecieved;
|
||||||
|
_orderService.OnOrderDelivered += OrderDelivered;
|
||||||
|
_orderService.OnOrderFailure += OrderFailure;
|
||||||
|
}
|
||||||
|
private GameplaySceneEnvironment SceneEnvironmentVariables(Container sceneContainer)
|
||||||
|
{
|
||||||
|
var sceneEnvironment = (GameplaySceneEnvironment)sceneContainer.Resolve<CurrentSceneEnvironment>();
|
||||||
|
|
||||||
|
return sceneEnvironment;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,34 +1,128 @@
|
|||||||
|
using Code.App.Loading;
|
||||||
using Code.App.StateMachine;
|
using Code.App.StateMachine;
|
||||||
|
using Code.Audio;
|
||||||
|
using Code.Gameplay.Camera;
|
||||||
|
using Code.Gameplay.Camera.CameraStates;
|
||||||
|
using Code.Gameplay.Door;
|
||||||
using Code.Input;
|
using Code.Input;
|
||||||
using Code.Scenes;
|
using Code.Scenes;
|
||||||
|
using Code.Scenes.SceneEnvironments;
|
||||||
using Code.StateMachine;
|
using Code.StateMachine;
|
||||||
|
using Code.UI;
|
||||||
|
using Code.UI.Panels;
|
||||||
|
using Cysharp.Threading.Tasks;
|
||||||
|
using Reflex.Extensions;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
namespace Code.App.AppStates
|
namespace Code.App.AppStates
|
||||||
{
|
{
|
||||||
public class MainMenuState : BaseState<AppStateMachineContext>
|
public class MainMenuState : BaseState<AppStateMachineContext>
|
||||||
{
|
{
|
||||||
public MainMenuState(AppStateMachineContext context) : base(context)
|
public MainMenuState(AppStateMachineContext context) : base(context)
|
||||||
{ }
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public override void EnterState()
|
public override void EnterState()
|
||||||
{
|
{
|
||||||
Context.SceneLoaderService.LoadScene((int)SceneIds.MainMenu, SceneLoaded);
|
Context.LoadingManager
|
||||||
|
.RegisterLoading(LoadingWork.LoadScene)
|
||||||
|
.RegisterLoading(LoadingWork.LoadUI)
|
||||||
|
.RegisterLoading(LoadingWork.LoadAudio);
|
||||||
|
|
||||||
|
// Context.UIService.LoadingScreen.Show();
|
||||||
|
|
||||||
|
Context.CameraStateMachine.SwitchState(CameraMode.MainMenu);
|
||||||
|
|
||||||
|
Context.SceneLoaderService.LoadSceneAsyncAwaitable((int)SceneIds.MainMenu);
|
||||||
|
Context.LoadingManager.OnLoadingEnded += AfterSceneLoaded;
|
||||||
|
|
||||||
|
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||||
|
WaitForLoad();
|
||||||
|
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||||
|
}
|
||||||
|
|
||||||
|
private async UniTaskVoid WaitForLoad()
|
||||||
|
{
|
||||||
|
await UniTask.WhenAll(
|
||||||
|
Context.UIService.AsyncSwitchPanelTo(UIPanel.MainMenu),
|
||||||
|
Context.AudioFactory.WarmMenuMusic(),
|
||||||
|
Context.AudioFactory.WarmAudioTestClips()
|
||||||
|
);
|
||||||
|
Context.LoadingManager
|
||||||
|
.UnregisterLoading(LoadingWork.LoadUI)
|
||||||
|
.UnregisterLoading(LoadingWork.LoadAudio);
|
||||||
|
|
||||||
|
InitializeAudio();
|
||||||
|
|
||||||
|
InitializeInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AfterSceneLoaded()
|
||||||
|
{
|
||||||
|
var mainMenuEnvironment = (MainMenuEnvironment)SceneManager.GetActiveScene()
|
||||||
|
.GetSceneContainer().Resolve<CurrentSceneEnvironment>();
|
||||||
|
|
||||||
|
InitializeUI(mainMenuEnvironment);
|
||||||
|
|
||||||
|
InitializeCamera(mainMenuEnvironment);
|
||||||
|
|
||||||
|
Context.LoadingManager.OnLoadingEnded -= AfterSceneLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeCamera(MainMenuEnvironment mainMenuEnvironment)
|
||||||
|
{
|
||||||
|
((Gameplay.Camera.CameraStates.MainMenuState)Context.CameraStateMachine.CurrentBaseState).SetFollowTransform(mainMenuEnvironment
|
||||||
|
.cameraPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeInput()
|
||||||
|
{
|
||||||
Context.InputService.EnableMap(ActionMappings.MainMenu);
|
Context.InputService.EnableMap(ActionMappings.MainMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SceneLoaded()
|
private void InitializeAudio()
|
||||||
{
|
{
|
||||||
|
Context.AudioService.TransitToSnapshot(AudioSnapshotState.Menu);
|
||||||
|
Context.AudioService.PlayRandomMusicUntilHumanityWillBeDestroyedForTheySins(MusicType.Menu);
|
||||||
base.EnterState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void InitializeUI(MainMenuEnvironment mainMenuEnvironment)
|
||||||
|
{
|
||||||
|
var menuPanel = (MainMenuPanel)Context.UIService.CurrentPanel;
|
||||||
|
menuPanel.Initialize(mainMenuEnvironment.uiVariables,
|
||||||
|
mainMenuEnvironment.startButton,
|
||||||
|
mainMenuEnvironment.settingButton,
|
||||||
|
mainMenuEnvironment.exitButton);
|
||||||
|
|
||||||
|
menuPanel.startButton.button.onClick.AddListener(StartGame);
|
||||||
|
menuPanel.exitButton.button.onClick.AddListener(ExitGame);
|
||||||
|
|
||||||
|
mainMenuEnvironment.menuButtonsCanvas.worldCamera = Context.CameraStateMachine.Camera;
|
||||||
|
mainMenuEnvironment.settingsCanvas.worldCamera = Context.CameraStateMachine.Camera;
|
||||||
|
}
|
||||||
|
|
||||||
public override void Tick()
|
public override void Tick()
|
||||||
{ }
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StartGame()
|
||||||
|
{
|
||||||
|
Context.StateMachine.SwitchState(AppState.Gameplay)
|
||||||
|
.AllowStateTransition(AppState.GameOver);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ExitGame()
|
||||||
|
{
|
||||||
|
Application.Quit();
|
||||||
|
}
|
||||||
|
|
||||||
public override void ExitState()
|
public override void ExitState()
|
||||||
{
|
{
|
||||||
Context.InputService.DisableMap(ActionMappings.MainMenu);
|
Context.InputService.DisableMap(ActionMappings.MainMenu);
|
||||||
|
Context.AudioService.GladlyAskToStopMusic(MusicType.Menu, callback: Context.AudioFactory.ReleaseMenuMusic);
|
||||||
|
|
||||||
|
Context.AudioFactory.ReleaseAudioTestClips();
|
||||||
base.ExitState();
|
base.ExitState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Code.App.StateMachine;
|
using Code.App.StateMachine;
|
||||||
|
using Code.Gameplay.Camera;
|
||||||
using Code.Input;
|
using Code.Input;
|
||||||
using Code.Scenes;
|
using Code.Scenes;
|
||||||
using Code.StateMachine;
|
using Code.StateMachine;
|
||||||
@@ -14,8 +15,10 @@ namespace Code.App.AppStates
|
|||||||
|
|
||||||
public override void EnterState()
|
public override void EnterState()
|
||||||
{
|
{
|
||||||
Context.SceneLoaderService.LoadScene((int)SceneIds.MovementDev, SceneLoaded);
|
// Context.SceneLoaderService.LoadScene((int)SceneIds.MovementDev, SceneLoaded);
|
||||||
Context.InputService.EnableMap(ActionMappings.Gameplay);
|
Context.InputService.EnableMap(ActionMappings.Gameplay);
|
||||||
|
|
||||||
|
Context.CameraStateMachine.SwitchState(CameraMode.FirstPerson);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SceneLoaded()
|
private void SceneLoaded()
|
||||||
|
|||||||
@@ -1,8 +1,20 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Code.App.Loading;
|
||||||
using Code.App.StateMachine;
|
using Code.App.StateMachine;
|
||||||
|
using Code.Audio;
|
||||||
using Code.Configs;
|
using Code.Configs;
|
||||||
|
using Code.Constants;
|
||||||
|
using Code.Gameplay.Camera;
|
||||||
|
using Code.Gameplay.Enemies;
|
||||||
|
using Code.Gameplay.Orders.Order;
|
||||||
|
using Code.Gameplay.Player;
|
||||||
|
using Code.Generator;
|
||||||
using Code.Input;
|
using Code.Input;
|
||||||
using Code.Scenes;
|
using Code.Scenes;
|
||||||
using Code.StaticData;
|
using Code.StaticData;
|
||||||
|
using Code.UI;
|
||||||
|
using Code.UI.Panels;
|
||||||
|
using Cysharp.Threading.Tasks;
|
||||||
using Reflex.Core;
|
using Reflex.Core;
|
||||||
using Reflex.Injectors;
|
using Reflex.Injectors;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@@ -12,28 +24,51 @@ namespace Code.App
|
|||||||
{
|
{
|
||||||
public class BootstrapInstaller : MonoBehaviour, IInstaller
|
public class BootstrapInstaller : MonoBehaviour, IInstaller
|
||||||
{
|
{
|
||||||
|
|
||||||
public void InstallBindings(ContainerBuilder containerBuilder)
|
public void InstallBindings(ContainerBuilder containerBuilder)
|
||||||
{
|
{
|
||||||
InstallStaticData(containerBuilder, out IStaticDataService staticDataService);
|
InstallStaticData(containerBuilder, out IStaticDataService staticDataService);
|
||||||
|
|
||||||
InstallInfrastructureUnit(containerBuilder, staticDataService);
|
InstallInfrastructureUnit(containerBuilder, staticDataService);
|
||||||
|
|
||||||
|
containerBuilder.AddSingleton(typeof(LoadingManager), typeof(ILoadingManager));
|
||||||
|
|
||||||
containerBuilder.AddSingleton(typeof(InputService), typeof(IInputService));
|
containerBuilder.AddSingleton(typeof(InputService), typeof(IInputService));
|
||||||
|
// Перенести нахуй в контейнер геймплея
|
||||||
|
containerBuilder.AddSingleton(typeof(PlayerFactory), typeof(IPlayerFactory));
|
||||||
|
containerBuilder.AddSingleton(typeof(EnemyFactory), typeof(IEnemyFactory));
|
||||||
|
containerBuilder.AddSingleton(typeof(PlayerProvider), typeof(IPlayerProvider));
|
||||||
|
//
|
||||||
|
InitializeCamera(containerBuilder, staticDataService);
|
||||||
|
|
||||||
|
containerBuilder.AddSingleton(typeof(UIFactory), typeof(IUIFactory));
|
||||||
|
containerBuilder.AddSingleton(typeof(UIService), typeof(IUIService));
|
||||||
|
|
||||||
|
containerBuilder.AddSingleton(typeof(AudioFactory), typeof(IAudioFactory));
|
||||||
|
containerBuilder.AddSingleton(typeof(AudioService), typeof(IAudioService));
|
||||||
|
|
||||||
containerBuilder.AddSingleton(typeof(SceneLoaderService), typeof(ISceneLoaderService));
|
containerBuilder.AddSingleton(typeof(SceneLoaderService), typeof(ISceneLoaderService));
|
||||||
|
|
||||||
containerBuilder.OnContainerBuilt += Bootstrap;
|
containerBuilder.OnContainerBuilt += Bootstrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void InitializeCamera(ContainerBuilder containerBuilder, IStaticDataService staticDataService)
|
||||||
|
{
|
||||||
|
Camera camera = Instantiate(staticDataService.CameraConfig.cameraPrefab);
|
||||||
|
|
||||||
|
DontDestroyOnLoad(camera);
|
||||||
|
containerBuilder.AddSingleton(camera);
|
||||||
|
}
|
||||||
|
|
||||||
private void InstallInfrastructureUnit(ContainerBuilder containerBuilder, IStaticDataService staticDataService)
|
private void InstallInfrastructureUnit(ContainerBuilder containerBuilder, IStaticDataService staticDataService)
|
||||||
{
|
{
|
||||||
GameObject infrastructureUnit = Instantiate(staticDataService.AppConfig.infrastructureUnitPrefab);
|
GameObject infrastructureUnit = Instantiate(staticDataService.AppConfig.infrastructureUnitPrefab);
|
||||||
DontDestroyOnLoad(infrastructureUnit);
|
DontDestroyOnLoad(infrastructureUnit);
|
||||||
|
|
||||||
containerBuilder.AddSingleton(infrastructureUnit);
|
containerBuilder.AddSingleton(infrastructureUnit);
|
||||||
containerBuilder.AddSingleton(infrastructureUnit.GetComponent<ICoroutineRunner>(),
|
containerBuilder.AddSingleton(infrastructureUnit.AddComponent<CoroutineRunner>(),
|
||||||
typeof(ICoroutineRunner));
|
typeof(ICoroutineRunner));
|
||||||
containerBuilder.AddSingleton(infrastructureUnit.AddComponent<AppStateMachine>());
|
containerBuilder.AddSingleton(infrastructureUnit.AddComponent<AppStateMachine>());
|
||||||
|
containerBuilder.AddSingleton(infrastructureUnit.AddComponent<CameraStateMachine>());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InstallStaticData(ContainerBuilder containerBuilder, out IStaticDataService staticDataService)
|
private void InstallStaticData(ContainerBuilder containerBuilder, out IStaticDataService staticDataService)
|
||||||
@@ -42,19 +77,73 @@ namespace Code.App
|
|||||||
staticDataService.Load();
|
staticDataService.Load();
|
||||||
|
|
||||||
containerBuilder.AddSingleton(staticDataService, typeof(IStaticDataService));
|
containerBuilder.AddSingleton(staticDataService, typeof(IStaticDataService));
|
||||||
|
|
||||||
containerBuilder.AddSingleton(staticDataService.InputConfig.inputActionAsset, typeof(InputActionAsset));
|
containerBuilder.AddSingleton(staticDataService.InputConfig.inputActionAsset, typeof(InputActionAsset));
|
||||||
|
containerBuilder.AddSingleton(staticDataService.InputConfig, typeof(InputConfig));
|
||||||
|
|
||||||
|
containerBuilder.AddSingleton(staticDataService.CameraConfig, typeof(CameraConfig));
|
||||||
|
containerBuilder.AddSingleton(staticDataService.CameraSettingsConfigs, typeof(Dictionary<CameraMode,CameraSettingsConfig>));
|
||||||
|
|
||||||
|
containerBuilder.AddSingleton(staticDataService.PlayerConfig, typeof(PlayerConfig));
|
||||||
|
containerBuilder.AddSingleton(staticDataService.CharacterConfig, typeof(CharacterConfig));
|
||||||
|
|
||||||
|
containerBuilder.AddSingleton(staticDataService.UIConfig, typeof(UIConfig));
|
||||||
|
|
||||||
|
containerBuilder.AddSingleton(staticDataService.DrunkenGrandpaConfig, typeof(DrunkenGrandpaConfig));
|
||||||
|
containerBuilder.AddSingleton(staticDataService.CockroachConfig, typeof(CockroachConfig));
|
||||||
|
containerBuilder.AddSingleton(staticDataService.FogConfig, typeof(FogConfig));
|
||||||
|
|
||||||
|
containerBuilder.AddSingleton(staticDataService.AudioMixerConfig, typeof(AudioMixerConfig));
|
||||||
|
containerBuilder.AddSingleton(staticDataService.SoundtrackListConfig, typeof(SoundtrackListConfig));
|
||||||
|
containerBuilder.AddSingleton(staticDataService.AudioTestClipsConfig, typeof(AudioTestClipsConfig));
|
||||||
|
containerBuilder.AddSingleton(staticDataService.SFXListConfig, typeof(SFXListConfig));
|
||||||
|
containerBuilder.AddSingleton(staticDataService.DispatcherSoundListConfig, typeof(DispatcherSoundListConfig));
|
||||||
|
containerBuilder.AddSingleton(staticDataService.EnemiesSoundListConfig, typeof(EnemiesSoundListConfig));
|
||||||
|
containerBuilder.AddSingleton(staticDataService.AudioSourceSettingsConfigs, typeof(Dictionary<AudioSourceType, AudioSourceSettingsConfig>));
|
||||||
|
|
||||||
|
containerBuilder.AddSingleton(staticDataService.OrderServiceConfig, typeof(OrderServiceConfig));
|
||||||
|
containerBuilder.AddSingleton(staticDataService.OrderBoxConfig, typeof(OrderBoxConfig));
|
||||||
|
|
||||||
|
containerBuilder.AddSingleton(staticDataService.GeneratorConfig, typeof(GeneratorConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AppStateMachine _appStateMachine;
|
||||||
|
|
||||||
private void Bootstrap(Container container)
|
private void Bootstrap(Container container)
|
||||||
{
|
{
|
||||||
AppStateMachine appStateMachine = container.Resolve<AppStateMachine>();
|
_appStateMachine = container.Resolve<AppStateMachine>();
|
||||||
appStateMachine.Initialize();
|
_appStateMachine.Initialize();
|
||||||
|
AttributeInjector.Inject(_appStateMachine.StateMachineContext, container);
|
||||||
|
|
||||||
AttributeInjector.Inject(appStateMachine.StateMachineContext, container);
|
CameraStateMachine cameraStateMachine = container.Resolve<CameraStateMachine>();
|
||||||
|
AttributeInjector.Inject(cameraStateMachine.StateMachineContext, container);
|
||||||
|
cameraStateMachine.Initialize();
|
||||||
|
|
||||||
// TODO: поменяно для теста
|
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||||
appStateMachine
|
BootstrapFinish(container);
|
||||||
.SwitchState(AppState.MovementDev);
|
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||||
|
}
|
||||||
|
private async UniTaskVoid BootstrapFinish(Container container)
|
||||||
|
{
|
||||||
|
var loadingScreen = GameObject.FindWithTag(Tags.LoadingScreen).GetComponent<LoadingScreen>();
|
||||||
|
DontDestroyOnLoad(loadingScreen.gameObject);
|
||||||
|
|
||||||
|
ILoadingManager loadingManager = container.Resolve<ILoadingManager>();
|
||||||
|
loadingManager.OnLoadingStarted += loadingScreen.Show;
|
||||||
|
loadingManager.OnLoadingEnded += loadingScreen.Hide;
|
||||||
|
|
||||||
|
loadingManager.RegisterLoading(LoadingWork.Bootstrap);
|
||||||
|
|
||||||
|
await UniTask.WhenAll(
|
||||||
|
container.Resolve<IUIService>().Initialize(loadingScreen),
|
||||||
|
container.Resolve<IAudioService>().Initialize()
|
||||||
|
);
|
||||||
|
|
||||||
|
loadingManager.UnregisterLoading(LoadingWork.Bootstrap);
|
||||||
|
|
||||||
|
_appStateMachine
|
||||||
|
.SwitchState(AppState.MainMenu)
|
||||||
|
.AllowStateTransition(AppState.Gameplay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 08b54658296d4279b85a2bfc3cf10e62
|
||||||
|
timeCreated: 1763842256
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Cysharp.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Code.App.Loading
|
||||||
|
{
|
||||||
|
public interface ILoadingManager
|
||||||
|
{
|
||||||
|
delegate void OnLoadingDelegate();
|
||||||
|
|
||||||
|
event OnLoadingDelegate OnLoadingStarted;
|
||||||
|
event OnLoadingDelegate OnLoadingEnded;
|
||||||
|
ReadOnlyCollection<LoadingWork> LoadingThings { get; }
|
||||||
|
LoadingManager RegisterLoading(LoadingWork loadingThingName);
|
||||||
|
LoadingManager UnregisterLoading(LoadingWork loadingThingName);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bfb3837590d04da3b04ca8b0f0aca437
|
||||||
|
timeCreated: 1763842985
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Cysharp.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Code.App.Loading
|
||||||
|
{
|
||||||
|
public class LoadingManager : ILoadingManager
|
||||||
|
{
|
||||||
|
public event ILoadingManager.OnLoadingDelegate OnLoadingStarted;
|
||||||
|
public event ILoadingManager.OnLoadingDelegate OnLoadingEnded;
|
||||||
|
|
||||||
|
private List<LoadingWork> _loadingThings = new();
|
||||||
|
public ReadOnlyCollection<LoadingWork> LoadingThings => _loadingThings.AsReadOnly();
|
||||||
|
|
||||||
|
public LoadingManager RegisterLoading(LoadingWork loadingThingName)
|
||||||
|
{
|
||||||
|
if(_loadingThings.Count == 0) OnLoadingStarted?.Invoke();
|
||||||
|
|
||||||
|
_loadingThings.Add(loadingThingName);
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public LoadingManager UnregisterLoading(LoadingWork loadingThingName)
|
||||||
|
{
|
||||||
|
_loadingThings.Remove(loadingThingName);
|
||||||
|
|
||||||
|
if(_loadingThings.Count == 0) OnLoadingEnded?.Invoke();
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static class LoadingManagerExtensions
|
||||||
|
// {
|
||||||
|
// public static LoadingManager AddLoading(this LoadingManager manager, LoadingWork loadingThingName)
|
||||||
|
// {
|
||||||
|
// manager.RegisterLoading(loadingThingName);
|
||||||
|
// return manager;
|
||||||
|
// }
|
||||||
|
// public static LoadingManager RemoveLoading(this LoadingManager manager, LoadingWork loadingThingName)
|
||||||
|
// {
|
||||||
|
// manager.UnregisterLoading(loadingThingName);
|
||||||
|
// return manager;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 185988ac74a24a39864238cd7f5cb626
|
||||||
|
timeCreated: 1763842268
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
namespace Code.App.Loading
|
||||||
|
{
|
||||||
|
public enum LoadingWork
|
||||||
|
{
|
||||||
|
Bootstrap,
|
||||||
|
LoadUI,
|
||||||
|
LoadAudio,
|
||||||
|
LoadScene,
|
||||||
|
LoadModelResource,
|
||||||
|
WaitingForTime
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 318d1b29b41d4b96bc09334acbf36506
|
||||||
|
timeCreated: 1763843934
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c7a271c6319540abb78d561f392e1396
|
||||||
|
timeCreated: 1761743570
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
using Code.App.Loading;
|
||||||
|
using Code.Gameplay.Orders.Order;
|
||||||
|
using Code.Gameplay.Player;
|
||||||
|
using Code.Generator;
|
||||||
|
using Code.Scenes;
|
||||||
|
using Code.Scenes.SceneEnvironments;
|
||||||
|
using Cysharp.Threading.Tasks;
|
||||||
|
using Reflex.Core;
|
||||||
|
using UnityEngine;
|
||||||
|
using IPlayerScore = Code.Gameplay.Player.IPlayerScore;
|
||||||
|
|
||||||
|
namespace Code.App.SceneInstallers
|
||||||
|
{
|
||||||
|
public class GameplaySceneInstaller : MonoBehaviour, IInstaller
|
||||||
|
{
|
||||||
|
[SerializeField] private GameplaySceneEnvironment _gameplaySceneEnvironment;
|
||||||
|
|
||||||
|
public void InstallBindings(ContainerBuilder containerBuilder)
|
||||||
|
{
|
||||||
|
containerBuilder.AddScoped(typeof(GameplaySceneEnvironment), typeof(CurrentSceneEnvironment));
|
||||||
|
containerBuilder.AddScoped(typeof(PlayerScore), typeof(IPlayerScore));
|
||||||
|
containerBuilder.AddScoped(typeof(OrderService), typeof(IOrderService));
|
||||||
|
containerBuilder.AddScoped(typeof(RoomGeneratorFactory), typeof(IRoomGeneratorFactory));
|
||||||
|
containerBuilder.AddScoped(typeof(RoomGenerator));
|
||||||
|
|
||||||
|
containerBuilder.OnContainerBuilt += Initialize;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Initialize(Container container)
|
||||||
|
{
|
||||||
|
ILoadingManager loadingManager = container.Resolve<ILoadingManager>();
|
||||||
|
|
||||||
|
GameplaySceneEnvironment env = (GameplaySceneEnvironment)container.Resolve<CurrentSceneEnvironment>();
|
||||||
|
|
||||||
|
env.TransitVariables(_gameplaySceneEnvironment);
|
||||||
|
|
||||||
|
loadingManager
|
||||||
|
.UnregisterLoading(LoadingWork.LoadScene);
|
||||||
|
|
||||||
|
LoadRooms(container,loadingManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async UniTaskVoid LoadRooms(Container container, ILoadingManager loadingManager)
|
||||||
|
{
|
||||||
|
await container.Resolve<IRoomGeneratorFactory>().PreloadRooms(container.Resolve<IOrderService>());
|
||||||
|
|
||||||
|
container.Resolve<RoomGenerator>().Initialize();
|
||||||
|
|
||||||
|
loadingManager.UnregisterLoading(LoadingWork.LoadModelResource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 88584fd4361b46f6a7326440cd95ce69
|
||||||
|
timeCreated: 1763144580
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using Code.App.Loading;
|
||||||
|
using Code.Scenes;
|
||||||
|
using Code.Scenes.SceneEnvironments;
|
||||||
|
using Reflex.Core;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.App.SceneInstallers
|
||||||
|
{
|
||||||
|
public class MainMenuSceneInstaller : MonoBehaviour, IInstaller
|
||||||
|
{
|
||||||
|
[SerializeField] private MainMenuEnvironment _mainMenuEnvironment;
|
||||||
|
|
||||||
|
public void InstallBindings(ContainerBuilder containerBuilder)
|
||||||
|
{
|
||||||
|
containerBuilder.AddScoped(typeof(MainMenuEnvironment), typeof(CurrentSceneEnvironment));
|
||||||
|
|
||||||
|
containerBuilder.OnContainerBuilt += Initialize;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Initialize(Container container)
|
||||||
|
{
|
||||||
|
MainMenuEnvironment env = (MainMenuEnvironment)container.Resolve<CurrentSceneEnvironment>();
|
||||||
|
|
||||||
|
env.TransitVariables(_mainMenuEnvironment);
|
||||||
|
|
||||||
|
ILoadingManager loadingManager = container.Resolve<ILoadingManager>();
|
||||||
|
|
||||||
|
loadingManager
|
||||||
|
.UnregisterLoading(LoadingWork.LoadScene);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 04145a046c584b66818ca25745652e66
|
||||||
|
timeCreated: 1761743587
|
||||||
@@ -7,6 +7,7 @@ namespace Code.App.StateMachine
|
|||||||
{
|
{
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
States.Add(AppState.Bootstrap, new BootstrapState(StateMachineContext));
|
||||||
States.Add(AppState.MainMenu, new MainMenuState(StateMachineContext));
|
States.Add(AppState.MainMenu, new MainMenuState(StateMachineContext));
|
||||||
States.Add(AppState.Gameplay, new GameplayState(StateMachineContext));
|
States.Add(AppState.Gameplay, new GameplayState(StateMachineContext));
|
||||||
States.Add(AppState.GameOver, new GameOverState(StateMachineContext));
|
States.Add(AppState.GameOver, new GameOverState(StateMachineContext));
|
||||||
@@ -16,6 +17,8 @@ namespace Code.App.StateMachine
|
|||||||
AllowedStates |= AppState.MainMenu;
|
AllowedStates |= AppState.MainMenu;
|
||||||
AllowedStates |= AppState.Gameplay;
|
AllowedStates |= AppState.Gameplay;
|
||||||
AllowedStates |= AppState.MovementDev;
|
AllowedStates |= AppState.MovementDev;
|
||||||
|
|
||||||
|
CurrentBaseState = States[AppState.Bootstrap];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool CheckTransitionAllowed(AppState nextState) => AllowedStates.HasFlag(nextState);
|
protected override bool CheckTransitionAllowed(AppState nextState) => AllowedStates.HasFlag(nextState);
|
||||||
|
|||||||
@@ -1,12 +1,28 @@
|
|||||||
|
using Code.App.Loading;
|
||||||
|
using Code.Audio;
|
||||||
|
using Code.Gameplay.Camera;
|
||||||
|
using Code.Gameplay.Enemies;
|
||||||
|
using Code.Gameplay.Player;
|
||||||
|
using Code.Generator;
|
||||||
using Code.Input;
|
using Code.Input;
|
||||||
using Code.Scenes;
|
using Code.Scenes;
|
||||||
|
using Code.UI;
|
||||||
using Reflex.Attributes;
|
using Reflex.Attributes;
|
||||||
|
|
||||||
namespace Code.App.StateMachine
|
namespace Code.App.StateMachine
|
||||||
{
|
{
|
||||||
public class AppStateMachineContext
|
public class AppStateMachineContext
|
||||||
{
|
{
|
||||||
[Inject] public ISceneLoaderService SceneLoaderService;
|
[Inject] public ILoadingManager LoadingManager { get; private set; }
|
||||||
[Inject] public IInputService InputService;
|
[Inject] public ISceneLoaderService SceneLoaderService { get; private set; }
|
||||||
|
[Inject] public IInputService InputService { get; private set; }
|
||||||
|
[Inject] public AppStateMachine StateMachine { get; private set; }
|
||||||
|
[Inject] public CameraStateMachine CameraStateMachine { get; private set; }
|
||||||
|
[Inject] public IUIService UIService { get; private set; }
|
||||||
|
[Inject] public IPlayerFactory PlayerFactory { get; private set; }
|
||||||
|
[Inject] public IPlayerProvider PlayerProvider { get; private set; }
|
||||||
|
[Inject] public IAudioFactory AudioFactory { get; private set; }
|
||||||
|
[Inject] public IAudioService AudioService { get; private set; }
|
||||||
|
[Inject] public IEnemyFactory EnemyFactory { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a1937581573e47844bb593bd62310b89
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
namespace Code.Audio
|
||||||
|
{
|
||||||
|
public enum SFXSounds
|
||||||
|
{
|
||||||
|
Crowbar,
|
||||||
|
Shot357
|
||||||
|
}
|
||||||
|
public enum UISounds
|
||||||
|
{
|
||||||
|
Crowbar
|
||||||
|
}
|
||||||
|
public enum EnemiesSounds
|
||||||
|
{
|
||||||
|
Bastard,
|
||||||
|
Bravo
|
||||||
|
}
|
||||||
|
public enum DispatcherSounds
|
||||||
|
{
|
||||||
|
Recieve1,
|
||||||
|
Recieve2,
|
||||||
|
TakeDamage1,
|
||||||
|
TakeDamage2,
|
||||||
|
TakeDamage3,
|
||||||
|
TakeDamage4,
|
||||||
|
Late1,
|
||||||
|
Late2,
|
||||||
|
Late3,
|
||||||
|
Late4,
|
||||||
|
Late5
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 907b506ceac843ebb509a8e5298af540
|
||||||
|
timeCreated: 1762888870
|
||||||
@@ -0,0 +1,186 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Code.Configs;
|
||||||
|
using Cysharp.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
using UnityEngine.Audio;
|
||||||
|
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||||
|
using Object = UnityEngine.Object;
|
||||||
|
|
||||||
|
namespace Code.Audio
|
||||||
|
{
|
||||||
|
public class AudioFactory : IAudioFactory
|
||||||
|
{
|
||||||
|
public AudioMixer AudioMixer { get; private set; }
|
||||||
|
private AssetReference _audioSourcePrefab;
|
||||||
|
|
||||||
|
private AssetReference[] _audioTestClipsReferences;
|
||||||
|
private AssetReference[] _peacefulSoundtrack;
|
||||||
|
private AssetReference[] _actionSoundtrack;
|
||||||
|
private AssetReference[] _menuSoundtrack;
|
||||||
|
private AssetReference[] _SFX;
|
||||||
|
private AssetReference[] _enemies;
|
||||||
|
private AssetReference[] _dispatcher;
|
||||||
|
private AssetReference[] _character;
|
||||||
|
|
||||||
|
private AsyncOperationHandle<IList<AudioClip>> _audioTestClipsHandle;
|
||||||
|
private AsyncOperationHandle<IList<AudioClip>> _menuMusicHandle;
|
||||||
|
private AsyncOperationHandle<IList<AudioClip>> _actionMusicHandle;
|
||||||
|
private AsyncOperationHandle<IList<AudioClip>> _peacefulMusicHandle;
|
||||||
|
private AsyncOperationHandle<IList<AudioClip>> _SFXHandle;
|
||||||
|
private AsyncOperationHandle<IList<AudioClip>> _enemiesHandle;
|
||||||
|
private AsyncOperationHandle<IList<AudioClip>> _dispatcherHandle;
|
||||||
|
|
||||||
|
public Dictionary<AudioType, AudioClip> AudioTestClips { get; private set; } = new();
|
||||||
|
public Dictionary<MusicType, List<AudioClip>> MusicDictionary { get; private set; } = new();
|
||||||
|
public List<AudioClip> SFXAudios { get; private set; } = new();
|
||||||
|
public List<AudioClip> EnemiesAudios { get; private set; } = new();
|
||||||
|
public List<AudioClip> DispatcherAudios { get; private set; } = new();
|
||||||
|
|
||||||
|
public AudioFactory(AudioMixerConfig audioMixerConfig,
|
||||||
|
SoundtrackListConfig soundtrackListConfig,
|
||||||
|
SFXListConfig sfxListConfig,
|
||||||
|
EnemiesSoundListConfig enemiesSoundListConfig,
|
||||||
|
DispatcherSoundListConfig dispatcherSoundListConfig,
|
||||||
|
AudioTestClipsConfig audioTestClipsConfig
|
||||||
|
)
|
||||||
|
{
|
||||||
|
AudioMixer = audioMixerConfig.audioMixerAsset;
|
||||||
|
_audioSourcePrefab = audioMixerConfig.audioSourcePrefab;
|
||||||
|
|
||||||
|
_peacefulSoundtrack = soundtrackListConfig.peacefulSoundtrack;
|
||||||
|
_actionSoundtrack = soundtrackListConfig.actionSoundtrack;
|
||||||
|
_menuSoundtrack = soundtrackListConfig.menuSoundtrack;
|
||||||
|
_SFX = sfxListConfig.SFX;
|
||||||
|
_enemies = enemiesSoundListConfig.enemies;
|
||||||
|
_dispatcher = dispatcherSoundListConfig.dispatcher;
|
||||||
|
_audioTestClipsReferences = audioTestClipsConfig.audioTestClips;
|
||||||
|
|
||||||
|
MusicDictionary.Add(MusicType.Menu, new ());
|
||||||
|
MusicDictionary.Add(MusicType.Peaceful, new ());
|
||||||
|
MusicDictionary.Add(MusicType.Action, new ());
|
||||||
|
}
|
||||||
|
|
||||||
|
public async UniTask LoadAudioSourcePrefab(Action<GameObject> callback) =>
|
||||||
|
callback?.Invoke(await Addressables.LoadAssetAsync<GameObject>(_audioSourcePrefab));
|
||||||
|
|
||||||
|
public async UniTask WarmGameplayMusic( )
|
||||||
|
{
|
||||||
|
_actionMusicHandle = Addressables.LoadAssetsAsync<AudioClip>(_actionSoundtrack, OnActionTrackLoaded, Addressables.MergeMode.Union);
|
||||||
|
_peacefulMusicHandle = Addressables.LoadAssetsAsync<AudioClip>(_peacefulSoundtrack, OnPeacefulTrackLoaded, Addressables.MergeMode.Union);
|
||||||
|
|
||||||
|
await UniTask.WhenAll(_actionMusicHandle.ToUniTask(), _peacefulMusicHandle.ToUniTask());
|
||||||
|
}
|
||||||
|
public void ReleaseActionMusic()
|
||||||
|
{
|
||||||
|
MusicDictionary[MusicType.Action].Clear();
|
||||||
|
_actionMusicHandle.Release();
|
||||||
|
}
|
||||||
|
public void ReleasePeacefulMusic()
|
||||||
|
{
|
||||||
|
MusicDictionary[MusicType.Peaceful].Clear();
|
||||||
|
_peacefulMusicHandle.Release();
|
||||||
|
}
|
||||||
|
public async UniTask WarmAudioTestClips( )
|
||||||
|
{
|
||||||
|
// _audioTestClipCounter = 0;
|
||||||
|
_audioTestClipsHandle = Addressables.LoadAssetsAsync<AudioClip>(_audioTestClipsReferences, OnAudioTestClipLoaded, Addressables.MergeMode.Union);
|
||||||
|
|
||||||
|
// foreach (var assetReference in _menuSoundtrack) MenuMusic.Add(await assetReference.LoadAssetAsync<AudioClip>());
|
||||||
|
var clips = (await _audioTestClipsHandle.ToUniTask()).ToList();
|
||||||
|
|
||||||
|
for (int i = 0; i < clips.Count; i++)
|
||||||
|
AudioTestClips[(AudioType)i] = clips[i];
|
||||||
|
}
|
||||||
|
public void ReleaseAudioTestClips()
|
||||||
|
{
|
||||||
|
AudioTestClips.Clear();
|
||||||
|
// foreach (var assetReference in _menuSoundtrack) assetReference.ReleaseAsset();
|
||||||
|
_audioTestClipsHandle.Release();
|
||||||
|
}
|
||||||
|
public async UniTask WarmMenuMusic( )
|
||||||
|
{
|
||||||
|
_menuMusicHandle = Addressables.LoadAssetsAsync<AudioClip>(_menuSoundtrack, OnMenuTrackLoaded, Addressables.MergeMode.Union);
|
||||||
|
// foreach (var assetReference in _menuSoundtrack) MenuMusic.Add(await assetReference.LoadAssetAsync<AudioClip>());
|
||||||
|
await _menuMusicHandle.ToUniTask();
|
||||||
|
}
|
||||||
|
public void ReleaseMenuMusic()
|
||||||
|
{
|
||||||
|
MusicDictionary[MusicType.Menu].Clear();
|
||||||
|
// foreach (var assetReference in _menuSoundtrack) assetReference.ReleaseAsset();
|
||||||
|
_menuMusicHandle.Release();
|
||||||
|
}
|
||||||
|
public async UniTask WarmSFX( )
|
||||||
|
{
|
||||||
|
_SFXHandle = Addressables.LoadAssetsAsync<AudioClip>(_SFX, OnSFXLoaded, Addressables.MergeMode.Union);
|
||||||
|
|
||||||
|
await _SFXHandle.ToUniTask();
|
||||||
|
|
||||||
|
}
|
||||||
|
public void ReleaseSFX()
|
||||||
|
{
|
||||||
|
SFXAudios.Clear();
|
||||||
|
_SFXHandle.Release();
|
||||||
|
}
|
||||||
|
public async UniTask WarmEnemies( )
|
||||||
|
{
|
||||||
|
_enemiesHandle = Addressables.LoadAssetsAsync<AudioClip>(_enemies, OnEnemiesLoaded, Addressables.MergeMode.Union);
|
||||||
|
|
||||||
|
await _enemiesHandle.ToUniTask();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReleaseEnemies()
|
||||||
|
{
|
||||||
|
EnemiesAudios.Clear();
|
||||||
|
_enemiesHandle.Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async UniTask WarmDispatcher( )
|
||||||
|
{
|
||||||
|
_dispatcherHandle = Addressables.LoadAssetsAsync<AudioClip>(_dispatcher, OnDispatcherLoaded, Addressables.MergeMode.Union);
|
||||||
|
|
||||||
|
await _dispatcherHandle.ToUniTask();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReleaseDispatcher()
|
||||||
|
{
|
||||||
|
DispatcherAudios.Clear();
|
||||||
|
_dispatcherHandle.Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnMenuTrackLoaded(AudioClip audioClip)
|
||||||
|
{
|
||||||
|
MusicDictionary[MusicType.Menu].Add(audioClip);
|
||||||
|
}
|
||||||
|
|
||||||
|
// private int _audioTestClipCounter;
|
||||||
|
private void OnAudioTestClipLoaded(AudioClip audioClip)
|
||||||
|
{
|
||||||
|
// AudioTestClips[(AudioType)_audioTestClipCounter] = audioClip;_audioTestClipCounter++;
|
||||||
|
}
|
||||||
|
private void OnActionTrackLoaded(AudioClip audioClip)
|
||||||
|
{
|
||||||
|
MusicDictionary[MusicType.Action].Add(audioClip);
|
||||||
|
}
|
||||||
|
private void OnPeacefulTrackLoaded(AudioClip audioClip)
|
||||||
|
{
|
||||||
|
MusicDictionary[MusicType.Peaceful].Add(audioClip);
|
||||||
|
}
|
||||||
|
private void OnSFXLoaded(AudioClip audioClip)
|
||||||
|
{
|
||||||
|
SFXAudios.Add(audioClip);
|
||||||
|
}
|
||||||
|
private void OnEnemiesLoaded(AudioClip audioClip)
|
||||||
|
{
|
||||||
|
EnemiesAudios.Add(audioClip);
|
||||||
|
}
|
||||||
|
private void OnDispatcherLoaded(AudioClip audioClip)
|
||||||
|
{
|
||||||
|
DispatcherAudios.Add(audioClip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5a4b48740d194d4dafa1732f96d71687
|
||||||
|
timeCreated: 1762626915
|
||||||
@@ -0,0 +1,352 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using Code.Configs;
|
||||||
|
using Code.Constants;
|
||||||
|
using Cysharp.Threading.Tasks;
|
||||||
|
using DG.Tweening;
|
||||||
|
using Reflex.Attributes;
|
||||||
|
using Unity.VisualScripting;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
using UnityEngine.Audio;
|
||||||
|
using Random = UnityEngine.Random;
|
||||||
|
|
||||||
|
namespace Code.Audio
|
||||||
|
{
|
||||||
|
public class AudioService : IAudioService
|
||||||
|
{
|
||||||
|
private IAudioFactory _audioFactory;
|
||||||
|
|
||||||
|
private AudioMixer _mixer;
|
||||||
|
private AudioSource _actionMusicSource;
|
||||||
|
private AudioSource _peacefulMusicSource;
|
||||||
|
|
||||||
|
private AudioMixerGroup _masterGroup,
|
||||||
|
// _musicGroup,
|
||||||
|
_actionMusicGroup,
|
||||||
|
_menuMusicGroup,
|
||||||
|
_peacefulMusicGroup,
|
||||||
|
_SFXGroup,
|
||||||
|
_creaturesGroup,
|
||||||
|
_dispatcherGroup,
|
||||||
|
_courierGroup,
|
||||||
|
_enemiesGroup;
|
||||||
|
|
||||||
|
private readonly AudioSourcePool _audioSourcePool;
|
||||||
|
|
||||||
|
private Dictionary<AudioSnapshotState, AudioMixerSnapshot> _snapshots = new();
|
||||||
|
private Dictionary<AudioSourceType, AudioSourceSettingsConfig> _settings;
|
||||||
|
|
||||||
|
public AudioService(IAudioFactory audioFactory, Dictionary<AudioSourceType, AudioSourceSettingsConfig> settings)
|
||||||
|
{
|
||||||
|
_audioFactory = audioFactory;
|
||||||
|
_audioSourcePool = new(settings);
|
||||||
|
_settings = settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Грязно, убрать снапшоты НАХУЙ
|
||||||
|
public float GetSetting(AudioType type)
|
||||||
|
{
|
||||||
|
float value;
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case AudioType.SFX:
|
||||||
|
_snapshots[AudioSnapshotState.Peaceful].audioMixer.GetFloat(_SFXGroup.name, out value);
|
||||||
|
break;
|
||||||
|
case AudioType.Master:
|
||||||
|
_snapshots[AudioSnapshotState.Menu].audioMixer.GetFloat(_masterGroup.name, out value);
|
||||||
|
break;
|
||||||
|
case AudioType.Creatures:
|
||||||
|
_snapshots[AudioSnapshotState.Peaceful].audioMixer.GetFloat(_creaturesGroup.name, out value);
|
||||||
|
break;
|
||||||
|
case AudioType.GameplayMusic:
|
||||||
|
_snapshots[AudioSnapshotState.Peaceful].audioMixer.GetFloat(_peacefulMusicGroup.name, out value);
|
||||||
|
break;
|
||||||
|
case AudioType.MenuMusic:
|
||||||
|
_snapshots[AudioSnapshotState.Menu].audioMixer.GetFloat(_menuMusicGroup.name, out value);
|
||||||
|
break;
|
||||||
|
case AudioType.DispatcherSounds:
|
||||||
|
_snapshots[AudioSnapshotState.Action].audioMixer.GetFloat(_dispatcherGroup.name, out value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
value = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = Mathf.Pow(10f, value / 20);
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Грязно, убрать снапшоты НАХУЙ
|
||||||
|
public void ChangeSetting(AudioType type, float value)
|
||||||
|
{
|
||||||
|
float volume = Mathf.Log10(value) * 20;
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case AudioType.SFX:
|
||||||
|
_snapshots[AudioSnapshotState.Peaceful].audioMixer.SetFloat(_SFXGroup.name, volume);
|
||||||
|
_snapshots[AudioSnapshotState.Action].audioMixer.SetFloat(_SFXGroup.name, volume);
|
||||||
|
break;
|
||||||
|
case AudioType.Master:
|
||||||
|
_snapshots[AudioSnapshotState.Menu].audioMixer.SetFloat(_masterGroup.name, volume);
|
||||||
|
_snapshots[AudioSnapshotState.Peaceful].audioMixer.SetFloat(_masterGroup.name, volume);
|
||||||
|
_snapshots[AudioSnapshotState.Action].audioMixer.SetFloat(_masterGroup.name, volume);
|
||||||
|
break;
|
||||||
|
case AudioType.Creatures:
|
||||||
|
_snapshots[AudioSnapshotState.Peaceful].audioMixer.SetFloat(_creaturesGroup.name, volume);
|
||||||
|
_snapshots[AudioSnapshotState.Action].audioMixer.SetFloat(_creaturesGroup.name, volume);
|
||||||
|
break;
|
||||||
|
case AudioType.GameplayMusic:
|
||||||
|
_snapshots[AudioSnapshotState.Peaceful].audioMixer.SetFloat(_peacefulMusicGroup.name, volume);
|
||||||
|
_snapshots[AudioSnapshotState.Action].audioMixer.SetFloat(_actionMusicGroup.name, volume);
|
||||||
|
break;
|
||||||
|
case AudioType.MenuMusic:
|
||||||
|
_snapshots[AudioSnapshotState.Menu].audioMixer.SetFloat(_menuMusicGroup.name, volume);
|
||||||
|
break;
|
||||||
|
case AudioType.DispatcherSounds:
|
||||||
|
_snapshots[AudioSnapshotState.Peaceful].audioMixer.SetFloat(_dispatcherGroup.name, volume);
|
||||||
|
_snapshots[AudioSnapshotState.Action].audioMixer.SetFloat(_dispatcherGroup.name, volume);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// _mixer.FindSnapshot("Action").audioMixer.SetFloat("music", volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async UniTask Initialize()
|
||||||
|
{
|
||||||
|
// _mixer = await _audioFactory.CreateMixer();
|
||||||
|
_mixer = _audioFactory.AudioMixer;
|
||||||
|
|
||||||
|
_masterGroup = _mixer.FindMatchingGroups(AudioGroups.MasterGroup)[0];
|
||||||
|
_menuMusicGroup = _mixer.FindMatchingGroups(AudioGroups.MenuMusicGroup)[0];
|
||||||
|
_actionMusicGroup = _mixer.FindMatchingGroups(AudioGroups.ActionMusicGroup)[0];
|
||||||
|
_peacefulMusicGroup = _mixer.FindMatchingGroups(AudioGroups.PeacefulMusicGroup)[0];
|
||||||
|
// _musicGroup = _mixer.FindMatchingGroups(AudioGroups.MusicGroup)[0];
|
||||||
|
_musicAudioGroups.Add(MusicType.Menu, _mixer.FindMatchingGroups(AudioGroups.MenuMusicGroup)[0]);
|
||||||
|
_musicAudioGroups.Add(MusicType.Action, _mixer.FindMatchingGroups(AudioGroups.ActionMusicGroup)[0]);
|
||||||
|
_musicAudioGroups.Add(MusicType.Peaceful, _mixer.FindMatchingGroups(AudioGroups.PeacefulMusicGroup)[0]);
|
||||||
|
|
||||||
|
_cancellationTokenSources.Add(MusicType.Menu, new());
|
||||||
|
_cancellationTokenSources.Add(MusicType.Action, new());
|
||||||
|
_cancellationTokenSources.Add(MusicType.Peaceful, new());
|
||||||
|
|
||||||
|
_musicAudioSources.Add(MusicType.Menu, null);
|
||||||
|
_musicAudioSources.Add(MusicType.Action, null);
|
||||||
|
_musicAudioSources.Add(MusicType.Peaceful, null);
|
||||||
|
|
||||||
|
_SFXGroup = _mixer.FindMatchingGroups(AudioGroups.SFXGroup)[0];
|
||||||
|
_creaturesGroup = _mixer.FindMatchingGroups(AudioGroups.CreaturesGroup)[0];
|
||||||
|
_dispatcherGroup = _mixer.FindMatchingGroups(AudioGroups.DispatcherMusicGroup)[0];
|
||||||
|
_courierGroup = _mixer.FindMatchingGroups(AudioGroups.CourierMusicGroup)[0];
|
||||||
|
_enemiesGroup = _mixer.FindMatchingGroups(AudioGroups.EnemiesMusicGroup)[0];
|
||||||
|
|
||||||
|
_snapshots[AudioSnapshotState.None] = _mixer.FindSnapshot(AudioGroups.NoneSnapshot);
|
||||||
|
_snapshots[AudioSnapshotState.Peaceful] = _mixer.FindSnapshot(AudioGroups.PeacefulSnapshot);
|
||||||
|
_snapshots[AudioSnapshotState.Action] = _mixer.FindSnapshot(AudioGroups.ActionSnapshot);
|
||||||
|
_snapshots[AudioSnapshotState.Menu] = _mixer.FindSnapshot(AudioGroups.MenuSnapshot);
|
||||||
|
|
||||||
|
await _audioFactory.LoadAudioSourcePrefab(_audioSourcePool.Initialize);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||||
|
private Dictionary<MusicType, CancellationTokenSource> _cancellationTokenSources = new();
|
||||||
|
private Dictionary<MusicType, AudioSource> _musicAudioSources = new();
|
||||||
|
private Dictionary<MusicType, AudioMixerGroup> _musicAudioGroups = new();
|
||||||
|
|
||||||
|
public async UniTaskVoid PlayRandomMusicUntilHumanityWillBeDestroyedForTheySins(MusicType musicType)
|
||||||
|
{
|
||||||
|
if (!_musicAudioSources[musicType])
|
||||||
|
{
|
||||||
|
_musicAudioSources[musicType] = _audioSourcePool.GetSource();
|
||||||
|
_musicAudioSources[musicType].spatialBlend = _settings[AudioSourceType.NoBlend].spatialBlend;
|
||||||
|
_musicAudioSources[musicType].outputAudioMixerGroup = _musicAudioGroups[musicType];
|
||||||
|
}
|
||||||
|
|
||||||
|
_musicAudioSources[musicType].resource =
|
||||||
|
_audioFactory.MusicDictionary[musicType][
|
||||||
|
Random.Range(0, _audioFactory.MusicDictionary[musicType].Count)];
|
||||||
|
|
||||||
|
_musicAudioSources[musicType].Play();
|
||||||
|
|
||||||
|
// await UniTask.WaitUntilValueChanged(_musicAudioSources[musicType],
|
||||||
|
// _ => !_musicAudioSources[musicType].isPlaying,
|
||||||
|
// cancellationToken: _cancellationTokenSources[musicType].Token);
|
||||||
|
await UniTask.NextFrame();
|
||||||
|
// Debug.Log($"Playing {musicType}");
|
||||||
|
var (isCanceled, _) = await UniTask.WaitUntilValueChanged(_musicAudioSources[musicType],
|
||||||
|
_ => !_musicAudioSources[musicType].isPlaying,
|
||||||
|
cancellationToken: _cancellationTokenSources[musicType].Token).SuppressCancellationThrow();
|
||||||
|
// Debug.Log($"Finished {musicType}");
|
||||||
|
|
||||||
|
if (isCanceled)
|
||||||
|
{
|
||||||
|
// Debug.Log($"Cancelled {musicType}");
|
||||||
|
_cancellationTokenSources[musicType].Dispose();
|
||||||
|
_cancellationTokenSources[musicType] = new();
|
||||||
|
|
||||||
|
_audioSourcePool.ReleaseSource(_musicAudioSources[musicType]);
|
||||||
|
_musicAudioSources[musicType] = null;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayRandomMusicUntilHumanityWillBeDestroyedForTheySins(musicType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async UniTaskVoid GladlyAskToStopMusic(MusicType musicType,
|
||||||
|
AudioSnapshotState audioSnapshotState = AudioSnapshotState.None, float time = 1f, Action callback = null)
|
||||||
|
{
|
||||||
|
TransitToSnapshot(audioSnapshotState, time);
|
||||||
|
|
||||||
|
await UniTask.WaitForSeconds(time);
|
||||||
|
|
||||||
|
_cancellationTokenSources[musicType].Cancel();
|
||||||
|
|
||||||
|
callback?.Invoke();
|
||||||
|
}
|
||||||
|
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||||
|
|
||||||
|
public void StopMusic()
|
||||||
|
{
|
||||||
|
_peacefulMusicSource.Stop();
|
||||||
|
_actionMusicSource.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GladlyAskToStopMusic(Action callback = null)
|
||||||
|
{
|
||||||
|
TransitToSnapshot(AudioSnapshotState.None);
|
||||||
|
_peacefulMusicSource.Stop();
|
||||||
|
_actionMusicSource.Stop();
|
||||||
|
|
||||||
|
callback?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TransitToSnapshot(AudioSnapshotState state, float time = 1f)
|
||||||
|
{
|
||||||
|
_snapshots[state].TransitionTo(time);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||||
|
public void PlaySFX(SFXSounds sfxId, Vector3 position)
|
||||||
|
{
|
||||||
|
_audioSourcePool.PlayOneShot(_audioFactory.SFXAudios[(int)sfxId], position, _SFXGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PlayEnemy(EnemiesSounds enemySoundId, Vector3 position)
|
||||||
|
{
|
||||||
|
_audioSourcePool.PlayOneShot(_audioFactory.EnemiesAudios[(int)enemySoundId], position, _enemiesGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Чинить долго и дорого пусть Артёмов будет много, ведь он наш друг
|
||||||
|
public event IAudioService.OnAudioPlayingDelegate OnDispatcherStarted;
|
||||||
|
public event IAudioService.OnAudioPlayingDelegate OnDispatcherEnded;
|
||||||
|
|
||||||
|
public void PlayDispatcher(DispatcherSounds dispatcherSoundId)
|
||||||
|
{
|
||||||
|
OnDispatcherStarted?.Invoke();
|
||||||
|
_audioSourcePool.PlayOneShot(_audioFactory.DispatcherAudios[(int)dispatcherSoundId], _dispatcherGroup,
|
||||||
|
AudioSourceType.NoBlend, () => OnDispatcherEnded?.Invoke());
|
||||||
|
}
|
||||||
|
|
||||||
|
private CancellationTokenSource _testClipCancellationTokenSource = new();
|
||||||
|
private void ResetCurrentTestAudioSource() => _currentTestClipAudioType = AudioType.Master;
|
||||||
|
// TODO Засунуть в словарь
|
||||||
|
public void PlayTestClip(AudioType audioType)
|
||||||
|
{
|
||||||
|
if(_currentTestClipAudioType == audioType) return;
|
||||||
|
|
||||||
|
_testClipCancellationTokenSource.Cancel();
|
||||||
|
_testClipCancellationTokenSource = new();
|
||||||
|
|
||||||
|
_currentTestClipAudioType = audioType;
|
||||||
|
|
||||||
|
switch (audioType)
|
||||||
|
{
|
||||||
|
case AudioType.SFX:
|
||||||
|
_audioSourcePool.PlayOneShot(_audioFactory.AudioTestClips[audioType],
|
||||||
|
_SFXGroup, _testClipCancellationTokenSource,
|
||||||
|
AudioSourceType.NoBlend, ResetCurrentTestAudioSource);
|
||||||
|
break;
|
||||||
|
case AudioType.Master:
|
||||||
|
_audioSourcePool.PlayOneShot(_audioFactory.AudioTestClips[audioType],
|
||||||
|
_masterGroup, _testClipCancellationTokenSource,
|
||||||
|
AudioSourceType.NoBlend, ResetCurrentTestAudioSource);
|
||||||
|
break;
|
||||||
|
case AudioType.Creatures:
|
||||||
|
_audioSourcePool.PlayOneShot( _audioFactory.AudioTestClips[audioType],
|
||||||
|
_creaturesGroup, _testClipCancellationTokenSource,
|
||||||
|
AudioSourceType.NoBlend, ResetCurrentTestAudioSource);
|
||||||
|
break;
|
||||||
|
case AudioType.GameplayMusic:
|
||||||
|
_audioSourcePool.PlayOneShot(_audioFactory.AudioTestClips[audioType],
|
||||||
|
_actionMusicGroup, _testClipCancellationTokenSource,
|
||||||
|
AudioSourceType.NoBlend, ResetCurrentTestAudioSource);
|
||||||
|
break;
|
||||||
|
case AudioType.MenuMusic:
|
||||||
|
_audioSourcePool.PlayOneShot(_audioFactory.AudioTestClips[audioType],
|
||||||
|
_menuMusicGroup, _testClipCancellationTokenSource,
|
||||||
|
AudioSourceType.NoBlend, ResetCurrentTestAudioSource);
|
||||||
|
break;
|
||||||
|
case AudioType.DispatcherSounds:
|
||||||
|
_audioSourcePool.PlayOneShot(_audioFactory.AudioTestClips[audioType],
|
||||||
|
_dispatcherGroup, _testClipCancellationTokenSource,
|
||||||
|
AudioSourceType.NoBlend, ResetCurrentTestAudioSource);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private AudioSource _testClipAudioSource;
|
||||||
|
private AudioType _currentTestClipAudioType;
|
||||||
|
|
||||||
|
// Эффективно и просто, может не так хитровыебано
|
||||||
|
private void ReleaseTestAudioClipSource()
|
||||||
|
{
|
||||||
|
_testClipAudioSource = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Засунуть в словарь
|
||||||
|
public void PlayTestClipDeprecated(AudioType audioType)
|
||||||
|
{
|
||||||
|
if (!_testClipAudioSource) _testClipAudioSource = _audioSourcePool.GetSource();
|
||||||
|
else if (_currentTestClipAudioType != audioType) _testClipAudioSource.Stop();
|
||||||
|
else return;
|
||||||
|
|
||||||
|
_currentTestClipAudioType = audioType;
|
||||||
|
|
||||||
|
switch (audioType)
|
||||||
|
{
|
||||||
|
case AudioType.SFX:
|
||||||
|
_audioSourcePool.PlayOneShot(_testClipAudioSource, _audioFactory.AudioTestClips[audioType],
|
||||||
|
_SFXGroup,
|
||||||
|
AudioSourceType.NoBlend, ReleaseTestAudioClipSource);
|
||||||
|
break;
|
||||||
|
case AudioType.Master:
|
||||||
|
_audioSourcePool.PlayOneShot(_testClipAudioSource, _audioFactory.AudioTestClips[audioType],
|
||||||
|
_masterGroup,
|
||||||
|
AudioSourceType.NoBlend, ReleaseTestAudioClipSource);
|
||||||
|
break;
|
||||||
|
case AudioType.Creatures:
|
||||||
|
_audioSourcePool.PlayOneShot(_testClipAudioSource, _audioFactory.AudioTestClips[audioType],
|
||||||
|
_creaturesGroup,
|
||||||
|
AudioSourceType.NoBlend, ReleaseTestAudioClipSource);
|
||||||
|
break;
|
||||||
|
case AudioType.GameplayMusic:
|
||||||
|
_audioSourcePool.PlayOneShot(_testClipAudioSource, _audioFactory.AudioTestClips[audioType],
|
||||||
|
_actionMusicGroup,
|
||||||
|
AudioSourceType.NoBlend, ReleaseTestAudioClipSource);
|
||||||
|
break;
|
||||||
|
case AudioType.MenuMusic:
|
||||||
|
_audioSourcePool.PlayOneShot(_testClipAudioSource, _audioFactory.AudioTestClips[audioType],
|
||||||
|
_menuMusicGroup,
|
||||||
|
AudioSourceType.NoBlend, ReleaseTestAudioClipSource);
|
||||||
|
break;
|
||||||
|
case AudioType.DispatcherSounds:
|
||||||
|
_audioSourcePool.PlayOneShot(_testClipAudioSource, _audioFactory.AudioTestClips[audioType],
|
||||||
|
_dispatcherGroup,
|
||||||
|
AudioSourceType.NoBlend, ReleaseTestAudioClipSource);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bf44cb051308463494bd930f2a3d31e4
|
||||||
|
timeCreated: 1762625073
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Code.Audio
|
||||||
|
{
|
||||||
|
public enum AudioSnapshotState
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Peaceful,
|
||||||
|
Action,
|
||||||
|
Menu
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 29adaf8e912649d9b91c09735e36840a
|
||||||
|
timeCreated: 1762808301
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using Code.Configs;
|
||||||
|
using Cysharp.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Audio;
|
||||||
|
using UnityEngine.Pool;
|
||||||
|
using Object = UnityEngine.Object;
|
||||||
|
|
||||||
|
namespace Code.Audio
|
||||||
|
{
|
||||||
|
public class AudioSourcePool
|
||||||
|
{
|
||||||
|
// The pool holds plain GameObjects (you can swap this for any component type).
|
||||||
|
private IObjectPool<AudioSource> _pool;
|
||||||
|
private GameObject _sourcePrefab;
|
||||||
|
|
||||||
|
private Dictionary<AudioSourceType, AudioSourceSettingsConfig> _settings;
|
||||||
|
|
||||||
|
public AudioSourcePool(Dictionary<AudioSourceType, AudioSourceSettingsConfig> settings) => _settings = settings;
|
||||||
|
|
||||||
|
public void Initialize(GameObject sourcePrefab)
|
||||||
|
{
|
||||||
|
_sourcePrefab = sourcePrefab;
|
||||||
|
|
||||||
|
// Create a pool with the four core callbacks.
|
||||||
|
_pool = new ObjectPool<AudioSource>(
|
||||||
|
createFunc: CreateItem,
|
||||||
|
// actionOnGet: OnGet,
|
||||||
|
actionOnRelease: OnRelease,
|
||||||
|
actionOnDestroy: OnDestroyItem,
|
||||||
|
collectionCheck: true, // helps catch double-release mistakes
|
||||||
|
defaultCapacity: 10,
|
||||||
|
maxSize: 20
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creates a new pooled GameObject the first time (and whenever the pool needs more).
|
||||||
|
private AudioSource CreateItem()
|
||||||
|
{
|
||||||
|
AudioSource audioSource = Object.Instantiate(_sourcePrefab).GetComponent<AudioSource>();
|
||||||
|
audioSource.name = "PooledAudioSource";
|
||||||
|
Object.DontDestroyOnLoad(audioSource);
|
||||||
|
return audioSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when an item is taken from the pool.
|
||||||
|
private void OnGet(AudioSource source)
|
||||||
|
{
|
||||||
|
//source.gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when an item is returned to the pool.
|
||||||
|
private void OnRelease(AudioSource source)
|
||||||
|
{
|
||||||
|
source.Stop();
|
||||||
|
//source.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when the pool decides to destroy an item (e.g., above max size).
|
||||||
|
private void OnDestroyItem(AudioSource source)
|
||||||
|
{
|
||||||
|
Object.Destroy(source.gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async UniTaskVoid PlayOneShot(AudioClip clip, Vector3 position, AudioMixerGroup audioMixerGroup, AudioSourceType audioSourceType = AudioSourceType.NoBlend, Action onComplete = null)
|
||||||
|
{
|
||||||
|
AudioSource source = _pool.Get();
|
||||||
|
source.PlayOneShot(clip);
|
||||||
|
source.spatialBlend = _settings[audioSourceType].spatialBlend;
|
||||||
|
source.transform.position = position;
|
||||||
|
source.outputAudioMixerGroup = audioMixerGroup;
|
||||||
|
|
||||||
|
await UniTask.WaitUntilValueChanged(source, x => x.isPlaying);
|
||||||
|
onComplete?.Invoke();
|
||||||
|
_pool.Release(source);
|
||||||
|
}
|
||||||
|
public async UniTaskVoid PlayOneShot(AudioClip clip, AudioMixerGroup audioMixerGroup, AudioSourceType audioSourceType = AudioSourceType.NoBlend, Action onComplete = null)
|
||||||
|
{
|
||||||
|
AudioSource source = _pool.Get();
|
||||||
|
source.PlayOneShot(clip);
|
||||||
|
source.spatialBlend = _settings[audioSourceType].spatialBlend;
|
||||||
|
source.outputAudioMixerGroup = audioMixerGroup;
|
||||||
|
|
||||||
|
await UniTask.WaitUntilValueChanged(source, x => x.isPlaying);
|
||||||
|
onComplete?.Invoke();
|
||||||
|
_pool.Release(source);
|
||||||
|
}
|
||||||
|
public async UniTaskVoid PlayOneShot(AudioSource audioSource, AudioClip clip, AudioMixerGroup audioMixerGroup, AudioSourceType audioSourceType = AudioSourceType.NoBlend, Action onComplete = null)
|
||||||
|
{
|
||||||
|
audioSource.PlayOneShot(clip);
|
||||||
|
audioSource.spatialBlend = _settings[audioSourceType].spatialBlend;
|
||||||
|
audioSource.outputAudioMixerGroup = audioMixerGroup;
|
||||||
|
|
||||||
|
// TODO Потом сделать. Можно с cancellation, но сейчас лень. Ну правда
|
||||||
|
await UniTask.WaitUntilValueChanged(audioSource, x => x.isPlaying);
|
||||||
|
|
||||||
|
if (!audioSource) return;
|
||||||
|
|
||||||
|
_pool.Release(audioSource);
|
||||||
|
onComplete?.Invoke();
|
||||||
|
}
|
||||||
|
public async UniTaskVoid PlayOneShot(AudioClip clip, AudioMixerGroup audioMixerGroup, CancellationTokenSource cancellationToken, AudioSourceType audioSourceType = AudioSourceType.NoBlend, Action onComplete = null)
|
||||||
|
{
|
||||||
|
AudioSource source = _pool.Get();
|
||||||
|
source.PlayOneShot(clip);
|
||||||
|
source.spatialBlend = _settings[audioSourceType].spatialBlend;
|
||||||
|
source.outputAudioMixerGroup = audioMixerGroup;
|
||||||
|
|
||||||
|
var (isCanceled, _) = await UniTask.WaitUntilValueChanged(source, x => x.isPlaying, cancellationToken: cancellationToken.Token).SuppressCancellationThrow();
|
||||||
|
|
||||||
|
_pool.Release(source);
|
||||||
|
|
||||||
|
if(!isCanceled) onComplete?.Invoke();
|
||||||
|
else cancellationToken.Dispose();
|
||||||
|
}
|
||||||
|
public AudioSource GetSource() => _pool.Get();
|
||||||
|
public void ReleaseSource(AudioSource source) => _pool.Release(source);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 370b6a43a74744ff9d90a99991b104f7
|
||||||
|
timeCreated: 1762852042
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Code.Audio
|
||||||
|
{
|
||||||
|
public enum AudioSourceType
|
||||||
|
{
|
||||||
|
Full3D,
|
||||||
|
NoBlend
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 260bbb19b55049928b9ab4d55b32fc3f
|
||||||
|
timeCreated: 1763849966
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Cysharp.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Audio;
|
||||||
|
|
||||||
|
namespace Code.Audio
|
||||||
|
{
|
||||||
|
public interface IAudioFactory
|
||||||
|
{
|
||||||
|
AudioMixer AudioMixer { get; }
|
||||||
|
Dictionary<AudioType, AudioClip> AudioTestClips { get; }
|
||||||
|
Dictionary<MusicType, List<AudioClip>> MusicDictionary { get; }
|
||||||
|
List<AudioClip> SFXAudios { get; }
|
||||||
|
List<AudioClip> EnemiesAudios { get; }
|
||||||
|
List<AudioClip> DispatcherAudios { get; }
|
||||||
|
UniTask LoadAudioSourcePrefab(Action<GameObject> callback);
|
||||||
|
UniTask WarmGameplayMusic( );
|
||||||
|
void ReleaseActionMusic();
|
||||||
|
void ReleasePeacefulMusic();
|
||||||
|
UniTask WarmAudioTestClips( );
|
||||||
|
void ReleaseAudioTestClips();
|
||||||
|
UniTask WarmMenuMusic( );
|
||||||
|
void ReleaseMenuMusic();
|
||||||
|
UniTask WarmSFX( );
|
||||||
|
void ReleaseSFX();
|
||||||
|
UniTask WarmEnemies( );
|
||||||
|
void ReleaseEnemies();
|
||||||
|
UniTask WarmDispatcher( );
|
||||||
|
void ReleaseDispatcher();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ea837e1ca08a4846b7f4ce2df771bf65
|
||||||
|
timeCreated: 1762804793
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using Cysharp.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Audio
|
||||||
|
{
|
||||||
|
public interface IAudioService
|
||||||
|
{
|
||||||
|
UniTask Initialize();
|
||||||
|
UniTaskVoid PlayRandomMusicUntilHumanityWillBeDestroyedForTheySins(MusicType musicType);
|
||||||
|
UniTaskVoid GladlyAskToStopMusic(MusicType musicType, AudioSnapshotState audioSnapshotState = AudioSnapshotState.None, float time = 1f, Action callback = null);
|
||||||
|
void StopMusic();
|
||||||
|
void GladlyAskToStopMusic(Action callback = null);
|
||||||
|
void TransitToSnapshot(AudioSnapshotState state, float time = 1f);
|
||||||
|
void PlaySFX(SFXSounds sfxId, Vector3 position);
|
||||||
|
void PlayEnemy(EnemiesSounds enemySoundId, Vector3 position);
|
||||||
|
|
||||||
|
delegate void OnAudioPlayingDelegate();
|
||||||
|
|
||||||
|
event OnAudioPlayingDelegate OnDispatcherStarted;
|
||||||
|
event OnAudioPlayingDelegate OnDispatcherEnded;
|
||||||
|
void PlayDispatcher(DispatcherSounds dispatcherSoundId);
|
||||||
|
void ChangeSetting(AudioType type, float value);
|
||||||
|
float GetSetting(AudioType type);
|
||||||
|
void PlayTestClip(AudioType audioType);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 30521fadcce84848ae88363e915bceb4
|
||||||
|
timeCreated: 1762804728
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
namespace Code.Audio
|
||||||
|
{
|
||||||
|
public enum MusicType
|
||||||
|
{
|
||||||
|
Menu,
|
||||||
|
Peaceful,
|
||||||
|
Action
|
||||||
|
}
|
||||||
|
public enum AudioType
|
||||||
|
{
|
||||||
|
Master,
|
||||||
|
MenuMusic,
|
||||||
|
GameplayMusic,
|
||||||
|
Creatures,
|
||||||
|
DispatcherSounds,
|
||||||
|
SFX
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 74ff08d5f1b741f69e37fc06fb07ae8d
|
||||||
|
timeCreated: 1763151897
|
||||||
@@ -2,7 +2,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Code.Configs
|
namespace Code.Configs
|
||||||
{
|
{
|
||||||
[CreateAssetMenu(menuName = "Config/AppConfig", fileName = "AppConfig")]
|
[CreateAssetMenu(menuName = "Config/App", fileName = "AppConfig")]
|
||||||
public class AppConfig : ScriptableObject
|
public class AppConfig : ScriptableObject
|
||||||
{
|
{
|
||||||
public GameObject infrastructureUnitPrefab;
|
public GameObject infrastructureUnitPrefab;
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
using UnityEngine.Audio;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(menuName = "Config/Audio/Mixer", fileName = "AudioMixerConfig")]
|
||||||
|
public class AudioMixerConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public AudioMixer audioMixerAsset;
|
||||||
|
public AssetReference audioSourcePrefab;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 353cee8946ca43efbbcda905d7b32ae1
|
||||||
|
timeCreated: 1762624627
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Code.Audio;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(fileName = "AudioSourceSettingsConfig", menuName = "Audio/AudioSourceSettingsConfig")]
|
||||||
|
public class AudioSourceSettingsConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
// Дополнять по мере необходимости
|
||||||
|
public float spatialBlend;
|
||||||
|
|
||||||
|
public AudioSourceType sourceType;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e6406ab390b74d5ca336d7d4d0e1a732
|
||||||
|
timeCreated: 1763850008
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(menuName = "Config/Audio/AudioTestClips", fileName = "AudioTestClipsConfig")]
|
||||||
|
public class AudioTestClipsConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public AssetReference[] audioTestClips;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f2f1c08a20a54a708336caf8ca6499e1
|
||||||
|
timeCreated: 1764263243
|
||||||
+8
-4
@@ -1,10 +1,10 @@
|
|||||||
using Code.Gameplay.Character.Core;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
|
||||||
namespace Code.Configs
|
namespace Code.Configs
|
||||||
{
|
{
|
||||||
[CreateAssetMenu(fileName = "CharacterCameraConfig", menuName = "Config/CharacterCameraConfig")]
|
[CreateAssetMenu(fileName = "CameraConfig", menuName = "Config/CameraConfig")]
|
||||||
public class CharacterCameraConfig : ScriptableObject
|
public class CameraConfig : ScriptableObject
|
||||||
{
|
{
|
||||||
public float
|
public float
|
||||||
// Расстояния от персонажа до камеры
|
// Расстояния от персонажа до камеры
|
||||||
@@ -29,6 +29,10 @@ namespace Code.Configs
|
|||||||
maxVerticalAngle = 70f, // Максимальный угол наклона камеры (вверх)
|
maxVerticalAngle = 70f, // Максимальный угол наклона камеры (вверх)
|
||||||
defaultVerticalAngle = 10f; // Стандартный угол наклона камеры
|
defaultVerticalAngle = 10f; // Стандартный угол наклона камеры
|
||||||
|
|
||||||
public CameraMode defaultCameraMode = CameraMode.MainMenu; // Текущий режим камеры
|
// Позиция следования по умолчанию
|
||||||
|
public Vector3 defaultFollowPosition = Vector3.zero;
|
||||||
|
|
||||||
|
// Префаб камеры
|
||||||
|
public Camera cameraPrefab;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File renamed without changes.
@@ -0,0 +1,14 @@
|
|||||||
|
using Code.Gameplay.Camera;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(fileName = "CameraSettingsConfig", menuName = "Config/CameraSettingsConfig")]
|
||||||
|
public class CameraSettingsConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
// Дополнять по мере необходимости
|
||||||
|
public float fov;
|
||||||
|
|
||||||
|
public CameraMode cameraMode;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6610b94e9823401c94533e1756a97195
|
||||||
|
timeCreated: 1763846744
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(fileName = "CharacterConfig", menuName = "Config/CharacterConfig")]
|
||||||
|
public class CharacterConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
// Основное движение по земле
|
||||||
|
public float
|
||||||
|
maxStableMoveSpeed = 8f, // Максимальная скорость движения по устойчивой поверхности
|
||||||
|
stableMovementSharpness = 15f, // Резкость изменения скорости движения (чем выше - тем резче)
|
||||||
|
orientationSharpness = 10f, // Резкость изменения вращения персонажа (чем выше - тем резче)
|
||||||
|
jumpSpeed = 10f; // Скорость прыжка
|
||||||
|
|
||||||
|
// Спринт
|
||||||
|
public float
|
||||||
|
sprintMoveSpeed = 12f, // Максимальная скорость спринта
|
||||||
|
sprintAngleThreshold = 90f; // Максимальный угол (в градусах) от направления вперёд, при котором разрешён спринт
|
||||||
|
|
||||||
|
// Слайд
|
||||||
|
public float
|
||||||
|
slideSpeed = 20f, // Скорость слайда
|
||||||
|
slideDuration = 0.8f, // Длительность слайда в секундах
|
||||||
|
slideCooldown = 1.5f; // Время перезарядки слайда в секундах
|
||||||
|
|
||||||
|
// Залазание на стены
|
||||||
|
public float
|
||||||
|
wallClimbSpeedFactor = 0.8f, // Коэффициент преобразования горизонтальной скорости в вертикальную при залазании на стену
|
||||||
|
minWallClimbSpeed = 9f, // Минимальная горизонтальная скорость для начала залазания на стену
|
||||||
|
wallDetectionAngleThreshold = 80f; // Максимальный угол (в градусах) от вертикали, при котором поверхность считается "стеной"
|
||||||
|
|
||||||
|
// Наклон при залазании на стены
|
||||||
|
public float
|
||||||
|
maxWallLeanAngle = 45f, // Максимальный угол наклона от стены (в градусах)
|
||||||
|
wallLeanSharpness = 50f, // Скорость наклона/выпрямления (чем выше — тем резче)
|
||||||
|
wallLeanHeightScale = 0.1f; // Множитель: на сколько метров подъёма = 1 единица "наклона"
|
||||||
|
|
||||||
|
// Гравитация
|
||||||
|
public Vector3 gravity = new(0f, -30f, 0f); // Вектор, отвечающий за применение гравитации
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 10cfaf8e57f64eddb8c2eda147e4739a
|
||||||
|
timeCreated: 1761723608
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(menuName = "Config/Audio/CharacterSoundList", fileName = "CharacterSoundListConfig")]
|
||||||
|
public class CharacterSoundListConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public AssetReference[] character;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 83304a98bbdc4e7c9c7c643653ae1368
|
||||||
|
timeCreated: 1762625438
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(menuName = "Config/Enemies/Cockroach", fileName = "CockroachConfig")]
|
||||||
|
public class CockroachConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public AssetReference cockroachPrefab;
|
||||||
|
|
||||||
|
public int damage = 2;
|
||||||
|
public float attackCooldown = 1.5f;
|
||||||
|
|
||||||
|
public float detectionRange = 20f;
|
||||||
|
public float attackRange = 1.3f;
|
||||||
|
|
||||||
|
public float speed = 6f;
|
||||||
|
|
||||||
|
public bool isStunnable;
|
||||||
|
public float stunDuration;
|
||||||
|
|
||||||
|
public bool usesIdleMovement = true;
|
||||||
|
public float idleWanderRadius = 3f;
|
||||||
|
public float idleMoveDurationMin = 0.3f;
|
||||||
|
public float idleMoveDurationMax = 1f;
|
||||||
|
public float idlePauseDurationMin = 0.1f;
|
||||||
|
public float idlePauseDurationMax = 0.8f;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7bc162d3127949aa950d0738beee99a4
|
||||||
|
timeCreated: 1763571220
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(menuName = "Config/Audio/DispatcherSoundList", fileName = "DispatcherSoundListConfig")]
|
||||||
|
public class DispatcherSoundListConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public AssetReference[] dispatcher;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8a6f6ffb8f5242899791719801791945
|
||||||
|
timeCreated: 1762625431
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(menuName = "Config/Enemies/DrunkenGrandpa", fileName = "DrunkenGrandpaConfig")]
|
||||||
|
public class DrunkenGrandpaConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public AssetReference drunkenGrandpaPrefab;
|
||||||
|
|
||||||
|
public int damage = 2;
|
||||||
|
public float attackCooldown = 5f;
|
||||||
|
|
||||||
|
public float detectionRange = 10f;
|
||||||
|
public float attackRange = 1.5f;
|
||||||
|
|
||||||
|
public float speed = 3f;
|
||||||
|
|
||||||
|
public bool isStunnable = true;
|
||||||
|
public float stunDuration = 3f;
|
||||||
|
|
||||||
|
public bool usesIdleMovement = true;
|
||||||
|
public float idleWanderRadius = 5f;
|
||||||
|
public float idleMoveDurationMin = 1f;
|
||||||
|
public float idleMoveDurationMax = 5f;
|
||||||
|
public float idlePauseDurationMin = 3f;
|
||||||
|
public float idlePauseDurationMax = 5f;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4d157e8891074b90957a7434cff0ae71
|
||||||
|
timeCreated: 1763569096
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(menuName = "Config/Audio/EnemiesSoundList", fileName = "EnemiesSoundListConfig")]
|
||||||
|
public class EnemiesSoundListConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public AssetReference[] enemies;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e73ac7f7e3cd4db8ada95f63d73c2d1d
|
||||||
|
timeCreated: 1762625425
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(menuName = "Config/Enemies/Fog", fileName = "FogConfig")]
|
||||||
|
public class FogConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public AssetReference fogPrefab;
|
||||||
|
|
||||||
|
public int damage = int.MaxValue;
|
||||||
|
public float attackCooldown;
|
||||||
|
|
||||||
|
public float detectionRange;
|
||||||
|
public float attackRange = 5f;
|
||||||
|
|
||||||
|
public float speed = 1.5f;
|
||||||
|
|
||||||
|
public bool isStunnable;
|
||||||
|
public float stunDuration;
|
||||||
|
|
||||||
|
public bool usesIdleMovement;
|
||||||
|
public float idleWanderRadius;
|
||||||
|
public float idleMoveDurationMin;
|
||||||
|
public float idleMoveDurationMax;
|
||||||
|
public float idlePauseDurationMin;
|
||||||
|
public float idlePauseDurationMax;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: aa4dd2a5cce24902a2918488b5751f2f
|
||||||
|
timeCreated: 1763581410
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(menuName = "Config/Gameplay/OrderBox", fileName = "OrderBoxConfig")]
|
||||||
|
public class OrderBoxConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public float activationTime;
|
||||||
|
public AnimationCurve floatingCurve;
|
||||||
|
public float curveLength;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6af4f53d425a41c78ef889fd7e5c3197
|
||||||
|
timeCreated: 1763735968
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(fileName = "OrderServiceConfig", menuName = "Config/Gameplay/OrderServiceConfig")]
|
||||||
|
public class OrderServiceConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public Vector2 timeBounds;
|
||||||
|
public float koefRooms, koefOvertime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ee2550c3e4874575ac3aecadfcc42475
|
||||||
|
timeCreated: 1763559999
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(menuName = "Config/Player", fileName = "PlayerConfig")]
|
||||||
|
public class PlayerConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public int maxHealth;
|
||||||
|
|
||||||
|
public AssetReference characterPrefab;
|
||||||
|
public AssetReference armsMeshPrefab;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 425c2ad28dbe4552acd1564f64372558
|
||||||
|
timeCreated: 1761591274
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(menuName = "Config/Audio/SFXList", fileName = "SFXListConfig")]
|
||||||
|
public class SFXListConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public AssetReference[] SFX;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: be49de18297645009c1e2092f382a670
|
||||||
|
timeCreated: 1762625417
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(menuName = "Config/Audio/SoundtrackList", fileName = "SoundtrackListConfig")]
|
||||||
|
public class SoundtrackListConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public AssetReference[] peacefulSoundtrack;
|
||||||
|
public AssetReference[] actionSoundtrack;
|
||||||
|
public AssetReference[] menuSoundtrack;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6d4b28e4552d456d99550b6d91467345
|
||||||
|
timeCreated: 1762624980
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(menuName = "Config/UI", fileName = "UIConfig")]
|
||||||
|
public class UIConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public AssetReference[] uiPanelsAssetReferences;
|
||||||
|
public AssetReference canvasAssetReference;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: feaa36c74e094e0aa24b3983957a6e4e
|
||||||
|
timeCreated: 1761591380
|
||||||
@@ -6,4 +6,26 @@ namespace Code.Constants
|
|||||||
public const string ConfigMultiple = "Configs/{0}";
|
public const string ConfigMultiple = "Configs/{0}";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public static class Tags
|
||||||
|
{
|
||||||
|
public const string LoadingScreen = "LoadingScreen";
|
||||||
|
}
|
||||||
|
public static class AudioGroups
|
||||||
|
{
|
||||||
|
public const string MasterGroup = "Master";
|
||||||
|
public const string SFXGroup = "SFX";
|
||||||
|
public const string CreaturesGroup = "Creatures";
|
||||||
|
public const string MusicGroup = "Music";
|
||||||
|
public const string PeacefulMusicGroup = "Peaceful";
|
||||||
|
public const string ActionMusicGroup = "Action";
|
||||||
|
public const string DispatcherMusicGroup = "Dispatcher";
|
||||||
|
public const string CourierMusicGroup = "Courier";
|
||||||
|
public const string EnemiesMusicGroup = "Enemies";
|
||||||
|
|
||||||
|
public const string PeacefulSnapshot = "Peaceful";
|
||||||
|
public const string ActionSnapshot = "Action";
|
||||||
|
public const string NoneSnapshot = "None";
|
||||||
|
public const string MenuSnapshot = "Menu";
|
||||||
|
public const string MenuMusicGroup = "Menu";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: e4901b413afd4d7da914edf2a1e51f8f
|
guid: e4901b413afd4d7da914edf2a1e51f8f
|
||||||
timeCreated: 1760627936
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0fae52abe6b44ad5bdd6e67876fe940a
|
||||||
|
timeCreated: 1761671702
|
||||||
+4
-2
@@ -1,7 +1,8 @@
|
|||||||
namespace Code.Gameplay.Character.Core
|
namespace Code.Gameplay.Camera
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Перечисление режимов работы камеры
|
* Перечисление режимов работы камеры
|
||||||
|
* MainMenu - статичная камера, смотрит на заданную позицию (то что надо в главном меню)
|
||||||
* Static - статичная камера без следования за целью
|
* Static - статичная камера без следования за целью
|
||||||
* FirstPerson - камера от первого лица (встроена в модель персонажа)
|
* FirstPerson - камера от первого лица (встроена в модель персонажа)
|
||||||
* ThirdPerson - камера от третьего лица (следует за персонажем на расстоянии)
|
* ThirdPerson - камера от третьего лица (следует за персонажем на расстоянии)
|
||||||
@@ -9,8 +10,9 @@ namespace Code.Gameplay.Character.Core
|
|||||||
*/
|
*/
|
||||||
public enum CameraMode
|
public enum CameraMode
|
||||||
{
|
{
|
||||||
MainMenu,
|
None,
|
||||||
Static,
|
Static,
|
||||||
|
MainMenu,
|
||||||
FirstPerson,
|
FirstPerson,
|
||||||
ThirdPerson,
|
ThirdPerson,
|
||||||
Cinematic
|
Cinematic
|
||||||
File renamed without changes.
@@ -0,0 +1,28 @@
|
|||||||
|
using Code.Configs;
|
||||||
|
using Code.Gameplay.Camera.CameraStates;
|
||||||
|
using Code.StateMachine;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Camera
|
||||||
|
{
|
||||||
|
public class CameraStateMachine : AbstractStateMachine<CameraMode, CameraStateMachineContext>
|
||||||
|
{
|
||||||
|
// Текущий режим работы камеры
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
States.Add(CameraMode.None, new NoneState(StateMachineContext));
|
||||||
|
States.Add(CameraMode.Static, new StaticState(StateMachineContext));
|
||||||
|
States.Add(CameraMode.MainMenu, new MainMenuState(StateMachineContext));
|
||||||
|
States.Add(CameraMode.FirstPerson, new FirstPersonState(StateMachineContext));
|
||||||
|
States.Add(CameraMode.ThirdPerson, new ThirdPersonState(StateMachineContext));
|
||||||
|
|
||||||
|
CurrentBaseState = States[CameraMode.None];
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnityEngine.Camera Camera => StateMachineContext.Camera;
|
||||||
|
|
||||||
|
protected override bool CheckTransitionAllowed(CameraMode nextState) => true;
|
||||||
|
|
||||||
|
protected override void ResetAllowedTransitions()
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b220b02510c34ea08257cc951d949fd7
|
||||||
|
timeCreated: 1761671720
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Code.Configs;
|
||||||
|
using Code.Input;
|
||||||
|
using Reflex.Attributes;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Camera
|
||||||
|
{
|
||||||
|
public class CameraStateMachineContext
|
||||||
|
{
|
||||||
|
[Inject] public UnityEngine.Camera Camera;
|
||||||
|
[Inject] public CameraConfig Config;
|
||||||
|
[Inject] public IInputService InputService;
|
||||||
|
[Inject] public Dictionary<CameraMode,CameraSettingsConfig> CameraSettingsConfigs;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4f18a74bdb8947bebec56115659e5af3
|
||||||
|
timeCreated: 1761671752
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d7399e433dff42a185f62d79b546b059
|
||||||
|
timeCreated: 1761671908
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
using Code.Configs;
|
||||||
|
using Code.Input;
|
||||||
|
using Code.StateMachine;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Camera.CameraStates
|
||||||
|
{
|
||||||
|
public abstract class BaseCameraState : BaseState<CameraStateMachineContext>
|
||||||
|
{
|
||||||
|
// DI сервиса ввода
|
||||||
|
private readonly IInputService _inputService;
|
||||||
|
|
||||||
|
// Конфиг камеры
|
||||||
|
private readonly CameraConfig _config;
|
||||||
|
|
||||||
|
// Используемая камера
|
||||||
|
protected UnityEngine.Camera Camera { get; private set; }
|
||||||
|
|
||||||
|
// Трансформ объекта, за которым следует камера
|
||||||
|
protected Transform FollowTransform;
|
||||||
|
|
||||||
|
// Позиция следования: текущая сглаженная позиция и горизонтальное направление камеры
|
||||||
|
protected Vector3 CurrentFollowPosition;
|
||||||
|
|
||||||
|
// Fallback-позиция для режимов без цели
|
||||||
|
private Vector3 _defaultFollowPosition;
|
||||||
|
|
||||||
|
// Целевой вертикальный угол камеры (наклон вверх/вниз)
|
||||||
|
private float _targetVerticalAngle;
|
||||||
|
|
||||||
|
// Текущая и целевая дистанция камеры от цели
|
||||||
|
protected float CurrentDistance, TargetDistance;
|
||||||
|
|
||||||
|
// Исходные значения дистанции для восстановления
|
||||||
|
protected float OriginalDefaultDistance, OriginalMinDistance, OriginalMaxDistance;
|
||||||
|
|
||||||
|
// Горизонтальное направление камеры (проекция forward на плоскость)
|
||||||
|
private Vector3 PlanarDirection { get; set; }
|
||||||
|
|
||||||
|
// Параметры загружаются из CameraConfig
|
||||||
|
protected float
|
||||||
|
DefaultDistance,
|
||||||
|
MinDistance,
|
||||||
|
MaxDistance,
|
||||||
|
DistanceMovementSpeed,
|
||||||
|
RotationSpeed,
|
||||||
|
RotationSharpness,
|
||||||
|
FollowSharpness,
|
||||||
|
MinVerticalAngle,
|
||||||
|
MaxVerticalAngle,
|
||||||
|
DefaultVerticalAngle;
|
||||||
|
|
||||||
|
// Свойства для доступа к важным данным камеры извне
|
||||||
|
public Vector3 GetPlanarDirection() => PlanarDirection; // Горизонтальное направление камеры
|
||||||
|
public Quaternion GetCameraRotation() => Camera.transform.rotation; // Текущее вращение камеры
|
||||||
|
|
||||||
|
// Конструктор базового состояния
|
||||||
|
protected BaseCameraState(CameraStateMachineContext context) : base(context)
|
||||||
|
{
|
||||||
|
_inputService = context.InputService;
|
||||||
|
_config = context.Config;
|
||||||
|
LoadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Загрузка конфига для камеры
|
||||||
|
private void LoadConfig()
|
||||||
|
{
|
||||||
|
// Загрузка значений из конфигов
|
||||||
|
DefaultDistance = _config.defaultDistance;
|
||||||
|
MinDistance = _config.minDistance;
|
||||||
|
MaxDistance = _config.maxDistance;
|
||||||
|
DistanceMovementSpeed = _config.distanceMovementSpeed;
|
||||||
|
RotationSpeed = _config.rotationSpeed;
|
||||||
|
RotationSharpness = _config.rotationSharpness;
|
||||||
|
FollowSharpness = _config.followSharpness;
|
||||||
|
MinVerticalAngle = _config.minVerticalAngle;
|
||||||
|
MaxVerticalAngle = _config.maxVerticalAngle;
|
||||||
|
DefaultVerticalAngle = _config.defaultVerticalAngle;
|
||||||
|
_defaultFollowPosition = _config.defaultFollowPosition;
|
||||||
|
|
||||||
|
// Обеспечиваем корректные значения дистанции и угла
|
||||||
|
DefaultDistance = Mathf.Clamp(DefaultDistance, MinDistance, MaxDistance);
|
||||||
|
DefaultVerticalAngle = Mathf.Clamp(DefaultVerticalAngle, MinVerticalAngle, MaxVerticalAngle);
|
||||||
|
|
||||||
|
// Сохраняем оригинальные значения для восстановления
|
||||||
|
OriginalDefaultDistance = DefaultDistance;
|
||||||
|
OriginalMinDistance = MinDistance;
|
||||||
|
OriginalMaxDistance = MaxDistance;
|
||||||
|
|
||||||
|
CurrentDistance = DefaultDistance;
|
||||||
|
TargetDistance = CurrentDistance;
|
||||||
|
_targetVerticalAngle = DefaultVerticalAngle;
|
||||||
|
PlanarDirection = Vector3.forward; // Начальное направление - вперед по оси Z
|
||||||
|
CurrentFollowPosition = _defaultFollowPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Переход в состояние
|
||||||
|
public override void EnterState()
|
||||||
|
{
|
||||||
|
Camera = Context.Camera;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void LateTick()
|
||||||
|
{
|
||||||
|
// Обновляем камеру только если есть цель для следования
|
||||||
|
if (FollowTransform)
|
||||||
|
{
|
||||||
|
UpdateWithInput(Time.deltaTime, _inputService.ZoomInput, _inputService.LookInput);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Абстрактные методы для специфики режима
|
||||||
|
protected abstract void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation);
|
||||||
|
|
||||||
|
// Обработка вращения камеры на основе пользовательского ввода
|
||||||
|
// Теперь виртуальный, чтобы статический режим мог работать как хочет
|
||||||
|
protected virtual void HandleRotationInput(float deltaTime, Vector3 rotationInput, out Quaternion targetRotation)
|
||||||
|
{
|
||||||
|
// Вращение вокруг вертикальной оси (горизонтальный поворот)
|
||||||
|
var rotationFromInput = Quaternion.Euler(Vector3.up * (rotationInput.x * RotationSpeed));
|
||||||
|
PlanarDirection = rotationFromInput * PlanarDirection;
|
||||||
|
var planarRotation = Quaternion.LookRotation(PlanarDirection, FollowTransform.up);
|
||||||
|
|
||||||
|
// Вращение вокруг горизонтальной оси (вертикальный наклон)
|
||||||
|
_targetVerticalAngle -= rotationInput.y * RotationSpeed;
|
||||||
|
_targetVerticalAngle = Mathf.Clamp(_targetVerticalAngle, MinVerticalAngle, MaxVerticalAngle);
|
||||||
|
var verticalRotation = Quaternion.Euler(_targetVerticalAngle, 0, 0);
|
||||||
|
|
||||||
|
// Интерполяция к целевому вращению для плавности
|
||||||
|
targetRotation = Quaternion.Slerp(Camera.transform.rotation, planarRotation * verticalRotation, deltaTime * RotationSharpness);
|
||||||
|
|
||||||
|
// Применение финального вращения
|
||||||
|
Camera.transform.rotation = targetRotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Основной метод обновления камеры, вызываемый извне каждый кадр
|
||||||
|
private void UpdateWithInput(float deltaTime, float zoomInput, Vector3 rotationInput)
|
||||||
|
{
|
||||||
|
// Обработка ввода и позиционирования
|
||||||
|
HandleRotationInput(deltaTime, rotationInput, out var targetRotation);
|
||||||
|
HandlePosition(deltaTime, zoomInput, targetRotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Установка цели для следования камеры
|
||||||
|
public void SetFollowTransform(Transform t)
|
||||||
|
{
|
||||||
|
FollowTransform = t;
|
||||||
|
CurrentFollowPosition = t ? t.position : _defaultFollowPosition;
|
||||||
|
if (t) PlanarDirection = t.forward; // Начальное направление совпадает с направлением цели
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 92ff312b40a647b392af24877e699bd5
|
||||||
|
timeCreated: 1761685916
|
||||||
Loaded 100 of 1000 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user