Compare commits
135
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c41d7f2d99 | ||
|
|
52b0a8a6e5 | ||
|
|
e66cb2b8f6 | ||
|
|
d97be67d94 | ||
|
|
cd236a3ba8 | ||
|
|
2d660252d6 | ||
|
|
f224ed36c5 | ||
|
|
d737797f11 | ||
|
|
185b955125 | ||
|
|
dd492b8e77 | ||
|
|
9d0dda506a | ||
|
|
edff0ce0d4 | ||
|
|
d29053d408 | ||
|
|
a82cb3ce7d | ||
|
|
00f99f05ab | ||
|
|
349ac8a771 | ||
|
|
1a30853147 | ||
|
|
a3e847b63f | ||
|
|
616696e366 | ||
|
|
e055f99caf | ||
|
|
2bac10c113 | ||
|
|
f6b892449a | ||
|
|
99f17852f4 | ||
|
|
7bec2545ba | ||
|
|
7868911929 | ||
|
|
6f777ba8a3 | ||
|
|
bffbf2db3b | ||
|
|
fbe22108e6 | ||
|
|
a997a0682f | ||
|
|
072d785345 | ||
|
|
047ea36ab9 | ||
|
|
d7cca83268 | ||
|
|
5fc70e1db6 | ||
|
|
f67d3972a9 | ||
|
|
bea394d022 | ||
|
|
2c6877cb3f | ||
|
|
019e3a053e | ||
|
|
727e9a3c17 | ||
|
|
48e11dd3b0 | ||
|
|
4b98ec0129 | ||
|
|
304bfc6e1f | ||
|
|
db6eb219c8 | ||
|
|
d2c5c45604 | ||
|
|
0fca1a32f9 | ||
|
|
9103cb0a5a | ||
|
|
4770499d97 | ||
|
|
f6e8131d22 | ||
|
|
7e1f7cecc2 | ||
|
|
6732aef384 | ||
|
|
ecff1e69cd | ||
|
|
eb4dff803e | ||
|
|
fea9d3586f | ||
|
|
79593877a7 | ||
|
|
a5ce6e3165 | ||
|
|
d9a1271262 | ||
|
|
4c16a63abd | ||
|
|
b4de41894f | ||
|
|
77fd9af29d | ||
|
|
a1c2c5fd18 | ||
|
|
485d54f272 | ||
|
|
0d0787b887 | ||
|
|
5d856ae162 | ||
|
|
dd1399e015 | ||
|
|
2b656412d5 | ||
|
|
36e6bc3bc2 | ||
|
|
1e31e1e8b1 | ||
|
|
2897eb88bf | ||
|
|
134adda787 | ||
|
|
2f56a5758d | ||
|
|
fb9510a6b2 | ||
|
|
aa4a9e69dd | ||
|
|
34d7fa3791 | ||
|
|
26804e08f7 | ||
|
|
e96dcf3e0d | ||
|
|
94f0522f89 | ||
|
|
eefcf6eabc | ||
|
|
c85638fda0 | ||
|
|
1de117622e | ||
|
|
e2f8984e6f | ||
|
|
32c6e0630a | ||
|
|
870a4743c6 | ||
|
|
2fc8e249f5 | ||
|
|
280eb3754c | ||
|
|
6eff3ef9a9 | ||
|
|
6b4792393a | ||
|
|
a547c39db7 | ||
|
|
0cab2eda74 | ||
|
|
5d075034b5 | ||
|
|
7f7ba0d9c5 | ||
|
|
ab0b41a318 | ||
|
|
a5ce8522ab | ||
|
|
97aea0fde1 | ||
|
|
e9e8e091b2 | ||
|
|
9e1c1177e0 | ||
|
|
07535982ba | ||
|
|
df0c2b3157 | ||
|
|
d51527b7f3 | ||
|
|
13aca5a86f | ||
|
|
9cc77d5c67 | ||
|
|
c1a0e94fe3 | ||
|
|
acd9cc1a32 | ||
|
|
d14f9c2a9f | ||
|
|
4b6909fe84 | ||
|
|
766609489d | ||
|
|
b7e9a26462 | ||
|
|
3782a0b568 | ||
|
|
000985ee9b | ||
|
|
abde1d5ba9 | ||
|
|
52b18967a1 | ||
|
|
d10d2cdca6 | ||
|
|
79d03528f6 | ||
|
|
01d3b0adec | ||
|
|
b271042137 | ||
|
|
4a547f1348 | ||
|
|
7130513471 | ||
|
|
ee7cf3946f | ||
|
|
175567e4dd | ||
|
|
97c60c0925 | ||
|
|
bd495a644f | ||
|
|
cea36c0cda | ||
|
|
ff8ed96138 | ||
|
|
95cb51db79 | ||
|
|
2b9fd70c85 | ||
|
|
cd384239ff | ||
|
|
f3a83eb909 | ||
|
|
35f703a8d2 | ||
|
|
e5f4f292c2 | ||
|
|
efad72b4d9 | ||
|
|
855108d88b | ||
|
|
388773129d | ||
|
|
01505de4c3 | ||
|
|
52edef92e3 | ||
|
|
c6b097a879 | ||
|
|
a243ad53d6 | ||
|
|
85a07065d9 |
No files matched your search
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"components": [
|
||||
"Microsoft.VisualStudio.Workload.ManagedGame"
|
||||
]
|
||||
}
|
||||
@@ -13,5 +13,8 @@ MonoBehaviour:
|
||||
m_Name: AddressableAssetGroupSortSettings
|
||||
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.GroupSchemas.AddressableAssetGroupSortSettings
|
||||
sortOrder:
|
||||
- 3f67261f611d8cd43a09d4d5cf638d8d
|
||||
- 1e9bc7e1e4087c0488fccf896b0ed49f
|
||||
- d7e4a8c4f2a42c64587c34ab7446f091
|
||||
- 7e9d70e73e500eb9287683466ebf646f
|
||||
- d447fc60305c17a17bf20948ab295a45
|
||||
@@ -15,7 +15,7 @@ MonoBehaviour:
|
||||
m_DefaultGroup: d447fc60305c17a17bf20948ab295a45
|
||||
m_currentHash:
|
||||
serializedVersion: 2
|
||||
Hash: adba03da8c5086ecbcf5b8db72996dd1
|
||||
Hash: 930ada413b95e006f8d8a8635b833074
|
||||
m_OptimizeCatalogSize: 0
|
||||
m_BuildRemoteCatalog: 0
|
||||
m_CatalogRequestsTimeout: 0
|
||||
@@ -60,8 +60,11 @@ MonoBehaviour:
|
||||
m_BuildAddressablesWithPlayerBuild: 0
|
||||
m_overridePlayerVersion: '[UnityEditor.PlayerSettings.bundleVersion]'
|
||||
m_GroupAssets:
|
||||
- {fileID: 11400000, guid: df8f8d52915542e49a11fbc177f3cf2c, type: 2}
|
||||
- {fileID: 11400000, guid: 3eb9af1699b33ee4fa3ddeb0a1a9f793, type: 2}
|
||||
- {fileID: 11400000, guid: ba51c0b85beab267d8f41a72df4fb657, type: 2}
|
||||
- {fileID: 11400000, guid: 7c592a6445170e8379910601b962cb30, type: 2}
|
||||
- {fileID: 11400000, guid: 6334e9a905fd7634a8c646d57a23968d, type: 2}
|
||||
m_BuildSettings:
|
||||
m_LogResourceManagerExceptions: 1
|
||||
m_BundleBuildPath: Temp/com.unity.addressables/AssetBundles
|
||||
|
||||
@@ -14,8 +14,119 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.AddressableAssetGroup
|
||||
m_GroupName: Audio
|
||||
m_GUID: 7e9d70e73e500eb9287683466ebf646f
|
||||
m_SerializeEntries: []
|
||||
m_SerializeEntries:
|
||||
- m_GUID: 087d498be2e5a044f97f313a3fc0ae05
|
||||
m_Address: Assets/Resources_moved/Audio/Enemies/ded_step.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 144ab5188f8ad7a0a92c75703bd12e60
|
||||
m_Address: launch_upmenu1
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 1f79c7b1e492a4ea2a8d666cdead0c52
|
||||
m_Address: Assets/Resources_moved/Audio/Dispatcher/take_damage4.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 21c2eaf85c31d604395153b364970a7d
|
||||
m_Address: Assets/Resources_moved/Audio/SFX/pl_plain2.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 29bff8011973e4e519906b9da8fca0fc
|
||||
m_Address: Assets/Resources_moved/Audio/Dispatcher/late3.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 29ee630aab7bbef8799dc76ed0c239f7
|
||||
m_Address: Assets/Resources_moved/Audio/Dispatcher/late4.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 2ef564b38a3c6fb4a85c16adb33d095c
|
||||
m_Address: Assets/Resources_moved/Audio/Enemies/rch_walk.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 31f16c866d3224ab8a7e0fabf3745ec5
|
||||
m_Address: Assets/Resources_moved/Audio/Dispatcher/late5.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 4bd64d1fcecc9c6b09d81e78b7dcfebe
|
||||
m_Address: Assets/Resources_moved/Audio/Dispatcher/take_damage1.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 4c9661de6f76e8c48a0116840b1ac7fd
|
||||
m_Address: Assets/Resources_moved/Audio/UI/launch_upmenu1 1.wav
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 735f38402ea347fa381408293503a24e
|
||||
m_Address: Assets/Resources_moved/Audio/Dispatcher/receiving_an_order1.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 7accc805b4e5f404d9e777c0a662ede4
|
||||
m_Address: Assets/Resources_moved/Audio/UI/launch_upmenu1 2.wav
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 7c5caf3ceee44f71588860c5c1fbdbe0
|
||||
m_Address: Assets/Resources_moved/Audio/Dispatcher/take_damage3.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 8c2be26d359d54063825fedfad7a493b
|
||||
m_Address: Assets/Resources_moved/Audio/Dispatcher/late2.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 8fa89a492fc3a3768a0f0ba1bb7080e0
|
||||
m_Address: Assets/Resources_moved/Audio/Dispatcher/late1.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: a306df57f348ce7cf900d0b9431739ee
|
||||
m_Address: launch_selectmenu
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: aa138b2e21adfbf4bbbfa5bf9d54b8f2
|
||||
m_Address: Assets/Resources_moved/Audio/UI/buttonclickrelease.wav
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: beea6ce1de81706478a700993b273000
|
||||
m_Address: Assets/Resources_moved/Audio/Enemies/bc_bite2.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: cab4b1ff78dd6b1fba61aa165aa17b4d
|
||||
m_Address: Assets/Resources_moved/Audio/Dispatcher/receiving_an_order2.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: e54541120fe1c5a4799a4698a689bb5c
|
||||
m_Address: Assets/Resources_moved/Audio/SFX/pl_step1.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: f74a409bf11b25148ad305acc05b14f5
|
||||
m_Address: Assets/Resources_moved/Audio/Dispatcher/take_damage2.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: fb8972b33f4c43749add9d98b439b447
|
||||
m_Address: Assets/Resources_moved/Audio/SFX/pl_plain5.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
m_ReadOnly: 0
|
||||
m_Settings: {fileID: 11400000, guid: 2588e84eb64800d0781c574a37fa48d8, type: 2}
|
||||
m_SchemaSet:
|
||||
m_Schemas: []
|
||||
m_Schemas:
|
||||
- {fileID: 11400000, guid: 5a1eefed8456ba0479d7c04e6a5f4122, type: 2}
|
||||
+25
-116
@@ -15,93 +15,43 @@ MonoBehaviour:
|
||||
m_GroupName: Default Local Group
|
||||
m_GUID: d447fc60305c17a17bf20948ab295a45
|
||||
m_SerializeEntries:
|
||||
- m_GUID: 03e51c504fa7e0624ba855ec35b60bcc
|
||||
m_Address: absolutely
|
||||
- m_GUID: 17d698710813e8641b32abec11387c5a
|
||||
m_Address: Prefabs/Levels/Level6
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 111011400ce13ae859c52c757aef859e
|
||||
m_Address: ahfreeman
|
||||
- m_GUID: 1d4767c722c05b5d6b96bb226d378c65
|
||||
m_Address: Assets/Resources_moved/Prefabs/Player/ArmsMesh.prefab
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 144ab5188f8ad7a0a92c75703bd12e60
|
||||
m_Address: launch_upmenu1
|
||||
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: 2301400160a23924eb27c4bdbe797739
|
||||
m_Address: 'Audio/Music/Nightmargin (Oneshot OST) - The Prophecy '
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 23e11d2c8a4f12f4ea9a7a43d1118464
|
||||
m_Address: Gameplay
|
||||
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_GUID: 24959d51467fd0d4f957ed6e846f73a5
|
||||
m_Address: Assets/Resources_moved/Audio/Enemies/ded_attack1.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 2ed2d93a9f39d4edba511cb7396c7bb6
|
||||
m_Address: Prefabs/Enemies/Cockroach
|
||||
m_Address: Assets/Resources_moved/Prefabs/Enemies/Cockroach.prefab
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 2f6134357dc2a5641a846a7478ce4c2c
|
||||
m_Address: bravo!
|
||||
- m_GUID: 37a29c1efe8bfff4c82f1bb435e8a4df
|
||||
m_Address: Prefabs/Levels/Level2
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 31f16c866d3224ab8a7e0fabf3745ec5
|
||||
m_Address: Audio/Dispatcher/late5
|
||||
- m_GUID: 38e345d8030c71943ac60b74d9114a54
|
||||
m_Address: Prefabs/Levels/Level5
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 3831a36e0c8e48f659517a6bb99378b6
|
||||
m_Address: cbar_hit1
|
||||
- m_GUID: 67a7498e77a75a640af19501dd6f2d70
|
||||
m_Address: Prefabs/Levels/Level1
|
||||
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: 735f38402ea347fa381408293503a24e
|
||||
m_Address: Audio/Dispatcher/receiving_an_order1
|
||||
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_GUID: 77d78f571ad0a008c81c4f1ee75168cf
|
||||
m_Address: Assets/Resources_moved/Audio/Music/death.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
@@ -110,18 +60,8 @@ MonoBehaviour:
|
||||
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_GUID: 86abe613c186eff408e836a701f6f7e1
|
||||
m_Address: Prefabs/Levels/Level3
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
@@ -130,58 +70,28 @@ MonoBehaviour:
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: a306df57f348ce7cf900d0b9431739ee
|
||||
m_Address: launch_selectmenu
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: b2c9f83c47783069aabb564f68cb0cbb
|
||||
m_Address: absolutelynot
|
||||
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: Prefabs/Enemies/DrunkenGrandpa
|
||||
m_Address: Assets/Resources_moved/Prefabs/Enemies/DrunkenGrandpa.prefab
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: c566fc932edefbbee9e53271eac3c560
|
||||
m_Address: MainMenu
|
||||
- m_GUID: c0fab6d79b220b34db7f2cd81acef171
|
||||
m_Address: Prefabs/Levels/Save2
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: cab4b1ff78dd6b1fba61aa165aa17b4d
|
||||
m_Address: Audio/Dispatcher/receiving_an_order2
|
||||
- m_GUID: c1781548816d15d4e85f4bcb2f7dcf3e
|
||||
m_Address: Prefabs/Levels/Level4
|
||||
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_GUID: c805f5be6ffa99d41bd31f3ae17ba66b
|
||||
m_Address: Prefabs/Levels/Level8
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: f3d7dc64b34919ad7b50a3dd307a935b
|
||||
m_Address: Prefabs/Enemies/Fog
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: f4b6fa54ecac6cc418f98824491aa17a
|
||||
m_Address: Audio/Music/SANABI - JUSTICE Is Watching You
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: f74a409bf11b25148ad305acc05b14f5
|
||||
m_Address: Audio/Dispatcher/take_damage2
|
||||
m_Address: Assets/Resources_moved/Prefabs/Enemies/Fog.prefab
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
@@ -190,4 +100,3 @@ MonoBehaviour:
|
||||
m_SchemaSet:
|
||||
m_Schemas:
|
||||
- {fileID: 11400000, guid: 75ffac7db08d9615c994048949431551, type: 2}
|
||||
- {fileID: 11400000, guid: 6d6fed27b8c8a3eebb9bc5289b7a6956, type: 2}
|
||||
@@ -0,0 +1,47 @@
|
||||
%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: Levels
|
||||
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.AddressableAssetGroup
|
||||
m_GroupName: Levels
|
||||
m_GUID: d7e4a8c4f2a42c64587c34ab7446f091
|
||||
m_SerializeEntries:
|
||||
- m_GUID: 28a6c7a4124141341ab7c2b7dfd3e95b
|
||||
m_Address: Assets/Resources_moved/Prefabs/Levels/Level1 2.prefab
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 7067a5248027e74478f4f0f53ddf06a4
|
||||
m_Address: Prefabs/Rooms/Save1
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 9d78f017876abed4c9cd8957f1e140cb
|
||||
m_Address: Prefabs/Rooms/Level1_2
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: c938de3174f184741925c407a43a47f2
|
||||
m_Address: Prefabs/Rooms/Level1
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: e3a3840a7963bf841872cddb02e90151
|
||||
m_Address: Prefabs/Levels/MainMenu 1
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
m_ReadOnly: 0
|
||||
m_Settings: {fileID: 11400000, guid: 2588e84eb64800d0781c574a37fa48d8, type: 2}
|
||||
m_SchemaSet:
|
||||
m_Schemas:
|
||||
- {fileID: 11400000, guid: 41705eee932aeb341b6921d8a793acc3, type: 2}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5160d7af825d295229a3be611f44db76
|
||||
guid: 6334e9a905fd7634a8c646d57a23968d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
@@ -0,0 +1,65 @@
|
||||
%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: Music
|
||||
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.AddressableAssetGroup
|
||||
m_GroupName: Music
|
||||
m_GUID: 1e9bc7e1e4087c0488fccf896b0ed49f
|
||||
m_SerializeEntries:
|
||||
- m_GUID: 00fdbd3ed3fad234e8ef2098495f4896
|
||||
m_Address: Assets/Resources_moved/Audio/Music/hostiles.ogg
|
||||
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: 3b741bfff0e13ec43a88a3e0fec256f1
|
||||
m_Address: Assets/Resources_moved/Audio/Music/razormind.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 803e40b883c823b89a91aa8b9d9fc483
|
||||
m_Address: valve_sound
|
||||
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: c81995afbd1412f4593771bd47358c3f
|
||||
m_Address: Assets/Resources_moved/Audio/Music/non_ai.ogg
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: ebe18293a5ef86704b23dad3a1786476
|
||||
m_Address: Half-Life01
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
m_ReadOnly: 0
|
||||
m_Settings: {fileID: 11400000, guid: 2588e84eb64800d0781c574a37fa48d8, type: 2}
|
||||
m_SchemaSet:
|
||||
m_Schemas:
|
||||
- {fileID: 11400000, guid: ad1eba3497492f54c8ca95e03d446775, type: 2}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df8f8d52915542e49a11fbc177f3cf2c
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
%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: e5d17a21594effb4e9591490b009e7aa, type: 3}
|
||||
m_Name: Audio_BundledAssetGroupSchema
|
||||
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.GroupSchemas.BundledAssetGroupSchema
|
||||
m_Group: {fileID: 11400000, guid: ba51c0b85beab267d8f41a72df4fb657, type: 2}
|
||||
m_InternalBundleIdMode: 1
|
||||
m_Compression: 1
|
||||
m_IncludeAddressInCatalog: 1
|
||||
m_IncludeGUIDInCatalog: 1
|
||||
m_IncludeLabelsInCatalog: 1
|
||||
m_InternalIdNamingMode: 0
|
||||
m_CacheClearBehavior: 0
|
||||
m_IncludeInBuild: 1
|
||||
m_BundledAssetProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider
|
||||
m_StripDownloadOptions: 0
|
||||
m_ForceUniqueProvider: 0
|
||||
m_UseAssetBundleCache: 1
|
||||
m_UseAssetBundleCrc: 1
|
||||
m_UseAssetBundleCrcForCachedBundles: 1
|
||||
m_UseUWRForLocalBundles: 0
|
||||
m_Timeout: 0
|
||||
m_ChunkedTransfer: 0
|
||||
m_RedirectLimit: -1
|
||||
m_RetryCount: 0
|
||||
m_BuildPath:
|
||||
m_Id: 3dfc1a15d30236e7a8856b2164e14280
|
||||
m_LoadPath:
|
||||
m_Id: 6c794a757c731a0319b43709731ad88b
|
||||
m_BundleMode: 0
|
||||
m_AssetBundleProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider
|
||||
m_UseDefaultSchemaSettings: 0
|
||||
m_SelectedPathPairIndex: 0
|
||||
m_BundleNaming: 0
|
||||
m_AssetLoadMode: 0
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a1eefed8456ba0479d7c04e6a5f4122
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+1
-1
@@ -2,7 +2,7 @@ fileFormatVersion: 2
|
||||
guid: 6d6fed27b8c8a3eebb9bc5289b7a6956
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
%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: e5d17a21594effb4e9591490b009e7aa, type: 3}
|
||||
m_Name: Levels_BundledAssetGroupSchema
|
||||
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.GroupSchemas.BundledAssetGroupSchema
|
||||
m_Group: {fileID: 11400000, guid: 6334e9a905fd7634a8c646d57a23968d, type: 2}
|
||||
m_InternalBundleIdMode: 1
|
||||
m_Compression: 1
|
||||
m_IncludeAddressInCatalog: 1
|
||||
m_IncludeGUIDInCatalog: 1
|
||||
m_IncludeLabelsInCatalog: 1
|
||||
m_InternalIdNamingMode: 0
|
||||
m_CacheClearBehavior: 0
|
||||
m_IncludeInBuild: 1
|
||||
m_BundledAssetProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider
|
||||
m_StripDownloadOptions: 0
|
||||
m_ForceUniqueProvider: 0
|
||||
m_UseAssetBundleCache: 1
|
||||
m_UseAssetBundleCrc: 1
|
||||
m_UseAssetBundleCrcForCachedBundles: 1
|
||||
m_UseUWRForLocalBundles: 0
|
||||
m_Timeout: 0
|
||||
m_ChunkedTransfer: 0
|
||||
m_RedirectLimit: -1
|
||||
m_RetryCount: 0
|
||||
m_BuildPath:
|
||||
m_Id: 3dfc1a15d30236e7a8856b2164e14280
|
||||
m_LoadPath:
|
||||
m_Id: 6c794a757c731a0319b43709731ad88b
|
||||
m_BundleMode: 0
|
||||
m_AssetBundleProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider
|
||||
m_UseDefaultSchemaSettings: 0
|
||||
m_SelectedPathPairIndex: 0
|
||||
m_BundleNaming: 0
|
||||
m_AssetLoadMode: 0
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 41705eee932aeb341b6921d8a793acc3
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
%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: e5d17a21594effb4e9591490b009e7aa, type: 3}
|
||||
m_Name: Music_BundledAssetGroupSchema
|
||||
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.GroupSchemas.BundledAssetGroupSchema
|
||||
m_Group: {fileID: 11400000, guid: df8f8d52915542e49a11fbc177f3cf2c, type: 2}
|
||||
m_InternalBundleIdMode: 1
|
||||
m_Compression: 1
|
||||
m_IncludeAddressInCatalog: 1
|
||||
m_IncludeGUIDInCatalog: 1
|
||||
m_IncludeLabelsInCatalog: 1
|
||||
m_InternalIdNamingMode: 0
|
||||
m_CacheClearBehavior: 0
|
||||
m_IncludeInBuild: 1
|
||||
m_BundledAssetProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider
|
||||
m_StripDownloadOptions: 0
|
||||
m_ForceUniqueProvider: 0
|
||||
m_UseAssetBundleCache: 1
|
||||
m_UseAssetBundleCrc: 1
|
||||
m_UseAssetBundleCrcForCachedBundles: 1
|
||||
m_UseUWRForLocalBundles: 0
|
||||
m_Timeout: 0
|
||||
m_ChunkedTransfer: 0
|
||||
m_RedirectLimit: -1
|
||||
m_RetryCount: 0
|
||||
m_BuildPath:
|
||||
m_Id: 3dfc1a15d30236e7a8856b2164e14280
|
||||
m_LoadPath:
|
||||
m_Id: 6c794a757c731a0319b43709731ad88b
|
||||
m_BundleMode: 0
|
||||
m_AssetBundleProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider
|
||||
m_UseDefaultSchemaSettings: 0
|
||||
m_SelectedPathPairIndex: 0
|
||||
m_BundleNaming: 0
|
||||
m_AssetLoadMode: 0
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad1eba3497492f54c8ca95e03d446775
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
%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: e5d17a21594effb4e9591490b009e7aa, type: 3}
|
||||
m_Name: UI_BundledAssetGroupSchema
|
||||
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.GroupSchemas.BundledAssetGroupSchema
|
||||
m_Group: {fileID: 11400000, guid: 3eb9af1699b33ee4fa3ddeb0a1a9f793, type: 2}
|
||||
m_InternalBundleIdMode: 1
|
||||
m_Compression: 1
|
||||
m_IncludeAddressInCatalog: 1
|
||||
m_IncludeGUIDInCatalog: 1
|
||||
m_IncludeLabelsInCatalog: 1
|
||||
m_InternalIdNamingMode: 0
|
||||
m_CacheClearBehavior: 0
|
||||
m_IncludeInBuild: 1
|
||||
m_BundledAssetProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider
|
||||
m_StripDownloadOptions: 0
|
||||
m_ForceUniqueProvider: 0
|
||||
m_UseAssetBundleCache: 1
|
||||
m_UseAssetBundleCrc: 1
|
||||
m_UseAssetBundleCrcForCachedBundles: 1
|
||||
m_UseUWRForLocalBundles: 0
|
||||
m_Timeout: 0
|
||||
m_ChunkedTransfer: 0
|
||||
m_RedirectLimit: -1
|
||||
m_RetryCount: 0
|
||||
m_BuildPath:
|
||||
m_Id: 3dfc1a15d30236e7a8856b2164e14280
|
||||
m_LoadPath:
|
||||
m_Id: 6c794a757c731a0319b43709731ad88b
|
||||
m_BundleMode: 0
|
||||
m_AssetBundleProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider
|
||||
m_UseDefaultSchemaSettings: 0
|
||||
m_SelectedPathPairIndex: 0
|
||||
m_BundleNaming: 0
|
||||
m_AssetLoadMode: 0
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b0e1794b785fb54988037373b6bb1f3
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,47 @@
|
||||
%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: UI
|
||||
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.AddressableAssetGroup
|
||||
m_GroupName: UI
|
||||
m_GUID: 3f67261f611d8cd43a09d4d5cf638d8d
|
||||
m_SerializeEntries:
|
||||
- m_GUID: 23e11d2c8a4f12f4ea9a7a43d1118464
|
||||
m_Address: Gameplay
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 48aebfe8826dc0df79d047b5afbf8f5b
|
||||
m_Address: Canvas
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: b2e8dc2aeb0311cd8a826b51cf8e94dc
|
||||
m_Address: GameOver
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: c566fc932edefbbee9e53271eac3c560
|
||||
m_Address: MainMenu
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: f23b9fce9594618e5b75845f1cae50de
|
||||
m_Address: LoadingScreen
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
m_ReadOnly: 0
|
||||
m_Settings: {fileID: 11400000, guid: 2588e84eb64800d0781c574a37fa48d8, type: 2}
|
||||
m_SchemaSet:
|
||||
m_Schemas:
|
||||
- {fileID: 11400000, guid: 5b0e1794b785fb54988037373b6bb1f3, type: 2}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3eb9af1699b33ee4fa3ddeb0a1a9f793
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa24c0d8a11438d4fb57332c144beab6
|
||||
guid: d36aab6707c518f5abfd60065165eb35
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc9a23cef60c78e46924e5d40b0c2a16
|
||||
guid: d982316b2b4c99747b9e953ae7b9b42f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -1,41 +1,85 @@
|
||||
using Code.App.StateMachine;
|
||||
using Code.Audio;
|
||||
using Code.Gameplay.Player;
|
||||
using Code.Input;
|
||||
using Code.Scenes;
|
||||
using Code.Scenes.SceneEnvironments;
|
||||
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
|
||||
{
|
||||
public class GameOverState : BaseState<AppStateMachineContext>
|
||||
{
|
||||
public GameOverState(AppStateMachineContext context) : base(context)
|
||||
{ }
|
||||
{
|
||||
}
|
||||
private IPlayerScore _playerScore;
|
||||
|
||||
private GameOverPanel _gameOverPanel;
|
||||
|
||||
private float damnTimer = 3f; // TODO Удалить при первой возможности
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
Context.UIService.SwitchPanelTo(UIPanel.GameOver);
|
||||
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);
|
||||
|
||||
Context.AudioService.PlayRandomMusicUntilHumanityWillBeDestroyedForTheySins(MusicType.Death);
|
||||
|
||||
Context.AudioService.ApplyStun(5000,0.5f);
|
||||
|
||||
GameOver().Forget();
|
||||
|
||||
base.EnterState();
|
||||
}
|
||||
|
||||
|
||||
private void TryToExit(InputAction.CallbackContext context)
|
||||
{
|
||||
ToMainMenu();
|
||||
}
|
||||
|
||||
private async UniTaskVoid GameOver()
|
||||
{
|
||||
await Context.UIService.AsyncSwitchPanelTo(UIPanel.GameOver);
|
||||
|
||||
_gameOverPanel = (GameOverPanel)Context.UIService.CurrentPanel;
|
||||
_gameOverPanel.Show();
|
||||
}
|
||||
|
||||
private void ToMainMenu()
|
||||
{
|
||||
Context.StateMachine.SwitchState(AppState.MainMenu)
|
||||
.AllowStateTransition(AppState.Gameplay);
|
||||
}
|
||||
|
||||
private float _scoreCounter;
|
||||
public override void Tick()
|
||||
{
|
||||
damnTimer -= Time.deltaTime;
|
||||
if (damnTimer <= float.Epsilon) ToMainMenu();
|
||||
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()
|
||||
{
|
||||
damnTimer = 5f;
|
||||
{
|
||||
Context.InputService.DisableMap(ActionMappings.UI);
|
||||
Context.InputService.DebugUnbindAction((int)ActionMappings.UI,(int)UIActions.Continue, TryToExit);
|
||||
|
||||
Context.UIService.LoadingScreen.Show();
|
||||
Context.AudioService.GladlyAskToStopMusic(MusicType.Death, time: 0f, callback: Context.AudioFactory.ReleaseDeathMusic);
|
||||
Context.AudioService.TransitToSnapshot(AudioSnapshotState.None);
|
||||
base.ExitState();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,33 +1,36 @@
|
||||
using Code.App.Loading;
|
||||
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.Scenes;
|
||||
using Code.Scenes.SceneEnvironments;
|
||||
using Code.StateMachine;
|
||||
using Code.UI;
|
||||
using Code.UI.Panels;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using DG.Tweening;
|
||||
using Reflex.Core;
|
||||
using Reflex.Extensions;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Code.App.AppStates
|
||||
{
|
||||
public class GameplayState : BaseState<AppStateMachineContext>
|
||||
{
|
||||
// DEBUG
|
||||
private Transform _testSFXTransform;
|
||||
// DEBUG
|
||||
|
||||
{
|
||||
private PlayerHealth _playerHealth;
|
||||
private PlayerMoney _playerMoney;
|
||||
private IPlayerScore _playerScore;
|
||||
|
||||
private IOrderService _orderService;
|
||||
|
||||
private CharacterProvider _playerCharacter;
|
||||
|
||||
public GameplayState(AppStateMachineContext context) : base(context)
|
||||
{
|
||||
}
|
||||
@@ -35,100 +38,155 @@ namespace Code.App.AppStates
|
||||
public override void EnterState()
|
||||
{
|
||||
Context.UIService.LoadingScreen.Show();
|
||||
|
||||
_playerMoney = Context.PlayerFactory.CreatePlayerMoney();
|
||||
|
||||
//_playerHealth = Context.PlayerProvider.Health;
|
||||
//_playerHealth.OnDeath += EndGame;
|
||||
Context.LoadingManager
|
||||
.RegisterLoading(LoadingWork.LoadScene)
|
||||
.RegisterLoading(LoadingWork.LoadUI)
|
||||
.RegisterLoading(LoadingWork.LoadModelResource)
|
||||
.RegisterLoading(LoadingWork.LoadAudio);
|
||||
|
||||
Context.AudioService.TransitToSnapshot(AudioSnapshotState.Peaceful);
|
||||
Context.AudioService.TransitToSnapshot(AudioSnapshotState.None);
|
||||
|
||||
Context.InputService.EnableMap(ActionMappings.Gameplay);
|
||||
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.Debug1, GiveHealth);
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.Debug3, GiveMoney);
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.Debug2, LooseHealth);
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.Debug4, LooseMoney);
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.Debug5, PlayDebugSFX);
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.Debug6, PlayDebugDispatcher);
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.Debug1, InstaKillDEBUG);
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.Debug4, TakeGamageDEBUG);
|
||||
|
||||
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
WaitForSceneToLoad();
|
||||
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
Context.SceneLoaderService.LoadSceneAsyncAwaitable((int)SceneIds.DevGen);
|
||||
Context.LoadingManager.OnLoadingEnded += AfterSceneLoaded;
|
||||
|
||||
WaitForLoad().Forget();
|
||||
}
|
||||
|
||||
private async UniTask WaitForPlayerCharacterLoad() => _playerCharacter = await Context.PlayerFactory.CreatePlayer();
|
||||
|
||||
private async UniTaskVoid WaitForSceneToLoad()
|
||||
{
|
||||
private async UniTaskVoid WaitForLoad()
|
||||
{
|
||||
await UniTask.WhenAll(
|
||||
Context.SceneLoaderService.LoadSceneAsyncAwaitable((int)SceneIds.Gameplay),
|
||||
Context.UIService.AsyncSwitchPanelTo(UIPanel.Gameplay),
|
||||
Context.UIService.AsyncSwitchPanelTo(UIPanel.Gameplay),
|
||||
Context.AudioFactory.WarmGameplayMusic(),
|
||||
Context.AudioFactory.WarmSFX(),
|
||||
WaitForPlayerCharacterLoad()
|
||||
);
|
||||
Context.AudioFactory.WarmDeathMusic(),
|
||||
// Context.AudioFactory.WarmSFX(),
|
||||
Context.AudioFactory.WarmDispatcher(),
|
||||
Context.AudioFactory.WarmEnemies(),
|
||||
Context.AudioFactory.WarmCourier()
|
||||
);
|
||||
|
||||
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;
|
||||
|
||||
Context.PlayerProvider = SceneManager.GetActiveScene().GetSceneContainer().Resolve<IPlayerProvider>();
|
||||
Context.PlayerFactory = SceneManager.GetActiveScene().GetSceneContainer().Resolve<IPlayerFactory>();
|
||||
|
||||
await UniTask.WhenAll(
|
||||
WaitForPlayerArmsToInitialize(),
|
||||
WaitForPlayerCharacterLoad()
|
||||
);
|
||||
|
||||
_playerHealth = Context.PlayerProvider.Health;
|
||||
_playerHealth.OnDamage += PlayerDamageTaken;
|
||||
_playerHealth.OnDeath += EndGame;
|
||||
|
||||
Context.AudioService.PlayRandomMusicUntilHumanityWillBeDestroyedForTheySins(MusicType.Peaceful);
|
||||
Context.AudioService.PlayRandomMusicUntilHumanityWillBeDestroyedForTheySins(MusicType.Action);
|
||||
|
||||
var sceneEnvironment = ((GameplaySceneEnvironment)SceneManager.GetActiveScene()
|
||||
.GetSceneContainer().Resolve<CurrentSceneEnvironment>());
|
||||
|
||||
_testSFXTransform = sceneEnvironment.debugSfxTarget;
|
||||
|
||||
_playerCharacter.Teleport(sceneEnvironment.playerSpawnPoint.position, sceneEnvironment.playerSpawnPoint.rotation);
|
||||
|
||||
((GameplayPanel)Context.UIService.CurrentPanel).Initialize(_playerMoney, _playerHealth);
|
||||
|
||||
Context.CameraStateMachine.SwitchState(CameraMode.FirstPerson);
|
||||
|
||||
((BaseCameraState)Context.CameraStateMachine.CurrentBaseState).SetFollowTransform(_playerCharacter.GetFollowTransform());
|
||||
|
||||
Context.InputService.EnableMap(ActionMappings.Gameplay);
|
||||
|
||||
Context.UIService.LoadingScreen.Hide();
|
||||
Context.LoadingManager
|
||||
.UnregisterLoading(LoadingWork.LoadModelResource);
|
||||
}
|
||||
|
||||
private void OnCharacterSpawn(CharacterProvider characterProvider)
|
||||
private void AfterPlayerLoaded()
|
||||
{
|
||||
((BaseCameraState)Context.CameraStateMachine.CurrentBaseState).SetFollowTransform(_playerCharacter.GetFollowTransform());
|
||||
}
|
||||
private void PlayDebugSFX(InputAction.CallbackContext context)
|
||||
{
|
||||
Context.AudioService.PlaySFX(SFXSounds.Crowbar, _testSFXTransform.position);
|
||||
}
|
||||
private void PlayDebugDispatcher(InputAction.CallbackContext context)
|
||||
{
|
||||
Context.AudioService.PlayDispatcher(DispatcherSounds.AhFreeman);
|
||||
}
|
||||
private void GiveHealth(InputAction.CallbackContext context)
|
||||
{
|
||||
_playerHealth.GetDamage(-1);
|
||||
Container sceneContainer = SceneManager.GetActiveScene().GetSceneContainer();
|
||||
|
||||
_playerScore = sceneContainer.Resolve<IPlayerScore>();
|
||||
|
||||
GameplaySceneEnvironment sceneEnvironment = SceneEnvironmentVariables(sceneContainer);
|
||||
|
||||
_volume = sceneEnvironment.volume;
|
||||
|
||||
PlayerInitialize(sceneEnvironment);
|
||||
|
||||
CameraInitialize();
|
||||
|
||||
GameplayServicesInitialize(sceneContainer);
|
||||
|
||||
UIInitialize();
|
||||
|
||||
Context.LoadingManager.OnLoadingEnded -= AfterPlayerLoaded;
|
||||
|
||||
_tickEnabled = true;
|
||||
}
|
||||
|
||||
private void LooseHealth(InputAction.CallbackContext context)
|
||||
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.GetDamage(1);
|
||||
_playerHealth.InstaKill();
|
||||
}
|
||||
private void OrderRecieved(float time)
|
||||
{
|
||||
Context.AudioService.PlayDispatcher((DispatcherSounds)Random.Range((int)DispatcherSounds.Recieve1,(int)DispatcherSounds.Recieve2 + 1));
|
||||
}
|
||||
private void OrderDelivered(int score, float time)
|
||||
{
|
||||
_gameplayPanel.HideTimer();
|
||||
|
||||
if(time < 0f) Context.AudioService.PlayDispatcher((DispatcherSounds)Random.Range((int)DispatcherSounds.Late1,(int)DispatcherSounds.Late2 + 1));
|
||||
_playerScore.UpdateScore(score);
|
||||
|
||||
Context.AudioService.TransitToSnapshot(AudioSnapshotState.Peaceful);
|
||||
}
|
||||
|
||||
private void GiveMoney(InputAction.CallbackContext context)
|
||||
private void PlayerDamageTaken(int damage, PlayerHealth health)
|
||||
{
|
||||
_playerMoney.GiveMoney(100);
|
||||
((GameplayPanel)(Context.UIService.CurrentPanel)).SummonDispatcher();
|
||||
Context.AudioService.PlayDispatcher((DispatcherSounds)Random.Range((int)DispatcherSounds.TakeDamage1,(int)DispatcherSounds.TakeDamage4 + 1));
|
||||
Context.AudioService.PlayCourier((CourierSounds)Random.Range((int)CourierSounds.Damage1,(int)CourierSounds.Damage2 + 1));
|
||||
DamageEffectProcess().Forget();
|
||||
}
|
||||
|
||||
private void LooseMoney(InputAction.CallbackContext context)
|
||||
// TODO В конфиг
|
||||
private async UniTaskVoid DamageEffectProcess()
|
||||
{
|
||||
_playerMoney.LooseMoney(100);
|
||||
((GameplayPanel)(Context.UIService.CurrentPanel)).CloseDispatcher();
|
||||
_damagePanel.Show();
|
||||
Context.AudioService.ApplyStun(200, 0.5f);
|
||||
|
||||
DOTween.To(() => _volume.weight, x => _volume.weight = x, 1f, 0.5f);
|
||||
await UniTask.WaitForSeconds(3f);
|
||||
DOTween.To(() => _volume.weight, x => _volume.weight = x, 0f, 1f);
|
||||
Context.AudioService.ApplyStun(5000, 1f);
|
||||
_damagePanel.Hide();
|
||||
}
|
||||
// DEBUG
|
||||
private void InstaKillDEBUG(InputAction.CallbackContext context)
|
||||
{
|
||||
_playerHealth.InstaKill();
|
||||
}
|
||||
private void TakeGamageDEBUG(InputAction.CallbackContext context)
|
||||
{
|
||||
_playerHealth.GetDamage(1);
|
||||
}
|
||||
// DEBUG
|
||||
private bool _tickEnabled;
|
||||
public override void Tick()
|
||||
{
|
||||
if (!_tickEnabled) return;
|
||||
|
||||
_orderService.DecreaseTimer(Time.deltaTime);
|
||||
}
|
||||
|
||||
private void EndGame()
|
||||
@@ -140,23 +198,83 @@ namespace Code.App.AppStates
|
||||
public override void ExitState()
|
||||
{
|
||||
_playerHealth = null;
|
||||
_playerMoney = 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.AudioService.GladlyAskToStopMusic(MusicType.Action, callback: Context.AudioFactory.ReleaseActionMusic);
|
||||
Context.AudioService.GladlyAskToStopMusic(MusicType.Peaceful, callback: Context.AudioFactory.ReleasePeacefulMusic);
|
||||
Context.AudioService.GladlyAskToStopMusic(MusicType.Action, time: 0f, callback: Context.AudioFactory.ReleaseActionMusic);
|
||||
Context.AudioService.GladlyAskToStopMusic(MusicType.Peaceful, time: 0f, callback: Context.AudioFactory.ReleasePeacefulMusic);
|
||||
Context.AudioFactory.ReleaseCourier();
|
||||
Context.AudioFactory.ReleaseDispatcher();
|
||||
Context.AudioFactory.ReleaseEnemies();
|
||||
// Context.AudioFactory.ReleaseSFX();
|
||||
|
||||
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.Debug1, GiveHealth);
|
||||
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.Debug3, GiveHealth);
|
||||
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.Debug2, LooseHealth);
|
||||
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.Debug4, LooseMoney);
|
||||
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.Debug5, PlayDebugSFX);
|
||||
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.Debug6, PlayDebugDispatcher);
|
||||
|
||||
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.Debug1, InstaKillDEBUG);
|
||||
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.Debug4, TakeGamageDEBUG);
|
||||
|
||||
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 DamagePanel _damagePanel;
|
||||
private void UIInitialize()
|
||||
{
|
||||
_gameplayPanel = (GameplayPanel)Context.UIService.CurrentPanel;
|
||||
_gameplayPanel.Initialize(_playerScore, _playerHealth, _orderService);
|
||||
Context.AudioService.OnDispatcherStarted += _gameplayPanel.SummonDispatcher;
|
||||
Context.AudioService.OnDispatcherEnded += _gameplayPanel.CloseDispatcher;
|
||||
|
||||
_damagePanel = _gameplayPanel.DamagePanel;
|
||||
}
|
||||
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 Volume _volume;
|
||||
private GameplaySceneEnvironment SceneEnvironmentVariables(Container sceneContainer)
|
||||
{
|
||||
var sceneEnvironment = (GameplaySceneEnvironment)sceneContainer.Resolve<CurrentSceneEnvironment>();
|
||||
|
||||
return sceneEnvironment;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using Code.App.Loading;
|
||||
using Code.App.StateMachine;
|
||||
using Code.Audio;
|
||||
using Code.Gameplay.Camera;
|
||||
@@ -24,44 +25,79 @@ namespace Code.App.AppStates
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
Context.UIService.LoadingScreen.Show();
|
||||
Context.LoadingManager
|
||||
.RegisterLoading(LoadingWork.LoadScene)
|
||||
.RegisterLoading(LoadingWork.LoadUI)
|
||||
.RegisterLoading(LoadingWork.LoadAudio);
|
||||
|
||||
Context.AudioService.TransitToSnapshot(AudioSnapshotState.Menu);
|
||||
|
||||
Context.CameraStateMachine.SwitchState(CameraMode.UltraStatic);
|
||||
|
||||
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
WaitForSceneToLoad();
|
||||
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
Context.CameraStateMachine.SwitchState(CameraMode.MainMenu);
|
||||
|
||||
Context.SceneLoaderService.LoadSceneAsyncAwaitable((int)SceneIds.MainMenu);
|
||||
Context.LoadingManager.OnLoadingEnded += AfterSceneLoaded;
|
||||
|
||||
WaitForLoad().Forget();
|
||||
}
|
||||
|
||||
private CinematicDoorOpening _damnDoor = new();
|
||||
private async UniTaskVoid WaitForSceneToLoad()
|
||||
private async UniTaskVoid WaitForLoad()
|
||||
{
|
||||
await UniTask.WhenAll(
|
||||
Context.SceneLoaderService.LoadSceneAsyncAwaitable((int)SceneIds.MainMenu),
|
||||
Context.UIService.AsyncSwitchPanelTo(UIPanel.MainMenu),
|
||||
Context.AudioFactory.WarmMenuMusic()
|
||||
);
|
||||
Context.AudioFactory.WarmMenuMusic(),
|
||||
Context.AudioFactory.WarmAudioTestClips()
|
||||
);
|
||||
Context.LoadingManager
|
||||
.UnregisterLoading(LoadingWork.LoadUI)
|
||||
.UnregisterLoading(LoadingWork.LoadAudio);
|
||||
|
||||
Context.AudioService.TransitToSnapshot(AudioSnapshotState.Menu);
|
||||
Context.AudioService.PlayRandomMusicUntilHumanityWillBeDestroyedForTheySins(MusicType.Menu);
|
||||
|
||||
var hui = ((MainMenuEnvironment)SceneManager.GetActiveScene()
|
||||
InitializeUI((MainMenuEnvironment)SceneManager.GetActiveScene()
|
||||
.GetSceneContainer().Resolve<CurrentSceneEnvironment>());
|
||||
_damnDoor.DamnDoor = hui.damnDoor;
|
||||
_damnDoor.DamnDoor.SetPhysics(false);
|
||||
_damnDoor.DoorLight = hui.doorLight;
|
||||
|
||||
var menuPanel = (MainMenuPanel)Context.UIService.CurrentPanel;
|
||||
InitializeAudio();
|
||||
|
||||
InitializeInput();
|
||||
}
|
||||
|
||||
private void AfterSceneLoaded()
|
||||
{
|
||||
var mainMenuEnvironment = (MainMenuEnvironment)SceneManager.GetActiveScene()
|
||||
.GetSceneContainer().Resolve<CurrentSceneEnvironment>();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
private void InitializeAudio()
|
||||
{
|
||||
Context.AudioService.PlayRandomMusicUntilHumanityWillBeDestroyedForTheySins(MusicType.Menu);
|
||||
}
|
||||
|
||||
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);
|
||||
menuPanel.CinematicDoorOpening = _damnDoor;
|
||||
|
||||
((UltraStaticState)Context.CameraStateMachine.CurrentBaseState).SetFollowTransform(hui.cameraPosition);
|
||||
|
||||
Context.UIService.LoadingScreen.Hide();
|
||||
|
||||
Context.InputService.EnableMap(ActionMappings.MainMenu);
|
||||
|
||||
mainMenuEnvironment.menuButtonsCanvas.worldCamera = Context.CameraStateMachine.Camera;
|
||||
mainMenuEnvironment.settingsCanvas.worldCamera = Context.CameraStateMachine.Camera;
|
||||
}
|
||||
|
||||
public override void Tick()
|
||||
@@ -82,8 +118,9 @@ namespace Code.App.AppStates
|
||||
public override void ExitState()
|
||||
{
|
||||
Context.InputService.DisableMap(ActionMappings.MainMenu);
|
||||
Context.AudioService.GladlyAskToStopMusic(MusicType.Menu, callback: Context.AudioFactory.ReleaseMenuMusic);
|
||||
|
||||
Context.AudioService.GladlyAskToStopMusic(MusicType.Menu, time: 0f, callback: Context.AudioFactory.ReleaseMenuMusic);
|
||||
|
||||
Context.AudioFactory.ReleaseAudioTestClips();
|
||||
base.ExitState();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using Code.App.Loading;
|
||||
using Code.App.StateMachine;
|
||||
using Code.Audio;
|
||||
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.Scenes;
|
||||
using Code.StaticData;
|
||||
@@ -25,11 +30,12 @@ namespace Code.App
|
||||
|
||||
InstallInfrastructureUnit(containerBuilder, staticDataService);
|
||||
|
||||
containerBuilder.AddSingleton(typeof(LoadingManager), typeof(ILoadingManager));
|
||||
|
||||
containerBuilder.AddSingleton(typeof(InputService), typeof(IInputService));
|
||||
containerBuilder.AddSingleton(typeof(PlayerFactory), typeof(IPlayerFactory));
|
||||
containerBuilder.AddSingleton(typeof(PlayerProvider), typeof(IPlayerProvider));
|
||||
|
||||
|
||||
InitializeCamera(containerBuilder, staticDataService);
|
||||
|
||||
containerBuilder.AddSingleton(typeof(UIFactory), typeof(IUIFactory));
|
||||
containerBuilder.AddSingleton(typeof(UIService), typeof(IUIService));
|
||||
|
||||
@@ -61,6 +67,7 @@ namespace Code.App
|
||||
containerBuilder.AddSingleton(infrastructureUnit.AddComponent<CameraStateMachine>());
|
||||
}
|
||||
|
||||
// TODO Часть в сцены
|
||||
private void InstallStaticData(ContainerBuilder containerBuilder, out IStaticDataService staticDataService)
|
||||
{
|
||||
staticDataService = new StaticDataService();
|
||||
@@ -72,6 +79,7 @@ namespace Code.App
|
||||
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));
|
||||
@@ -84,9 +92,19 @@ namespace Code.App
|
||||
|
||||
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.CourierSoundListConfig, typeof(CourierSoundListConfig));
|
||||
containerBuilder.AddSingleton(staticDataService.DispatcherSoundListConfig, typeof(DispatcherSoundListConfig));
|
||||
containerBuilder.AddSingleton(staticDataService.EnemiesSoundListConfig, typeof(EnemiesSoundListConfig));
|
||||
containerBuilder.AddSingleton(staticDataService.AudioSourceSettingsConfigs, typeof(Dictionary<AudioSourceType, AudioSourceSettingsConfig>));
|
||||
|
||||
containerBuilder.AddSingleton(staticDataService.DefaultAudioSettingsConfig, typeof(DefaultAudioSettingsConfig));
|
||||
|
||||
containerBuilder.AddSingleton(staticDataService.OrderServiceConfig, typeof(OrderServiceConfig));
|
||||
containerBuilder.AddSingleton(staticDataService.OrderBoxConfig, typeof(OrderBoxConfig));
|
||||
|
||||
containerBuilder.AddSingleton(staticDataService.GeneratorConfig, typeof(GeneratorConfig));
|
||||
}
|
||||
|
||||
private AppStateMachine _appStateMachine;
|
||||
@@ -101,21 +119,26 @@ namespace Code.App
|
||||
AttributeInjector.Inject(cameraStateMachine.StateMachineContext, container);
|
||||
cameraStateMachine.Initialize();
|
||||
|
||||
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
BootstrapFinish(container);
|
||||
|
||||
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
BootstrapFinish(container).Forget();
|
||||
}
|
||||
private async UniTaskVoid BootstrapFinish(Container container)
|
||||
{
|
||||
var loadingScreen = GameObject.FindWithTag(Tags.LoadingScreen);
|
||||
DontDestroyOnLoad(loadingScreen);
|
||||
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.GetComponent<LoadingScreen>()),
|
||||
container.Resolve<IUIService>().Initialize(loadingScreen),
|
||||
container.Resolve<IAudioService>().Initialize()
|
||||
);
|
||||
|
||||
loadingManager.UnregisterLoading(LoadingWork.Bootstrap);
|
||||
|
||||
_appStateMachine
|
||||
.SwitchState(AppState.MainMenu)
|
||||
.AllowStateTransition(AppState.Gameplay);
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.App.Debug
|
||||
{
|
||||
public class Logger : MonoBehaviour
|
||||
{
|
||||
//#if !UNITY_EDITOR
|
||||
static string myLog = "";
|
||||
private string output;
|
||||
private string stack;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
Application.logMessageReceived += Log;
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
Application.logMessageReceived -= Log;
|
||||
}
|
||||
|
||||
public void Log(string logString, string stackTrace, LogType type)
|
||||
{
|
||||
output = logString;
|
||||
stack = stackTrace;
|
||||
myLog = output + " " + myLog;
|
||||
if (myLog.Length > 5000)
|
||||
{
|
||||
myLog = myLog.Substring(0, 4000);
|
||||
}
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
//if (!Application.isEditor) //Do not display in editor ( or you can use the UNITY_EDITOR macro to also disable the rest)
|
||||
{
|
||||
myLog = GUI.TextArea(new Rect(10, 10, Screen.width - 10, Screen.height - 10), myLog);
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc474668ede54a9aa1e0f29c59f067f5
|
||||
timeCreated: 1764915992
|
||||
@@ -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
|
||||
@@ -1,7 +1,14 @@
|
||||
using Code.App.Loading;
|
||||
using Code.Gameplay.Enemies;
|
||||
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
|
||||
{
|
||||
@@ -12,15 +19,38 @@ namespace Code.App.SceneInstallers
|
||||
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(PlayerProvider), typeof(IPlayerProvider));
|
||||
containerBuilder.AddScoped(typeof(PlayerFactory), typeof(IPlayerFactory));
|
||||
containerBuilder.AddScoped(typeof(EnemyFactory), typeof(IEnemyFactory));
|
||||
containerBuilder.AddScoped(typeof(RoomGenerator));
|
||||
|
||||
containerBuilder.OnContainerBuilt += Initialize;
|
||||
}
|
||||
|
||||
private void Initialize(Container container)
|
||||
{
|
||||
GameplaySceneEnvironment env = (GameplaySceneEnvironment)container.Resolve<CurrentSceneEnvironment>();
|
||||
ILoadingManager loadingManager = container.Resolve<ILoadingManager>();
|
||||
|
||||
GameplaySceneEnvironment env = (GameplaySceneEnvironment)container.Resolve<CurrentSceneEnvironment>();
|
||||
|
||||
env.TransitVariables(_gameplaySceneEnvironment);
|
||||
|
||||
loadingManager
|
||||
.UnregisterLoading(LoadingWork.LoadScene);
|
||||
|
||||
LoadRooms(container,loadingManager).Forget();
|
||||
}
|
||||
|
||||
private async UniTaskVoid LoadRooms(Container container, ILoadingManager loadingManager)
|
||||
{
|
||||
await container.Resolve<IRoomGeneratorFactory>().PreloadRooms(container.Resolve<IOrderService>());
|
||||
|
||||
container.Resolve<RoomGenerator>().Initialize();
|
||||
|
||||
loadingManager.UnregisterLoading(LoadingWork.LoadModelResource);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using Code.App.Loading;
|
||||
using Code.Scenes;
|
||||
using Code.Scenes.SceneEnvironments;
|
||||
using Reflex.Core;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.App.SceneInstallers
|
||||
{
|
||||
@@ -22,6 +22,11 @@ namespace Code.App.SceneInstallers
|
||||
MainMenuEnvironment env = (MainMenuEnvironment)container.Resolve<CurrentSceneEnvironment>();
|
||||
|
||||
env.TransitVariables(_mainMenuEnvironment);
|
||||
|
||||
ILoadingManager loadingManager = container.Resolve<ILoadingManager>();
|
||||
|
||||
loadingManager
|
||||
.UnregisterLoading(LoadingWork.LoadScene);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
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.Scenes;
|
||||
using Code.UI;
|
||||
@@ -10,14 +13,16 @@ namespace Code.App.StateMachine
|
||||
{
|
||||
public class AppStateMachineContext
|
||||
{
|
||||
[Inject] public ILoadingManager LoadingManager { get; private set; }
|
||||
[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 IPlayerFactory PlayerFactory { get; set; }
|
||||
/*[Inject]*/public IPlayerProvider PlayerProvider { get; set; }
|
||||
// [Inject] public IEnemyFactory EnemyFactory { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,36 @@
|
||||
namespace Code.Audio
|
||||
{
|
||||
public enum SFXSounds
|
||||
{
|
||||
Crowbar,
|
||||
Shot357
|
||||
{
|
||||
}
|
||||
public enum UISounds
|
||||
{
|
||||
Crowbar
|
||||
{
|
||||
}
|
||||
public enum EnemiesSounds
|
||||
{
|
||||
Bastard,
|
||||
Bravo
|
||||
GrandpaAttack,
|
||||
GrandpaStep,
|
||||
RoachAttack,
|
||||
RoachStep
|
||||
}
|
||||
public enum DispatcherSounds
|
||||
{
|
||||
Absolutely,
|
||||
AbsolutelyNot,
|
||||
AhFreeman
|
||||
Recieve1,
|
||||
Recieve2,
|
||||
TakeDamage1,
|
||||
TakeDamage2,
|
||||
TakeDamage3,
|
||||
TakeDamage4,
|
||||
Late1,
|
||||
Late2,
|
||||
Late3,
|
||||
Late4,
|
||||
Late5
|
||||
}
|
||||
public enum CourierSounds
|
||||
{
|
||||
Step,
|
||||
Damage1,
|
||||
Damage2
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Code.Configs;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
@@ -15,31 +16,40 @@ namespace Code.Audio
|
||||
public AudioMixer AudioMixer { get; private set; }
|
||||
private AssetReference _audioSourcePrefab;
|
||||
|
||||
private AssetReference[] _audioTestClipsReferences;
|
||||
private AssetReference[] _peacefulSoundtrack;
|
||||
private AssetReference[] _actionSoundtrack;
|
||||
private AssetReference[] _deathSoundtrack;
|
||||
private AssetReference[] _menuSoundtrack;
|
||||
private AssetReference[] _SFX;
|
||||
private AssetReference[] _enemies;
|
||||
private AssetReference[] _dispatcher;
|
||||
private AssetReference[] _character;
|
||||
private AssetReference[] _courier;
|
||||
|
||||
private AsyncOperationHandle<IList<AudioClip>> _audioTestClipsHandle;
|
||||
private AsyncOperationHandle<IList<AudioClip>> _menuMusicHandle;
|
||||
private AsyncOperationHandle<IList<AudioClip>> _deathMusicHandle;
|
||||
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;
|
||||
private AsyncOperationHandle<IList<AudioClip>> _courierHandle;
|
||||
|
||||
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> CourierAudios { get; private set; } = new();
|
||||
public List<AudioClip> DispatcherAudios { get; private set; } = new();
|
||||
|
||||
public AudioFactory(AudioMixerConfig audioMixerConfig,
|
||||
SoundtrackListConfig soundtrackListConfig,
|
||||
SFXListConfig sfxListConfig,
|
||||
EnemiesSoundListConfig enemiesSoundListConfig,
|
||||
DispatcherSoundListConfig dispatcherSoundListConfig
|
||||
DispatcherSoundListConfig dispatcherSoundListConfig,
|
||||
AudioTestClipsConfig audioTestClipsConfig,
|
||||
CourierSoundListConfig courierSoundListConfig
|
||||
)
|
||||
{
|
||||
AudioMixer = audioMixerConfig.audioMixerAsset;
|
||||
@@ -47,14 +57,18 @@ namespace Code.Audio
|
||||
|
||||
_peacefulSoundtrack = soundtrackListConfig.peacefulSoundtrack;
|
||||
_actionSoundtrack = soundtrackListConfig.actionSoundtrack;
|
||||
_deathSoundtrack = soundtrackListConfig.deathSoundtrack;
|
||||
_menuSoundtrack = soundtrackListConfig.menuSoundtrack;
|
||||
_SFX = sfxListConfig.SFX;
|
||||
_enemies = enemiesSoundListConfig.enemies;
|
||||
_dispatcher = dispatcherSoundListConfig.dispatcher;
|
||||
_courier = courierSoundListConfig.courierSounds;
|
||||
_audioTestClipsReferences = audioTestClipsConfig.audioTestClips;
|
||||
|
||||
MusicDictionary.Add(MusicType.Menu, new ());
|
||||
MusicDictionary.Add(MusicType.Peaceful, new ());
|
||||
MusicDictionary.Add(MusicType.Death, new ());
|
||||
MusicDictionary.Add(MusicType.Action, new ());
|
||||
MusicDictionary.Add(MusicType.Peaceful, new ());
|
||||
}
|
||||
|
||||
public async UniTask LoadAudioSourcePrefab(Action<GameObject> callback) =>
|
||||
@@ -62,8 +76,8 @@ namespace Code.Audio
|
||||
|
||||
public async UniTask WarmGameplayMusic( )
|
||||
{
|
||||
_actionMusicHandle = Addressables.LoadAssetsAsync<AudioClip>(_actionSoundtrack, OnActionTrackLoaded, Addressables.MergeMode.None);
|
||||
_peacefulMusicHandle = Addressables.LoadAssetsAsync<AudioClip>(_peacefulSoundtrack, OnPeacefulTrackLoaded, Addressables.MergeMode.None);
|
||||
_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());
|
||||
}
|
||||
@@ -77,12 +91,28 @@ namespace Code.Audio
|
||||
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.None);
|
||||
_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()
|
||||
{
|
||||
@@ -90,9 +120,32 @@ namespace Code.Audio
|
||||
// foreach (var assetReference in _menuSoundtrack) assetReference.ReleaseAsset();
|
||||
_menuMusicHandle.Release();
|
||||
}
|
||||
public async UniTask WarmCourier()
|
||||
{
|
||||
// _courierHandle = Addressables.LoadAssetsAsync<AudioClip>(_courier, OnCourierLoaded, Addressables.MergeMode.Union);
|
||||
foreach (var assetReference in _courier) CourierAudios.Add(await Addressables.LoadAssetAsync<AudioClip>(assetReference));
|
||||
// await _courierHandle.ToUniTask();
|
||||
}
|
||||
|
||||
public void ReleaseCourier()
|
||||
{
|
||||
foreach (var assetReference in CourierAudios) Addressables.Release(assetReference);
|
||||
CourierAudios.Clear();
|
||||
// _courierHandle.Release();
|
||||
}
|
||||
public async UniTask WarmDeathMusic()
|
||||
{
|
||||
_deathMusicHandle = Addressables.LoadAssetsAsync<AudioClip>(_deathSoundtrack, OnDeathTrackLoaded, Addressables.MergeMode.Union);
|
||||
await _deathMusicHandle.ToUniTask();
|
||||
}
|
||||
public void ReleaseDeathMusic()
|
||||
{
|
||||
MusicDictionary[MusicType.Death].Clear();
|
||||
_deathMusicHandle.Release();
|
||||
}
|
||||
public async UniTask WarmSFX( )
|
||||
{
|
||||
_SFXHandle = Addressables.LoadAssetsAsync<AudioClip>(_SFX, OnSFXLoaded, Addressables.MergeMode.None);
|
||||
_SFXHandle = Addressables.LoadAssetsAsync<AudioClip>(_SFX, OnSFXLoaded, Addressables.MergeMode.Union);
|
||||
|
||||
await _SFXHandle.ToUniTask();
|
||||
|
||||
@@ -104,7 +157,7 @@ namespace Code.Audio
|
||||
}
|
||||
public async UniTask WarmEnemies( )
|
||||
{
|
||||
_enemiesHandle = Addressables.LoadAssetsAsync<AudioClip>(_enemies, OnEnemiesLoaded, Addressables.MergeMode.None);
|
||||
_enemiesHandle = Addressables.LoadAssetsAsync<AudioClip>(_enemies, OnEnemiesLoaded, Addressables.MergeMode.Union);
|
||||
|
||||
await _enemiesHandle.ToUniTask();
|
||||
|
||||
@@ -118,7 +171,7 @@ namespace Code.Audio
|
||||
|
||||
public async UniTask WarmDispatcher( )
|
||||
{
|
||||
_dispatcherHandle = Addressables.LoadAssetsAsync<AudioClip>(_dispatcher, OnDispatcherLoaded, Addressables.MergeMode.None);
|
||||
_dispatcherHandle = Addressables.LoadAssetsAsync<AudioClip>(_dispatcher, OnDispatcherLoaded, Addressables.MergeMode.Union);
|
||||
|
||||
await _dispatcherHandle.ToUniTask();
|
||||
|
||||
@@ -134,6 +187,16 @@ namespace Code.Audio
|
||||
{
|
||||
MusicDictionary[MusicType.Menu].Add(audioClip);
|
||||
}
|
||||
private void OnDeathTrackLoaded(AudioClip audioClip)
|
||||
{
|
||||
MusicDictionary[MusicType.Death].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);
|
||||
@@ -154,5 +217,9 @@ namespace Code.Audio
|
||||
{
|
||||
DispatcherAudios.Add(audioClip);
|
||||
}
|
||||
private void OnCourierLoaded(AudioClip audioClip)
|
||||
{
|
||||
CourierAudios.Add(audioClip);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Threading;
|
||||
using Code.Configs;
|
||||
using Code.Constants;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using DG.Tweening;
|
||||
using Reflex.Attributes;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
@@ -21,152 +22,239 @@ namespace Code.Audio
|
||||
private AudioSource _actionMusicSource;
|
||||
private AudioSource _peacefulMusicSource;
|
||||
|
||||
private AudioMixerGroup _masterGroup,
|
||||
// _musicGroup,
|
||||
// _actionMusicGroup,
|
||||
// _peacefulMusicGroup,
|
||||
_SFXGroup,
|
||||
_creaturesGroup,
|
||||
_dispatcherGroup,
|
||||
_courierGroup,
|
||||
_enemiesGroup;
|
||||
private Dictionary<AudioType, AudioMixerGroup> _audioMixerGroups = new();
|
||||
private readonly AudioSourcePool _audioSourcePool;
|
||||
|
||||
// Юнити не может - говнокод поможет.
|
||||
private Dictionary<AudioSnapshotState, Dictionary<AudioType, float>> _snapshotsVolumes = new();
|
||||
private Dictionary<AudioSourceType, AudioSourceSettingsConfig> _settings;
|
||||
|
||||
private readonly AudioSourcePool _audioSourcePool = new();
|
||||
|
||||
private Dictionary<AudioSnapshotState, AudioMixerSnapshot> _snapshots = new();
|
||||
|
||||
public AudioService(IAudioFactory audioFactory)
|
||||
public AudioService(IAudioFactory audioFactory,
|
||||
Dictionary<AudioSourceType, AudioSourceSettingsConfig> settings,
|
||||
DefaultAudioSettingsConfig defaultAudioSettingsConfig)
|
||||
{
|
||||
_audioFactory = audioFactory;
|
||||
_audioSourcePool = new(settings);
|
||||
_settings = settings;
|
||||
|
||||
_snapshotsVolumes.Add(AudioSnapshotState.None,defaultAudioSettingsConfig.noneVolume);
|
||||
_snapshotsVolumes.Add(AudioSnapshotState.Menu,defaultAudioSettingsConfig.menuVolume);
|
||||
_snapshotsVolumes.Add(AudioSnapshotState.Action,defaultAudioSettingsConfig.actionVolume);
|
||||
_snapshotsVolumes.Add(AudioSnapshotState.Peaceful,defaultAudioSettingsConfig.peacefulVolume);
|
||||
}
|
||||
|
||||
public float GetSetting(AudioType type)
|
||||
{
|
||||
_mixer.GetFloat(_audioMixerGroups[type].name, out float value);
|
||||
|
||||
value = Mathf.Pow(10f, value / 20);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public void ChangeSetting(AudioType type, float value)
|
||||
{
|
||||
float volume = Mathf.Log10(value) * 20;
|
||||
switch (type)
|
||||
{
|
||||
case AudioType.DeathMusic:
|
||||
case AudioType.Master:
|
||||
_snapshotsVolumes[AudioSnapshotState.Menu][type] = value;
|
||||
_snapshotsVolumes[AudioSnapshotState.Action][type] = value;
|
||||
_snapshotsVolumes[AudioSnapshotState.Peaceful][type] = value;
|
||||
_mixer.SetFloat(_audioMixerGroups[type].name, volume);
|
||||
break;
|
||||
case AudioType.ActionMusic:
|
||||
_snapshotsVolumes[AudioSnapshotState.Action][type] = value;
|
||||
_mixer.SetFloat(_audioMixerGroups[type].name, volume);
|
||||
break;
|
||||
case AudioType.PeacefulMusic:
|
||||
_snapshotsVolumes[AudioSnapshotState.Peaceful][type] = value;
|
||||
_mixer.SetFloat(_audioMixerGroups[type].name, volume);
|
||||
break;
|
||||
case AudioType.MenuMusic:
|
||||
_snapshotsVolumes[AudioSnapshotState.Menu][type] = value;
|
||||
_mixer.SetFloat(_audioMixerGroups[type].name, volume);
|
||||
break;
|
||||
case AudioType.SFX:
|
||||
case AudioType.Dispatcher:
|
||||
case AudioType.Courier:
|
||||
case AudioType.Enemies:
|
||||
_snapshotsVolumes[AudioSnapshotState.Action][type] = value;
|
||||
_snapshotsVolumes[AudioSnapshotState.Peaceful][type] = value;
|
||||
_mixer.SetFloat(_audioMixerGroups[type].name, volume);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public async UniTask Initialize()
|
||||
{
|
||||
// _mixer = await _audioFactory.CreateMixer();
|
||||
_mixer = _audioFactory.AudioMixer;
|
||||
|
||||
_masterGroup = _mixer.FindMatchingGroups(AudioGroups.MasterGroup)[0];
|
||||
// _actionMusicGroup = _mixer.FindMatchingGroups(AudioGroups.ActionMusicGroup)[0];
|
||||
// _peacefulMusicGroup = _mixer.FindMatchingGroups(AudioGroups.PeacefulMusoup)[0];
|
||||
// _musicGroup = _mixer.FindMatchingGroups(AudioGroups.MusicGroup)[0];
|
||||
_musicAudioGroups.Add(MusicType.Menu, _mixer.FindMatchingGroups(AudioGroups.MenuMusicGroup)[0]);
|
||||
_musicAudioGroups.Add(MusicType.Death, _mixer.FindMatchingGroups(AudioGroups.DeathMusicGroup)[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.Death, new());
|
||||
_cancellationTokenSources.Add(MusicType.Action, new());
|
||||
_cancellationTokenSources.Add(MusicType.Peaceful, new());
|
||||
|
||||
|
||||
_musicAudioSources.Add(MusicType.Menu, null);
|
||||
_musicAudioSources.Add(MusicType.Death, 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);
|
||||
_audioMixerGroups.Add(AudioType.Master, _mixer.FindMatchingGroups(AudioGroups.MasterGroup)[0]);
|
||||
_audioMixerGroups.Add(AudioType.SFX, _mixer.FindMatchingGroups(AudioGroups.SFXGroup)[0]);
|
||||
_audioMixerGroups.Add(AudioType.Dispatcher, _mixer.FindMatchingGroups(AudioGroups.DispatcherMusicGroup)[0]);
|
||||
_audioMixerGroups.Add(AudioType.Courier, _mixer.FindMatchingGroups(AudioGroups.CourierGroup)[0]);
|
||||
_audioMixerGroups.Add(AudioType.Enemies, _mixer.FindMatchingGroups(AudioGroups.EnemiesGroup)[0]);
|
||||
_audioMixerGroups.Add(AudioType.MenuMusic, _musicAudioGroups[MusicType.Menu]);
|
||||
_audioMixerGroups.Add(AudioType.DeathMusic, _musicAudioGroups[MusicType.Death]);
|
||||
_audioMixerGroups.Add(AudioType.ActionMusic, _musicAudioGroups[MusicType.Action]);
|
||||
_audioMixerGroups.Add(AudioType.PeacefulMusic, _musicAudioGroups[MusicType.Peaceful]);
|
||||
|
||||
|
||||
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])
|
||||
if (!_musicAudioSources[musicType])
|
||||
{
|
||||
_musicAudioSources[musicType] = _audioSourcePool.GetSource();
|
||||
_musicAudioSources[musicType].spatialBlend = 0f;
|
||||
_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,
|
||||
_ => !_musicAudioSources[musicType].isPlaying,
|
||||
cancellationToken: _cancellationTokenSources[musicType].Token).SuppressCancellationThrow();
|
||||
// Debug.Log($"Finished {musicType}");
|
||||
|
||||
Debug.LogError("Music skipping");
|
||||
if (isCanceled)
|
||||
{
|
||||
// Debug.Log($"Cancelled {musicType}");
|
||||
_cancellationTokenSources[musicType].Dispose();
|
||||
_cancellationTokenSources[musicType] = new();
|
||||
|
||||
|
||||
_audioSourcePool.ReleaseSource(_musicAudioSources[musicType]);
|
||||
_musicAudioSources[musicType] = null;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
PlayRandomMusicUntilHumanityWillBeDestroyedForTheySins(musicType);
|
||||
PlayRandomMusicUntilHumanityWillBeDestroyedForTheySins(musicType).Forget();
|
||||
}
|
||||
|
||||
public async UniTaskVoid GladlyAskToStopMusic(MusicType musicType, AudioSnapshotState audioSnapshotState = AudioSnapshotState.None, float time = 1f, Action callback = null)
|
||||
|
||||
public async UniTaskVoid GladlyAskToStopMusic(MusicType musicType,
|
||||
AudioSnapshotState audioSnapshotState = AudioSnapshotState.None, float time = 1f, Action callback = null)
|
||||
{
|
||||
TransitToSnapshot(audioSnapshotState, time);
|
||||
//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();
|
||||
_cancellationTokenSources[MusicType.Peaceful].Cancel();
|
||||
_cancellationTokenSources[MusicType.Action].Cancel();
|
||||
}
|
||||
|
||||
public void GladlyAskToStopMusic(Action callback = null)
|
||||
{
|
||||
TransitToSnapshot(AudioSnapshotState.None);
|
||||
// TransitToSnapshot(AudioSnapshotState.None);
|
||||
_peacefulMusicSource.Stop();
|
||||
_actionMusicSource.Stop();
|
||||
|
||||
callback?.Invoke();
|
||||
}
|
||||
|
||||
public void TransitToSnapshot(AudioSnapshotState state, float time = 1f)
|
||||
public void TransitToSnapshot(AudioSnapshotState state, float time = 1)
|
||||
{
|
||||
_snapshots[state].TransitionTo(time);
|
||||
foreach (var key in _audioMixerGroups.Keys)
|
||||
_mixer.DOSetFloat(_audioMixerGroups[key].name, Mathf.Log10(_snapshotsVolumes[state][key]) * 20, 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);
|
||||
_audioSourcePool
|
||||
.PlayOneShot(_audioFactory.SFXAudios[(int)sfxId], position, _audioMixerGroups[AudioType.SFX]).Forget();
|
||||
}
|
||||
public void ApplyStun(float value, float time)
|
||||
{
|
||||
_mixer.DOSetFloat("Stun", value, time);
|
||||
}
|
||||
|
||||
public void PlayEnemy(EnemiesSounds enemySoundId, Vector3 position)
|
||||
{
|
||||
_audioSourcePool.PlayOneShot(_audioFactory.EnemiesAudios[(int)enemySoundId], position, _enemiesGroup);
|
||||
_audioSourcePool.PlayOneShot(_audioFactory.EnemiesAudios[(int)enemySoundId], position,
|
||||
_audioMixerGroups[AudioType.Enemies]).Forget();
|
||||
}
|
||||
|
||||
public AudioSource GetSourceOfGroup(AudioType group)
|
||||
{
|
||||
AudioSource source = _audioSourcePool.GetSource();
|
||||
source.outputAudioMixerGroup = _audioMixerGroups[group];
|
||||
return source;
|
||||
}
|
||||
|
||||
public void ReleaseSourceOfGroup(AudioSource source) => _audioSourcePool.ReleaseSource(source);
|
||||
|
||||
// Чинить долго и дорого пусть Артёмов будет много, ведь он наш друг
|
||||
public event IAudioService.OnAudioPlayingDelegate OnDispatcherStarted;
|
||||
public event IAudioService.OnAudioPlayingDelegate OnDispatcherEnded;
|
||||
|
||||
public void PlayDispatcher(DispatcherSounds dispatcherSoundId)
|
||||
{
|
||||
_audioSourcePool.PlayShizo(_audioFactory.DispatcherAudios[(int)dispatcherSoundId], _dispatcherGroup);
|
||||
OnDispatcherStarted?.Invoke();
|
||||
_audioSourcePool.PlayOneShot(_audioFactory.DispatcherAudios[(int)dispatcherSoundId],
|
||||
_audioMixerGroups[AudioType.Dispatcher],
|
||||
AudioSourceType.NoBlend, () => OnDispatcherEnded?.Invoke()).Forget();
|
||||
}
|
||||
|
||||
public void PlayCourier(CourierSounds courierSounds)
|
||||
{
|
||||
_audioSourcePool.PlayOneShot(_audioFactory.CourierAudios[(int)courierSounds],
|
||||
_audioMixerGroups[AudioType.Courier],
|
||||
AudioSourceType.NoBlend).Forget();
|
||||
}
|
||||
private CancellationTokenSource _testClipCancellationTokenSource = new();
|
||||
private void ResetCurrentTestAudioSource() => _currentTestClipAudioType = AudioType.Master;
|
||||
|
||||
private AudioType _currentTestClipAudioType;
|
||||
|
||||
// TODO Засунуть в словарь
|
||||
public void PlayTestClip(AudioType audioType)
|
||||
{
|
||||
if (_currentTestClipAudioType == audioType) return;
|
||||
|
||||
_testClipCancellationTokenSource.Cancel();
|
||||
_testClipCancellationTokenSource = new();
|
||||
|
||||
_currentTestClipAudioType = audioType;
|
||||
|
||||
_audioSourcePool.PlayOneShot(_audioFactory.AudioTestClips[audioType],
|
||||
_audioMixerGroups[audioType], _testClipCancellationTokenSource,
|
||||
AudioSourceType.NoBlend, ResetCurrentTestAudioSource).Forget();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Code.Constants;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Code.Audio
|
||||
{
|
||||
public class AudioServiceDebug : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private AudioMixer mixer;
|
||||
|
||||
private AudioSource _actionMusicSource;
|
||||
private AudioSource _peacefulMusicSource;
|
||||
[SerializeField] private AudioSource prefab;
|
||||
|
||||
[SerializeField] private AudioResource[] peacefulAudio;
|
||||
[SerializeField] private AudioResource[] actionAudio;
|
||||
|
||||
private AudioMixerGroup _masterGroup,
|
||||
_musicGroup,
|
||||
_actionMusicGroup,
|
||||
_peacefulMusicGroup,
|
||||
_SFXGroup,
|
||||
_creaturesGroup,
|
||||
_dispatcherGroup,
|
||||
_courierGroup,
|
||||
_enemiesGroup;
|
||||
|
||||
private readonly AudioSourcePool _audioSourcePool = new();
|
||||
|
||||
private Dictionary<AudioSnapshotState, AudioMixerSnapshot> _snapshots = new();
|
||||
|
||||
[FormerlySerializedAs("sfxAudio")] [SerializeField] private AudioClip[] sfxAudios;
|
||||
[SerializeField] private AudioClip[] enemiesAudios;
|
||||
[SerializeField] private AudioClip[] dispatcherAudios;
|
||||
|
||||
private void MixerCreated()
|
||||
{
|
||||
_masterGroup = mixer.FindMatchingGroups(AudioGroups.MasterGroup)[0];
|
||||
_actionMusicGroup = mixer.FindMatchingGroups(AudioGroups.ActionMusicGroup)[0];
|
||||
_peacefulMusicGroup = mixer.FindMatchingGroups(AudioGroups.PeacefulMusicGroup)[0];
|
||||
_SFXGroup = mixer.FindMatchingGroups(AudioGroups.SFXGroup)[0];
|
||||
_musicGroup = mixer.FindMatchingGroups(AudioGroups.MusicGroup)[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.Peaceful] = mixer.FindSnapshot(AudioGroups.PeacefulSnapshot);
|
||||
_snapshots[AudioSnapshotState.Action] = mixer.FindSnapshot(AudioGroups.ActionSnapshot);
|
||||
|
||||
// _audioSourcePool.Initialize(10,prefab);
|
||||
|
||||
InitializeMusicSources();
|
||||
}
|
||||
|
||||
private void InitializeMusicSources()
|
||||
{
|
||||
_actionMusicSource = _audioSourcePool.GetSource();
|
||||
_actionMusicSource.outputAudioMixerGroup = _actionMusicGroup;
|
||||
_actionMusicSource.spatialBlend = 0f;
|
||||
|
||||
_peacefulMusicSource = _audioSourcePool.GetSource();
|
||||
_peacefulMusicSource.outputAudioMixerGroup = _peacefulMusicGroup;
|
||||
_peacefulMusicSource.spatialBlend = 0f;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
MixerCreated();
|
||||
}
|
||||
|
||||
public void PlayRandomGameplayMusic()
|
||||
{
|
||||
_peacefulMusicSource.resource = peacefulAudio[Random.Range(0, peacefulAudio.Length)];
|
||||
_actionMusicSource.resource = actionAudio[Random.Range(0, actionAudio.Length)];
|
||||
|
||||
_peacefulMusicSource.Play();
|
||||
_actionMusicSource.Play();
|
||||
}
|
||||
|
||||
public void TransitToSnapshot(AudioSnapshotState state)
|
||||
{
|
||||
_snapshots[state].TransitionTo(1f);
|
||||
}
|
||||
|
||||
#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(sfxAudios[(int)sfxId], position, _SFXGroup);
|
||||
}
|
||||
public void PlayDebugSFX()
|
||||
{
|
||||
_audioSourcePool.PlayOneShot(sfxAudios[(int)SFXSounds.Crowbar], transform.position, _SFXGroup);
|
||||
}
|
||||
public void PlayEnemy(EnemiesSounds enemySoundId, Vector3 position)
|
||||
{
|
||||
_audioSourcePool.PlayOneShot(enemiesAudios[(int)enemySoundId], position, _enemiesGroup);
|
||||
}
|
||||
public void PlayDebugEnemySFX()
|
||||
{
|
||||
_audioSourcePool.PlayOneShot(enemiesAudios[(int)EnemiesSounds.Bastard], transform.position, _enemiesGroup);
|
||||
}
|
||||
public void PlayDispatcher(DispatcherSounds dispatcherSoundId)
|
||||
{
|
||||
_audioSourcePool.PlayShizo(dispatcherAudios[(int)dispatcherSoundId], _dispatcherGroup);
|
||||
}
|
||||
public void PlayDebugDispatcherSFX()
|
||||
{
|
||||
_audioSourcePool.PlayShizo(dispatcherAudios[(int)DispatcherSounds.AhFreeman], _dispatcherGroup);
|
||||
}
|
||||
|
||||
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a42cad8f28f54a53bef23d9313014abd
|
||||
timeCreated: 1762805867
|
||||
@@ -1,7 +1,12 @@
|
||||
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
|
||||
{
|
||||
@@ -10,7 +15,11 @@ namespace Code.Audio
|
||||
// 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;
|
||||
@@ -54,30 +63,58 @@ namespace Code.Audio
|
||||
{
|
||||
Object.Destroy(source.gameObject);
|
||||
}
|
||||
|
||||
public async UniTaskVoid PlayOneShot(AudioClip clip, Vector3 position, AudioMixerGroup audioMixerGroup)
|
||||
|
||||
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 = 1f;
|
||||
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 PlayShizo(AudioClip clip, AudioMixerGroup audioMixerGroup)
|
||||
public async UniTaskVoid PlayOneShot(AudioClip clip, AudioMixerGroup audioMixerGroup, AudioSourceType audioSourceType = AudioSourceType.NoBlend, Action onComplete = null)
|
||||
{
|
||||
AudioSource source = _pool.Get();
|
||||
source.PlayOneShot(clip);
|
||||
source.spatialBlend = 0f;
|
||||
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,8 @@
|
||||
namespace Code.Audio
|
||||
{
|
||||
public enum AudioSourceType
|
||||
{
|
||||
Full3D,
|
||||
NoBlend
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 260bbb19b55049928b9ab4d55b32fc3f
|
||||
timeCreated: 1763849966
|
||||
@@ -8,22 +8,30 @@ 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; }
|
||||
AudioMixer AudioMixer { get; }
|
||||
Dictionary<MusicType, List<AudioClip>> MusicDictionary { get; }
|
||||
List<AudioClip> CourierAudios { get; }
|
||||
UniTask LoadAudioSourcePrefab(Action<GameObject> callback);
|
||||
UniTask WarmGameplayMusic();
|
||||
UniTask WarmGameplayMusic( );
|
||||
void ReleaseActionMusic();
|
||||
UniTask WarmMenuMusic();
|
||||
void ReleaseMenuMusic();
|
||||
UniTask WarmSFX();
|
||||
void ReleaseSFX();
|
||||
UniTask WarmEnemies();
|
||||
void ReleaseEnemies();
|
||||
UniTask WarmDispatcher();
|
||||
void ReleaseDispatcher();
|
||||
void ReleasePeacefulMusic();
|
||||
UniTask WarmAudioTestClips( );
|
||||
void ReleaseAudioTestClips();
|
||||
UniTask WarmMenuMusic( );
|
||||
void ReleaseMenuMusic();
|
||||
UniTask WarmSFX( );
|
||||
void ReleaseSFX();
|
||||
UniTask WarmEnemies( );
|
||||
void ReleaseEnemies();
|
||||
UniTask WarmDispatcher( );
|
||||
void ReleaseDispatcher();
|
||||
UniTask WarmCourier();
|
||||
void ReleaseCourier();
|
||||
UniTask WarmDeathMusic( );
|
||||
void ReleaseDeathMusic();
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,18 @@ namespace Code.Audio
|
||||
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);
|
||||
AudioSource GetSourceOfGroup(AudioType group);
|
||||
void ReleaseSourceOfGroup(AudioSource source);
|
||||
void PlayCourier(CourierSounds range);
|
||||
void ApplyStun(float value, float time);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,19 @@ namespace Code.Audio
|
||||
{
|
||||
Menu,
|
||||
Peaceful,
|
||||
Action
|
||||
Action,
|
||||
Death
|
||||
}
|
||||
public enum AudioType
|
||||
{
|
||||
Master,
|
||||
MenuMusic,
|
||||
Dispatcher,
|
||||
SFX,
|
||||
Courier,
|
||||
Enemies,
|
||||
ActionMusic,
|
||||
PeacefulMusic,
|
||||
DeathMusic
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.Audio;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
namespace Code.Configs
|
||||
{
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -5,37 +5,51 @@ 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; // Максимальный угол (в градусах) от вертикали, при котором поверхность считается "стеной"
|
||||
maxStableMoveSpeed = 12f,
|
||||
stableMovementSharpness = 15f,
|
||||
orientationSharpness = 10f;
|
||||
|
||||
// Наклон при залазании на стены
|
||||
public float
|
||||
maxWallLeanAngle = 45f, // Максимальный угол наклона от стены (в градусах)
|
||||
wallLeanSharpness = 50f, // Скорость наклона/выпрямления (чем выше — тем резче)
|
||||
wallLeanHeightScale = 0.1f; // Множитель: на сколько метров подъёма = 1 единица "наклона"
|
||||
jumpSpeed = 10f,
|
||||
jumpCooldown = 0.4f;
|
||||
|
||||
public float
|
||||
dashSpeed = 20f,
|
||||
dashDuration = 0.35f,
|
||||
dashCooldown = 1.2f;
|
||||
|
||||
public AnimationCurve slideVelocityCurve = new(
|
||||
new Keyframe(0.0f, 1.0f),
|
||||
new Keyframe(0.3f, 1.4f),
|
||||
new Keyframe(1.0f, 0.2f)
|
||||
);
|
||||
public float
|
||||
slideMinVelocityThreshold = 3f,
|
||||
slideInitialSpeed = 16f,
|
||||
slideCooldown = 1.5f,
|
||||
slideColliderHeightScale = 0.5f,
|
||||
slideCameraOffsetY = -0.5f,
|
||||
slideEnterDuration = 0.2f,
|
||||
slideExitDuration = 0.25f;
|
||||
|
||||
// Гравитация
|
||||
public Vector3 gravity = new(0f, -30f, 0f); // Вектор, отвечающий за применение гравитации
|
||||
public float
|
||||
leanAngle = 25f,
|
||||
leanThreshold = 0.3f,
|
||||
leanSmoothSpeed = 10f;
|
||||
|
||||
public Vector3 gravity = new(0f, -30f, 0f);
|
||||
public float
|
||||
maxAirSpeed = 10f,
|
||||
airControlSharpness = 8f;
|
||||
|
||||
public float
|
||||
wallRunMaxTime = 1.75f,
|
||||
wallRunMaxNoMoveTime = 0.3f,
|
||||
wallRunSpeed = 15f,
|
||||
wallRunAcceleration = 25f,
|
||||
wallRunGravityScale = 0.25f,
|
||||
wallDetachImpulse = 7f,
|
||||
wallContactAngleThreshold = 45f;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
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,11 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
|
||||
namespace Code.Configs
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Config/Audio/CourierSoundListConfig", fileName = "CourierSoundListConfig")]
|
||||
public class CourierSoundListConfig : ScriptableObject
|
||||
{
|
||||
public AssetReference[] courierSounds;
|
||||
}
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,27 @@
|
||||
using System.Collections.Generic;
|
||||
using AYellowpaper.SerializedCollections;
|
||||
using UnityEngine;
|
||||
using AudioType = Code.Audio.AudioType;
|
||||
|
||||
namespace Code.Configs
|
||||
{
|
||||
[CreateAssetMenu(fileName = "DefaultAudioSettingsConfig", menuName = "Audio/DefaultAudioSettings")]
|
||||
public class DefaultAudioSettingsConfig : ScriptableObject
|
||||
{
|
||||
[Header("Menu")]
|
||||
[SerializedDictionary("AudioType", "Volume")]
|
||||
public SerializedDictionary<Audio.AudioType, float> menuVolume = new();
|
||||
|
||||
[Header("Action")]
|
||||
[SerializedDictionary("AudioType", "Volume")]
|
||||
public SerializedDictionary<Audio.AudioType, float> actionVolume = new();
|
||||
|
||||
[Header("Peaceful")]
|
||||
[SerializedDictionary("AudioType", "Volume")]
|
||||
public SerializedDictionary<Audio.AudioType, float> peacefulVolume = new();
|
||||
|
||||
[Header("None")]
|
||||
[SerializedDictionary("AudioType", "Volume")]
|
||||
public SerializedDictionary<Audio.AudioType, float> noneVolume = new();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 36d35c52933d4d4ba836f75b05c4810f
|
||||
timeCreated: 1764754933
|
||||
@@ -0,0 +1,10 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Configs
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Config/Audio/MusicPlayer", fileName = "MusicPlayerConfig")]
|
||||
public class MusicPlayerConfig : ScriptableObject
|
||||
{
|
||||
public float threshold = 0.5f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8708e3c129d241b08563f1a170bd3a44
|
||||
timeCreated: 1764585060
|
||||
@@ -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
|
||||
@@ -9,5 +9,6 @@ namespace Code.Configs
|
||||
public int maxHealth;
|
||||
|
||||
public AssetReference characterPrefab;
|
||||
public AssetReference armsMeshPrefab;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ namespace Code.Configs
|
||||
{
|
||||
public AssetReference[] peacefulSoundtrack;
|
||||
public AssetReference[] actionSoundtrack;
|
||||
public AssetReference[] deathSoundtrack;
|
||||
public AssetReference[] menuSoundtrack;
|
||||
}
|
||||
}
|
||||
@@ -19,13 +19,14 @@ namespace Code.Constants
|
||||
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 CourierGroup = "Courier";
|
||||
public const string EnemiesGroup = "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";
|
||||
public const string DeathMusicGroup = "Death";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb5ad0cc3a72448a93ee2adb560c35ad
|
||||
timeCreated: 1764345160
|
||||
@@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.DebugAndTest
|
||||
{
|
||||
public class TriggerTest : MonoBehaviour
|
||||
{
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
Debug.Log(gameObject.name + " found " + other.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6bb3c649d82049079d00b843a76aced8
|
||||
timeCreated: 1764345168
|
||||
@@ -10,9 +10,9 @@ namespace Code.Gameplay.Camera
|
||||
*/
|
||||
public enum CameraMode
|
||||
{
|
||||
Bogdan,
|
||||
None,
|
||||
Static,
|
||||
UltraStatic,
|
||||
MainMenu,
|
||||
FirstPerson,
|
||||
ThirdPerson,
|
||||
Cinematic
|
||||
|
||||
@@ -9,14 +9,16 @@ namespace Code.Gameplay.Camera
|
||||
// Текущий режим работы камеры
|
||||
public override void Initialize()
|
||||
{
|
||||
States.Add(CameraMode.None, new NoneState(StateMachineContext));
|
||||
States.Add(CameraMode.Static, new StaticState(StateMachineContext));
|
||||
States.Add(CameraMode.UltraStatic, new UltraStaticState(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.UltraStatic];
|
||||
CurrentBaseState = States[CameraMode.None];
|
||||
}
|
||||
|
||||
public UnityEngine.Camera Camera => StateMachineContext.Camera;
|
||||
|
||||
protected override bool CheckTransitionAllowed(CameraMode nextState) => true;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using Code.Configs;
|
||||
using Code.Input;
|
||||
using Reflex.Attributes;
|
||||
@@ -9,5 +10,6 @@ namespace Code.Gameplay.Camera
|
||||
[Inject] public UnityEngine.Camera Camera;
|
||||
[Inject] public CameraConfig Config;
|
||||
[Inject] public IInputService InputService;
|
||||
[Inject] public Dictionary<CameraMode,CameraSettingsConfig> CameraSettingsConfigs;
|
||||
}
|
||||
}
|
||||
@@ -14,14 +14,18 @@ namespace Code.Gameplay.Camera.CameraStates
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
base.EnterState();
|
||||
|
||||
// В FirstPerson режиме дистанция всегда равна 0
|
||||
MinDistance = 0f;
|
||||
MaxDistance = 0f;
|
||||
DefaultDistance = 0f;
|
||||
TargetDistance = 0f;
|
||||
CurrentDistance = 0f;
|
||||
|
||||
Camera.fieldOfView = Context.CameraSettingsConfigs[CameraMode.FirstPerson].fov;
|
||||
|
||||
base.EnterState();
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
}
|
||||
|
||||
protected override void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation)
|
||||
|
||||
+6
-4
@@ -2,14 +2,16 @@ using UnityEngine;
|
||||
|
||||
namespace Code.Gameplay.Camera.CameraStates
|
||||
{
|
||||
public class UltraStaticState : BaseCameraState, ICameraState
|
||||
public class MainMenuState : BaseCameraState, ICameraState
|
||||
{
|
||||
public UltraStaticState(CameraStateMachineContext context) : base(context) { }
|
||||
public MainMenuState(CameraStateMachineContext context) : base(context) { }
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
Debug.Log("Ultra static State Enter");
|
||||
base.EnterState();
|
||||
|
||||
Camera.fieldOfView = Context.CameraSettingsConfigs[CameraMode.MainMenu].fov;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
}
|
||||
|
||||
protected override void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation)
|
||||
@@ -17,7 +19,7 @@ namespace Code.Gameplay.Camera.CameraStates
|
||||
Camera.transform.position = FollowTransform.position;
|
||||
}
|
||||
|
||||
public CameraMode GetCameraMode() => CameraMode.UltraStatic;
|
||||
public CameraMode GetCameraMode() => CameraMode.MainMenu;
|
||||
|
||||
protected override void HandleRotationInput(float deltaTime, Vector3 rotationInput,
|
||||
out Quaternion targetRotation)
|
||||
File renamed without changes.
@@ -0,0 +1,21 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Gameplay.Camera.CameraStates
|
||||
{
|
||||
public class NoneState : BaseCameraState, ICameraState
|
||||
{
|
||||
public NoneState(CameraStateMachineContext context) : base(context) { }
|
||||
|
||||
protected override void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation)
|
||||
{
|
||||
}
|
||||
|
||||
public CameraMode GetCameraMode() => CameraMode.None;
|
||||
|
||||
protected override void HandleRotationInput(float deltaTime, Vector3 rotationInput,
|
||||
out Quaternion targetRotation)
|
||||
{
|
||||
targetRotation = Quaternion.identity;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d8fa6119113f4f12a35365fd27387124
|
||||
timeCreated: 1763847889
|
||||
@@ -9,8 +9,10 @@ namespace Code.Gameplay.Camera.CameraStates
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
Debug.Log("Static State Enter");
|
||||
base.EnterState();
|
||||
|
||||
Camera.fieldOfView = Context.CameraSettingsConfigs[CameraMode.Static].fov;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
}
|
||||
|
||||
protected override void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation)
|
||||
|
||||
@@ -14,13 +14,13 @@ namespace Code.Gameplay.Camera.CameraStates
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
base.EnterState();
|
||||
|
||||
// Восстанавливаем исходные значения дистанции
|
||||
MinDistance = OriginalMinDistance;
|
||||
MaxDistance = OriginalMaxDistance;
|
||||
DefaultDistance = OriginalDefaultDistance;
|
||||
TargetDistance = DefaultDistance;
|
||||
|
||||
base.EnterState();
|
||||
}
|
||||
|
||||
protected override void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation)
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
using UnityEngine;
|
||||
using Code.Gameplay.Camera;
|
||||
using KinematicCharacterController;
|
||||
|
||||
namespace Code.Gameplay.Character.Controller.Abilities
|
||||
{
|
||||
public class DashMechanic
|
||||
{
|
||||
private readonly float _dashSpeed;
|
||||
private readonly float _dashDuration;
|
||||
private readonly float _dashCooldown;
|
||||
|
||||
private float _dashTimer;
|
||||
private float _dashCooldownTimer;
|
||||
private Vector3 _dashDirection;
|
||||
private bool _dashRequested;
|
||||
|
||||
public bool IsDashing { get; private set; }
|
||||
|
||||
public DashMechanic(float dashSpeed, float dashDuration, float dashCooldown)
|
||||
{
|
||||
_dashSpeed = dashSpeed;
|
||||
_dashDuration = dashDuration;
|
||||
_dashCooldown = dashCooldown;
|
||||
}
|
||||
|
||||
public void TickCooldown(float deltaTime)
|
||||
{
|
||||
if (_dashCooldownTimer > 0f) _dashCooldownTimer -= deltaTime;
|
||||
}
|
||||
|
||||
public void RequestDash(bool dashPressed)
|
||||
{
|
||||
if (dashPressed && !_dashRequested && _dashCooldownTimer <= 0f)
|
||||
_dashRequested = true;
|
||||
}
|
||||
|
||||
public void TryStartDash(KinematicCharacterMotor motor,
|
||||
CameraMode currentCameraMode,
|
||||
Quaternion firstPersonCameraRotation,
|
||||
Vector3 lookInputVector)
|
||||
{
|
||||
if (!_dashRequested || !motor.GroundingStatus.IsStableOnGround || _dashCooldownTimer > 0f)
|
||||
{
|
||||
_dashRequested = false;
|
||||
return;
|
||||
}
|
||||
|
||||
IsDashing = true;
|
||||
_dashTimer = _dashDuration;
|
||||
|
||||
var dir = currentCameraMode == CameraMode.FirstPerson
|
||||
? firstPersonCameraRotation * Vector3.forward
|
||||
: lookInputVector;
|
||||
|
||||
_dashDirection = Vector3.ProjectOnPlane(dir, motor.CharacterUp).normalized;
|
||||
if (_dashDirection.sqrMagnitude < 0.01f) _dashDirection = motor.CharacterForward;
|
||||
|
||||
_dashCooldownTimer = _dashCooldown;
|
||||
_dashRequested = false;
|
||||
}
|
||||
|
||||
public void HandleDash(ref Vector3 currentVelocity, float deltaTime, KinematicCharacterMotor motor)
|
||||
{
|
||||
_dashTimer -= deltaTime;
|
||||
if (_dashTimer <= 0f || !motor.GroundingStatus.IsStableOnGround)
|
||||
{
|
||||
EndDash();
|
||||
return;
|
||||
}
|
||||
|
||||
currentVelocity = _dashDirection * _dashSpeed;
|
||||
currentVelocity += motor.CharacterUp * 1.5f;
|
||||
}
|
||||
|
||||
public void EndDash()
|
||||
{
|
||||
IsDashing = false;
|
||||
_dashTimer = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d62efb53e0c4d49be9fc658484e2575
|
||||
timeCreated: 1764856437
|
||||
+39
-72
@@ -1,122 +1,89 @@
|
||||
using UnityEngine;
|
||||
using Code.Gameplay.Camera;
|
||||
using KinematicCharacterController;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Gameplay.Character.Controller.Abilities
|
||||
{
|
||||
/*
|
||||
* Механика слайда для персонажа
|
||||
* Отвечает за управление состоянием, таймерами и скоростью слайда
|
||||
*/
|
||||
public class SlideMechanic
|
||||
{
|
||||
// Скорость слайда
|
||||
private readonly float _slideSpeed;
|
||||
// Длительность слайда в секундах
|
||||
private readonly float _slideDuration;
|
||||
// Время перезарядки слайда
|
||||
private readonly float _slideCooldown;
|
||||
private readonly AnimationCurve _velocityCurve;
|
||||
private readonly float _minVelocityThreshold;
|
||||
private readonly float _cooldown;
|
||||
|
||||
// Таймер слайда
|
||||
private float _slideTimer;
|
||||
// Таймер перезарядки слайда
|
||||
private float _slideCooldownTimer;
|
||||
// Направление слайда
|
||||
private float _slideTime;
|
||||
private float _cooldownTimer;
|
||||
private Vector3 _slideDirection;
|
||||
// Флаг запроса слайда
|
||||
private bool _slideRequested;
|
||||
|
||||
// Свойство-флаг, активен ли слайд
|
||||
private float _initialSpeed;
|
||||
|
||||
public bool IsSliding { get; private set; }
|
||||
|
||||
// Конструктор механики слайда
|
||||
public SlideMechanic(float slideSpeed, float slideDuration, float slideCooldown)
|
||||
|
||||
public SlideMechanic(AnimationCurve velocityCurve, float slideInitialSpeed, float minVelocityThreshold, float cooldown)
|
||||
{
|
||||
_slideSpeed = slideSpeed;
|
||||
_slideDuration = slideDuration;
|
||||
_slideCooldown = slideCooldown;
|
||||
_velocityCurve = velocityCurve;
|
||||
_initialSpeed = slideInitialSpeed;
|
||||
_minVelocityThreshold = minVelocityThreshold;
|
||||
_cooldown = cooldown;
|
||||
}
|
||||
|
||||
// Обновляем таймер перезарядки слайда
|
||||
public void TickCooldown(float deltaTime)
|
||||
{
|
||||
if (_slideCooldownTimer > 0f)
|
||||
{
|
||||
_slideCooldownTimer -= deltaTime;
|
||||
}
|
||||
if (_cooldownTimer > 0f) _cooldownTimer -= deltaTime;
|
||||
}
|
||||
|
||||
// Обработка слайда
|
||||
public void RequestSlide(bool slidePressed)
|
||||
{
|
||||
if (slidePressed && !_slideRequested && _slideCooldownTimer <= 0f)
|
||||
{
|
||||
if (slidePressed && !_slideRequested && _cooldownTimer <= 0f)
|
||||
_slideRequested = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Начало слайда
|
||||
public void TryStartSlide(KinematicCharacterMotor motor,
|
||||
CameraMode currentCameraMode,
|
||||
Quaternion firstPersonCameraRotation,
|
||||
Vector3 lookInputVector)
|
||||
{
|
||||
// Проверяем условия для старта слайда
|
||||
if (!_slideRequested || !motor.GroundingStatus.IsStableOnGround || _slideCooldownTimer > 0f)
|
||||
if (!_slideRequested || !motor.GroundingStatus.IsStableOnGround || _cooldownTimer > 0f)
|
||||
{
|
||||
_slideRequested = false;
|
||||
return;
|
||||
}
|
||||
|
||||
IsSliding = true;
|
||||
_slideTimer = _slideDuration;
|
||||
|
||||
// НАПРАВЛЕНИЕ СЛАЙДА - ВСЕГДА ВПЕРЕД ПО КАМЕРЕ
|
||||
// Используем направление камеры, но проецируем на горизонтальную плоскость
|
||||
var slideDir = currentCameraMode == CameraMode.FirstPerson ?
|
||||
firstPersonCameraRotation * Vector3.forward :
|
||||
lookInputVector;
|
||||
|
||||
// Проецируем на горизонтальную плоскость и нормализуем
|
||||
_slideDirection = Vector3.ProjectOnPlane(slideDir, motor.CharacterUp).normalized;
|
||||
|
||||
// Если направление нулевое (персонаж стоит на месте), используем направление вперед
|
||||
if (_slideDirection.sqrMagnitude < 0.01f)
|
||||
{
|
||||
_slideDirection = motor.CharacterForward;
|
||||
}
|
||||
_slideTime = 0f;
|
||||
|
||||
// Устанавливаем перезарядку
|
||||
_slideCooldownTimer = _slideCooldown;
|
||||
var dir = currentCameraMode == CameraMode.FirstPerson
|
||||
? firstPersonCameraRotation * Vector3.forward
|
||||
: lookInputVector;
|
||||
|
||||
_slideDirection = Vector3.ProjectOnPlane(dir, motor.CharacterUp).normalized;
|
||||
if (_slideDirection.sqrMagnitude < 0.01f) _slideDirection = motor.CharacterForward;
|
||||
|
||||
_cooldownTimer = _cooldown;
|
||||
_slideRequested = false;
|
||||
}
|
||||
|
||||
// Обработка слайда
|
||||
public void HandleSlide(ref Vector3 currentVelocity, float deltaTime, KinematicCharacterMotor motor)
|
||||
{
|
||||
// Уменьшаем таймер слайда
|
||||
_slideTimer -= deltaTime;
|
||||
if (!IsSliding) return;
|
||||
|
||||
_slideTime += deltaTime;
|
||||
|
||||
// Если время слайда вышло, персонаж в воздухе - заканчиваем слайд
|
||||
if (_slideTimer <= 0f || !motor.GroundingStatus.IsStableOnGround)
|
||||
{
|
||||
var t = Mathf.Clamp01(_slideTime / 2.5f);
|
||||
var speedMult = _velocityCurve.Evaluate(t);
|
||||
|
||||
var targetSpeed = _initialSpeed * speedMult;
|
||||
currentVelocity = _slideDirection * targetSpeed;
|
||||
|
||||
currentVelocity += motor.CharacterUp * 1f;
|
||||
|
||||
if (targetSpeed < _minVelocityThreshold || !motor.GroundingStatus.IsStableOnGround)
|
||||
EndSlide();
|
||||
return;
|
||||
}
|
||||
|
||||
// Устанавливаем скорость слайда вперед
|
||||
// Используем прямую установку скорости вместо сложных вычислений
|
||||
currentVelocity = _slideDirection * _slideSpeed;
|
||||
|
||||
// Добавляем небольшую вертикальную компоненту для лучшего скольжения по неровностям
|
||||
currentVelocity += motor.CharacterUp * 2f;
|
||||
}
|
||||
|
||||
// Завершение слайда
|
||||
public void EndSlide()
|
||||
{
|
||||
IsSliding = false;
|
||||
_slideTimer = 0f;
|
||||
_slideTime = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
+59
-128
@@ -1,147 +1,78 @@
|
||||
using UnityEngine;
|
||||
using KinematicCharacterController;
|
||||
|
||||
namespace Code.Gameplay.Character.Controller.Abilities
|
||||
{
|
||||
/*
|
||||
* Механика наклона персонажа при контакте со стеной
|
||||
* Управляет визуальным наклоном модели в зависимости от высоты подъёма по стене
|
||||
*/
|
||||
public class WallLeanMechanic
|
||||
{
|
||||
private readonly float _maxLeanAngle;
|
||||
private readonly float _leanSharpness;
|
||||
private readonly float _heightScale;
|
||||
|
||||
private Transform _characterTransform;
|
||||
private Vector3 _lastWallNormal;
|
||||
private float _lastWallContactHeight;
|
||||
private float _leanFactor;
|
||||
private float _leanSign;
|
||||
private Vector3 _leanDirection;
|
||||
|
||||
private Vector3 _lastWallContactPoint;
|
||||
private bool _isLeaningOnWall;
|
||||
private const float WallProximityThreshold = 0.6f;
|
||||
private readonly float _leanAngle;
|
||||
private readonly float _threshold;
|
||||
private readonly float _smoothSpeed;
|
||||
|
||||
public WallLeanMechanic(float maxLeanAngle, float leanSharpness, float heightScale)
|
||||
private Transform _model;
|
||||
|
||||
public WallLeanMechanic(
|
||||
float leanAngle,
|
||||
float threshold,
|
||||
float smoothSpeed)
|
||||
{
|
||||
_maxLeanAngle = maxLeanAngle;
|
||||
_leanSharpness = leanSharpness;
|
||||
_heightScale = heightScale;
|
||||
_leanAngle = leanAngle;
|
||||
_threshold = threshold;
|
||||
_smoothSpeed = smoothSpeed;
|
||||
}
|
||||
|
||||
// Назначаем трансформ визуальной модели один раз
|
||||
public void SetCharacterTransform(Transform transform)
|
||||
public void SetModel(Transform model) => _model = model;
|
||||
|
||||
public void Update(bool isWallRunning, Vector3 wallNormal, Vector3 characterForward)
|
||||
{
|
||||
_characterTransform = transform;
|
||||
}
|
||||
|
||||
// Вызывается из OnMovementHit
|
||||
public void OnWallContact(KinematicCharacterMotor motor, Vector3 wallNormal, float contactHeight)
|
||||
{
|
||||
// Только если это действительно стена (не пол/потолок)
|
||||
var dotWithUp = Vector3.Dot(wallNormal, motor.CharacterUp);
|
||||
if (Mathf.Abs(dotWithUp) > 0.7f) // ~45°, можно настроить
|
||||
return;
|
||||
|
||||
_lastWallNormal = wallNormal;
|
||||
_lastWallContactHeight = contactHeight;
|
||||
_lastWallContactPoint = motor.TransientPosition;
|
||||
|
||||
// Пересчитываем направление наклона
|
||||
_leanDirection = -_lastWallNormal;
|
||||
_leanDirection = Vector3.ProjectOnPlane(_leanDirection, motor.CharacterUp).normalized;
|
||||
|
||||
_leanSign = 1;
|
||||
|
||||
// what the fuck
|
||||
if (_leanDirection.x != 0)
|
||||
if (!_model)
|
||||
{
|
||||
switch (_leanDirection.x)
|
||||
{
|
||||
case -1 or 1 when motor.CharacterRight.x > 0.1f:
|
||||
_leanSign = -1;
|
||||
break;
|
||||
case -1 or 1 when Mathf.Abs(motor.CharacterRight.x) < 0.1f:
|
||||
_leanDirection = new Vector3(0, 0, -1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (_leanDirection.z)
|
||||
{
|
||||
case 1 when Mathf.Abs(motor.CharacterRight.z) < 0.1f:
|
||||
_leanSign = -1;
|
||||
break;
|
||||
case -1 when motor.CharacterRight.z < -0.1f:
|
||||
case 1 when motor.CharacterRight.z > 0.1f:
|
||||
_leanDirection = new Vector3(-1, 0, 0);
|
||||
break;
|
||||
case -1 when motor.CharacterRight.z > 0.1f:
|
||||
case 1 when motor.CharacterRight.z < -0.1f:
|
||||
_leanDirection = new Vector3(1, 0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_isLeaningOnWall = true;
|
||||
}
|
||||
|
||||
// Обновление каждый кадр
|
||||
public void UpdateLean(KinematicCharacterMotor motor, float deltaTime)
|
||||
{
|
||||
if (!_characterTransform) return;
|
||||
|
||||
var currentPosition = motor.TransientPosition;
|
||||
|
||||
var isStillNearWall = false;
|
||||
if (_isLeaningOnWall && _lastWallNormal != Vector3.zero)
|
||||
{
|
||||
var toWall = currentPosition - _lastWallContactPoint;
|
||||
var distanceToWallPlane = Mathf.Abs(Vector3.Dot(toWall, _lastWallNormal));
|
||||
isStillNearWall = distanceToWallPlane <= WallProximityThreshold;
|
||||
}
|
||||
|
||||
if (_isLeaningOnWall)
|
||||
{
|
||||
var isBelowContactHeight = currentPosition.y < _lastWallContactHeight;
|
||||
|
||||
if (!isStillNearWall || isBelowContactHeight)
|
||||
{
|
||||
_isLeaningOnWall = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
var heightDelta = currentPosition.y - _lastWallContactHeight;
|
||||
var targetLeanFactor = Mathf.Clamp01(heightDelta * _heightScale);
|
||||
_leanFactor = Mathf.Lerp(_leanFactor, targetLeanFactor, 1f - Mathf.Exp(-_leanSharpness * deltaTime));
|
||||
}
|
||||
}
|
||||
|
||||
if (!_isLeaningOnWall)
|
||||
{
|
||||
_leanFactor = Mathf.Lerp(_leanFactor, 0f, 1f - Mathf.Exp(-_leanSharpness * deltaTime));
|
||||
}
|
||||
|
||||
ApplyLeanRotation(motor);
|
||||
}
|
||||
|
||||
private void ApplyLeanRotation(KinematicCharacterMotor motor)
|
||||
{
|
||||
if (_leanFactor <= 0.01f)
|
||||
{
|
||||
_characterTransform.localRotation = Quaternion.identity;
|
||||
_model.localRotation = Quaternion.identity;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_leanDirection.sqrMagnitude < 0.01f) return;
|
||||
var targetRotation = Quaternion.identity;
|
||||
|
||||
var leanAngle = _leanSign * _leanFactor * _maxLeanAngle;
|
||||
var leanAxis = Vector3.Cross(motor.CharacterUp, _leanDirection);
|
||||
var leanRotation = Quaternion.AngleAxis(leanAngle, leanAxis);
|
||||
_characterTransform.localRotation = leanRotation;
|
||||
if (isWallRunning)
|
||||
{
|
||||
var n = new Vector3(wallNormal.x, 0f, wallNormal.z).normalized;
|
||||
if (n.sqrMagnitude < 0.001f) n = Vector3.forward;
|
||||
|
||||
var bodyRight = Vector3.Cross(Vector3.up, characterForward).normalized;
|
||||
var side = Vector3.Dot(n, bodyRight);
|
||||
var front = Vector3.Dot(n, characterForward);
|
||||
|
||||
var axis = Vector3.right;
|
||||
var angle = 0f;
|
||||
|
||||
if (side > _threshold)
|
||||
{
|
||||
axis = Vector3.forward;
|
||||
angle = -_leanAngle;
|
||||
}
|
||||
else if (side < -_threshold)
|
||||
{
|
||||
axis = Vector3.forward;
|
||||
angle = _leanAngle;
|
||||
}
|
||||
else if (front > _threshold)
|
||||
{
|
||||
axis = Vector3.right;
|
||||
angle = -_leanAngle;
|
||||
}
|
||||
else if (front < -_threshold)
|
||||
{
|
||||
axis = Vector3.right;
|
||||
angle = _leanAngle;
|
||||
}
|
||||
|
||||
targetRotation = Quaternion.AngleAxis(angle, axis);
|
||||
}
|
||||
|
||||
_model.localRotation = Quaternion.Slerp(
|
||||
_model.localRotation,
|
||||
targetRotation,
|
||||
1f - Mathf.Exp(-_smoothSpeed * Time.deltaTime)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
+244
@@ -0,0 +1,244 @@
|
||||
using Code.Gameplay.Character.Core;
|
||||
using KinematicCharacterController;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Gameplay.Character.Controller.Abilities
|
||||
{
|
||||
public class WallRunningMechanic
|
||||
{
|
||||
private readonly float _maxWallRunTime;
|
||||
private readonly float _maxWallRunNoMoveTime;
|
||||
private readonly float _wallRunSpeed;
|
||||
private readonly float _wallRunAcceleration;
|
||||
private readonly float _wallRunGravityScale;
|
||||
private readonly float _wallDetachImpulse;
|
||||
private readonly float _wallContactAngleThreshold;
|
||||
|
||||
private float _wallRunTimer;
|
||||
private float _wallRunNoMoveTimer;
|
||||
private Vector3 _wallNormal;
|
||||
private Vector3 _wallTangentRight;
|
||||
private Vector3 _wallContactPoint;
|
||||
private Vector3 _lastMoveInputInWallSpace;
|
||||
|
||||
private float _surfaceAngleCos;
|
||||
private bool _canWallRun;
|
||||
|
||||
private KinematicCharacterMotor _motor;
|
||||
|
||||
public bool IsWallRunning { get; private set; }
|
||||
|
||||
public WallRunningMechanic(
|
||||
float maxWallRunTime,
|
||||
float maxWallRunNoMoveTime,
|
||||
float wallRunSpeed,
|
||||
float wallRunAcceleration,
|
||||
float wallRunGravityScale,
|
||||
float wallDetachImpulse,
|
||||
float wallContactAngleThreshold)
|
||||
{
|
||||
_maxWallRunTime = maxWallRunTime;
|
||||
_maxWallRunNoMoveTime = maxWallRunNoMoveTime;
|
||||
_wallRunSpeed = wallRunSpeed;
|
||||
_wallRunAcceleration = wallRunAcceleration;
|
||||
_wallRunGravityScale = wallRunGravityScale;
|
||||
_wallDetachImpulse = wallDetachImpulse;
|
||||
_wallContactAngleThreshold = wallContactAngleThreshold;
|
||||
}
|
||||
|
||||
public void Initialize(KinematicCharacterMotor motor)
|
||||
{
|
||||
_motor = motor;
|
||||
_surfaceAngleCos = Mathf.Cos(Mathf.Deg2Rad * _wallContactAngleThreshold);
|
||||
}
|
||||
|
||||
public void Tick(float deltaTime)
|
||||
{
|
||||
if (!IsWallRunning) return;
|
||||
|
||||
_wallRunTimer += deltaTime;
|
||||
_wallRunNoMoveTimer += deltaTime;
|
||||
|
||||
if (!(_wallRunTimer > _maxWallRunTime) && !(_wallRunNoMoveTimer > _maxWallRunNoMoveTime)) return;
|
||||
|
||||
DetachFromWall(false);
|
||||
_wallRunNoMoveTimer = 0;
|
||||
}
|
||||
|
||||
public bool TryStartWallRun(Vector3 hitNormal, Vector3 hitPoint)
|
||||
{
|
||||
if (IsWallRunning) return false;
|
||||
|
||||
if (_motor.CharacterController is not CustomCharacterController { IsAbilitiesBlocked: false }) return false;
|
||||
|
||||
var dotWithUp = Vector3.Dot(hitNormal, _motor.CharacterUp);
|
||||
var isWall = Mathf.Abs(dotWithUp) < _surfaceAngleCos;
|
||||
|
||||
if (!isWall) return false;
|
||||
|
||||
if (_motor.GroundingStatus.IsStableOnGround) return false;
|
||||
|
||||
var velocityIntoWall = Vector3.Dot(_motor.Velocity, -hitNormal);
|
||||
if (velocityIntoWall < 1f) return false;
|
||||
|
||||
StartWallRun(hitNormal, hitPoint);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void StartWallRun(Vector3 wallNormal, Vector3 contactPoint)
|
||||
{
|
||||
IsWallRunning = true;
|
||||
_wallRunTimer = 0f;
|
||||
_wallNormal = wallNormal.normalized;
|
||||
_wallContactPoint = contactPoint;
|
||||
|
||||
var forwardInWallPlane = Vector3.ProjectOnPlane(_motor.CharacterForward, _wallNormal).normalized;
|
||||
if (forwardInWallPlane.sqrMagnitude < 0.01f)
|
||||
{
|
||||
var candidateRight = Vector3.Cross(_wallNormal, _motor.CharacterUp);
|
||||
candidateRight = Vector3.ProjectOnPlane(candidateRight, _wallNormal).normalized;
|
||||
|
||||
if (candidateRight.sqrMagnitude < 0.01f)
|
||||
{
|
||||
candidateRight = Vector3.Cross(_wallNormal, Vector3.up);
|
||||
candidateRight = Vector3.ProjectOnPlane(candidateRight, _wallNormal).normalized;
|
||||
}
|
||||
|
||||
if (candidateRight.sqrMagnitude < 0.01f)
|
||||
{
|
||||
candidateRight = Vector3.Cross(_wallNormal, Vector3.right).normalized;
|
||||
}
|
||||
|
||||
var dotWithRight = Vector3.Dot(_motor.CharacterRight, _wallNormal);
|
||||
forwardInWallPlane = dotWithRight < 0 ? candidateRight : -candidateRight;
|
||||
}
|
||||
|
||||
_wallTangentRight = forwardInWallPlane.normalized;
|
||||
|
||||
_motor.ForceUnground();
|
||||
}
|
||||
|
||||
public void HandleWallRun(ref Vector3 currentVelocity, CharacterInputs inputs, float deltaTime)
|
||||
{
|
||||
if (!IsWallRunning) return;
|
||||
if (!IsWallStillPresent()) { DetachFromWall(false); return; }
|
||||
|
||||
var forwardInput = inputs.MoveAxisForward;
|
||||
if (forwardInput != 0) _wallRunNoMoveTimer = 0f;
|
||||
var moveDirection = _wallTangentRight * forwardInput;
|
||||
|
||||
var targetSpeed = moveDirection.sqrMagnitude > 0.01f ? _wallRunSpeed : currentVelocity.magnitude;
|
||||
var targetVelocity = moveDirection.normalized * targetSpeed;
|
||||
|
||||
currentVelocity = Vector3.Lerp(
|
||||
currentVelocity,
|
||||
targetVelocity,
|
||||
1f - Mathf.Exp(-_wallRunAcceleration * deltaTime)
|
||||
);
|
||||
|
||||
currentVelocity += Physics.gravity * (_wallRunGravityScale * deltaTime);
|
||||
|
||||
var distanceToWall = Vector3.Dot(_motor.TransientPosition - _wallContactPoint, _wallNormal);
|
||||
if (Mathf.Abs(distanceToWall) > 0.8f)
|
||||
{
|
||||
DetachFromWall(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (inputs.JumpPressed)
|
||||
{
|
||||
DetachFromWall(true);
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsWallStillPresent()
|
||||
{
|
||||
if (!_motor) return false;
|
||||
|
||||
if (_motor.GroundingStatus.IsStableOnGround) return false;
|
||||
|
||||
var characterCenter = _motor.TransientPosition;
|
||||
var characterRight = _motor.CharacterRight;
|
||||
var characterUp = _motor.CharacterUp;
|
||||
|
||||
const float checkDistance = 0.45f;
|
||||
var rayOrigin = characterCenter + characterUp * 0.2f;
|
||||
var rayDir = -_wallNormal;
|
||||
|
||||
Vector3[] offsets = {
|
||||
Vector3.zero,
|
||||
characterUp * 0.3f,
|
||||
-characterUp * 0.3f,
|
||||
characterRight * 0.2f,
|
||||
-characterRight * 0.2f
|
||||
};
|
||||
|
||||
foreach (var offset in offsets)
|
||||
{
|
||||
if (!Physics.Raycast(rayOrigin + offset, rayDir, out var hit, checkDistance,
|
||||
_motor.CollidableLayers, QueryTriggerInteraction.Ignore)) continue;
|
||||
|
||||
var dotWithUp = Mathf.Abs(Vector3.Dot(hit.normal, characterUp));
|
||||
|
||||
if (!(dotWithUp < _surfaceAngleCos)) continue;
|
||||
|
||||
_wallNormal = hit.normal.normalized;
|
||||
_wallContactPoint = hit.point;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void DetachFromWall(bool withImpulse)
|
||||
{
|
||||
if (!IsWallRunning) return;
|
||||
|
||||
IsWallRunning = false;
|
||||
|
||||
if (!withImpulse || !_motor) return;
|
||||
|
||||
var detachImpulse = -_wallNormal * _wallDetachImpulse;
|
||||
_motor.BaseVelocity += detachImpulse;
|
||||
}
|
||||
|
||||
public Vector3 GetWallNormal() => _wallNormal;
|
||||
|
||||
public void PerformWallJump(CharacterInputs inputs, Quaternion cameraRotation)
|
||||
{
|
||||
if (!IsWallRunning || !_motor) return;
|
||||
|
||||
if (_motor.CharacterController is not CustomCharacterController { IsAbilitiesBlocked: false } controller)
|
||||
return;
|
||||
|
||||
IsWallRunning = false;
|
||||
|
||||
var wallAway = _wallNormal;
|
||||
var wallUp = Vector3.ProjectOnPlane(_motor.CharacterUp, _wallNormal).normalized;
|
||||
|
||||
var playerForward = cameraRotation * Vector3.forward;
|
||||
|
||||
var forwardInWallPlane = Vector3.ProjectOnPlane(playerForward, _wallNormal).normalized;
|
||||
if (forwardInWallPlane.sqrMagnitude < 0.01f) forwardInWallPlane = _wallTangentRight;
|
||||
|
||||
var jumpDirection =
|
||||
forwardInWallPlane * 0.2f +
|
||||
wallAway * 0.6f +
|
||||
wallUp * 0.2f;
|
||||
|
||||
jumpDirection = jumpDirection.normalized;
|
||||
|
||||
var wallJumpForce = _wallDetachImpulse * 2f;
|
||||
|
||||
var jumpImpulse = jumpDirection * wallJumpForce;
|
||||
|
||||
_motor.BaseVelocity += jumpImpulse;
|
||||
|
||||
_motor.SetPosition(_motor.TransientPosition + wallAway * 0.07f);
|
||||
|
||||
controller.TriggerJump();
|
||||
controller.BlockAbilities(0.12f);
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4bef67aa9cf14753a63ea07eecc5ff67
|
||||
timeCreated: 1764263348
|
||||
+265
-117
@@ -15,7 +15,7 @@ namespace Code.Gameplay.Character.Controller
|
||||
* Реализует физическое движение персонажа с использованием Kinematic Character Controller
|
||||
* Обрабатывает ввод пользователя, применяет движение и вращение с учетом поверхности
|
||||
*
|
||||
* Источник: Tvtig, https://www.youtube.com/watch?v=9ibpY64wBYM
|
||||
* Источник: Tvtig, https://www.youtube.com/watch?v=9ibpY64wBYM
|
||||
*/
|
||||
public class CustomCharacterController : MonoBehaviour, ICharacterController
|
||||
{
|
||||
@@ -25,205 +25,242 @@ namespace Code.Gameplay.Character.Controller
|
||||
|
||||
[SerializeField] private Transform characterTransform; // Трансформ персонажа (с точкой отслеживания камеры)
|
||||
|
||||
[SerializeField] private CapsuleCollider _capsuleCollider;
|
||||
[SerializeField] private Transform _cameraFollowPoint;
|
||||
private Vector3 _originalColliderCenter;
|
||||
private float _originalColliderHeight;
|
||||
private Vector3 _originalFollowPointLocalPosition;
|
||||
private bool _isEnteringSlide;
|
||||
private bool _isExitingSlide;
|
||||
private float _slideTransitionTime;
|
||||
private float _slideTransitionDuration;
|
||||
private float _currentColliderHeight;
|
||||
private Vector3 _currentColliderCenter;
|
||||
private Vector3 _currentFollowPointLocalPosition;
|
||||
private bool _wasSlidingLastFrame;
|
||||
|
||||
private float _jumpCooldownTimer;
|
||||
private float JumpCooldownDuration => _characterConfig.jumpCooldown;
|
||||
|
||||
public bool CanJump => _jumpCooldownTimer <= 0f;
|
||||
|
||||
// Подсистемы
|
||||
private CharacterInputHandler _inputHandler;
|
||||
private DashMechanic _dashMechanic;
|
||||
private SlideMechanic _slideMechanic;
|
||||
private WallClimbMechanic _wallClimbMechanic;
|
||||
// private WallClimbMechanic _wallClimbMechanic;
|
||||
private WallRunningMechanic _wallRunningMechanic;
|
||||
private WallLeanMechanic _wallLeanMechanic;
|
||||
private GroundMovementSystem _groundMovement;
|
||||
private AirMovementSystem _airMovement;
|
||||
|
||||
public bool IsSliding => _slideMechanic.IsSliding;
|
||||
public bool IsDashing => _dashMechanic.IsDashing;
|
||||
public bool IsWallRunning => _wallRunningMechanic.IsWallRunning;
|
||||
|
||||
private float abilityBlockTimer;
|
||||
private bool isAbilitiesBlocked;
|
||||
public bool IsAbilitiesBlocked { get; private set; }
|
||||
|
||||
private CharacterInputs _lastInputs;
|
||||
|
||||
public void SetPosition(Vector3 position) => motor.SetPosition(position);
|
||||
public void SetRotation(Quaternion rotation) => motor.SetRotation(rotation);
|
||||
|
||||
// Инициализация контроллера
|
||||
// private void Awake()
|
||||
// {
|
||||
// // Инициализация подсистем с параметрами из конфига
|
||||
// _inputHandler = new CharacterInputHandler(
|
||||
// _characterConfig.sprintAngleThreshold
|
||||
// );
|
||||
// _slideMechanic = new SlideMechanic(
|
||||
// _characterConfig.slideSpeed,
|
||||
// _characterConfig.slideDuration,
|
||||
// _characterConfig.slideCooldown
|
||||
// );
|
||||
// _wallClimbMechanic = new WallClimbMechanic(
|
||||
// _characterConfig.wallClimbSpeedFactor,
|
||||
// _characterConfig.minWallClimbSpeed,
|
||||
// _characterConfig.wallDetectionAngleThreshold
|
||||
// );
|
||||
// _wallLeanMechanic = new WallLeanMechanic(
|
||||
// _characterConfig.maxWallLeanAngle,
|
||||
// _characterConfig.wallLeanSharpness,
|
||||
// _characterConfig.wallLeanHeightScale
|
||||
// );
|
||||
// _groundMovement = new GroundMovementSystem(
|
||||
// _characterConfig.maxStableMoveSpeed,
|
||||
// _characterConfig.sprintMoveSpeed,
|
||||
// _characterConfig.stableMovementSharpness,
|
||||
// _characterConfig.jumpSpeed
|
||||
// );
|
||||
// _airMovement = new AirMovementSystem(_characterConfig.gravity);
|
||||
// }
|
||||
[Inject]
|
||||
private void Construct(CharacterConfig characterConfig)
|
||||
{
|
||||
_characterConfig = characterConfig;
|
||||
// Инициализация подсистем с параметрами из конфига
|
||||
_inputHandler = new CharacterInputHandler(
|
||||
_characterConfig.sprintAngleThreshold
|
||||
_inputHandler = new CharacterInputHandler();
|
||||
_dashMechanic = new DashMechanic(
|
||||
_characterConfig.dashSpeed,
|
||||
_characterConfig.dashDuration,
|
||||
_characterConfig.dashCooldown
|
||||
);
|
||||
_slideMechanic = new SlideMechanic(
|
||||
_characterConfig.slideSpeed,
|
||||
_characterConfig.slideDuration,
|
||||
_characterConfig.slideVelocityCurve,
|
||||
_characterConfig.slideInitialSpeed,
|
||||
_characterConfig.slideMinVelocityThreshold,
|
||||
_characterConfig.slideCooldown
|
||||
);
|
||||
_wallClimbMechanic = new WallClimbMechanic(
|
||||
_characterConfig.wallClimbSpeedFactor,
|
||||
_characterConfig.minWallClimbSpeed,
|
||||
_characterConfig.wallDetectionAngleThreshold
|
||||
_wallRunningMechanic = new WallRunningMechanic(
|
||||
_characterConfig.wallRunMaxTime,
|
||||
_characterConfig.wallRunMaxNoMoveTime,
|
||||
_characterConfig.wallRunSpeed,
|
||||
_characterConfig.wallRunAcceleration,
|
||||
_characterConfig.wallRunGravityScale,
|
||||
_characterConfig.wallDetachImpulse,
|
||||
_characterConfig.wallContactAngleThreshold
|
||||
);
|
||||
_wallLeanMechanic = new WallLeanMechanic(
|
||||
_characterConfig.maxWallLeanAngle,
|
||||
_characterConfig.wallLeanSharpness,
|
||||
_characterConfig.wallLeanHeightScale
|
||||
);
|
||||
_characterConfig.leanAngle,
|
||||
_characterConfig.leanThreshold,
|
||||
_characterConfig.leanSmoothSpeed
|
||||
);
|
||||
_groundMovement = new GroundMovementSystem(
|
||||
_characterConfig.maxStableMoveSpeed,
|
||||
_characterConfig.sprintMoveSpeed,
|
||||
_characterConfig.stableMovementSharpness,
|
||||
_characterConfig.jumpSpeed
|
||||
);
|
||||
_airMovement = new AirMovementSystem(_characterConfig.gravity);
|
||||
|
||||
_airMovement = new AirMovementSystem(
|
||||
_characterConfig.gravity,
|
||||
_characterConfig.maxAirSpeed,
|
||||
_characterConfig.airControlSharpness
|
||||
);
|
||||
|
||||
motor.CharacterController = this; // Регистрация этого контроллера в движке
|
||||
_inputHandler.FirstPersonCameraRotation =
|
||||
motor.Transform.rotation; // Начальное вращение совпадает с персонажемс
|
||||
_wallLeanMechanic.SetCharacterTransform(characterTransform);
|
||||
_wallLeanMechanic.SetModel(characterTransform);
|
||||
_wallRunningMechanic.Initialize(motor);
|
||||
|
||||
_originalColliderCenter = _capsuleCollider.center;
|
||||
_originalColliderHeight = _capsuleCollider.height;
|
||||
_originalFollowPointLocalPosition = _cameraFollowPoint.localPosition;
|
||||
|
||||
_currentColliderHeight = _originalColliderHeight;
|
||||
_currentColliderCenter = _originalColliderCenter;
|
||||
_currentFollowPointLocalPosition = _originalFollowPointLocalPosition;
|
||||
}
|
||||
|
||||
// Текущий режим камеры для адаптации поведения
|
||||
private CameraMode _currentCameraMode = CameraMode.FirstPerson;
|
||||
|
||||
// Инициализация контроллера
|
||||
// private void Start()
|
||||
// {
|
||||
// motor.CharacterController = this; // Регистрация этого контроллера в движке
|
||||
// _inputHandler.FirstPersonCameraRotation =
|
||||
// motor.Transform.rotation; // Начальное вращение совпадает с персонажемс
|
||||
// _wallLeanMechanic.SetCharacterTransform(characterTransform);
|
||||
// }
|
||||
|
||||
// Обработка и преобразование входных данных от персонажа
|
||||
public void SetInputs(ref CharacterInputs inputs)
|
||||
{
|
||||
// Обновляем таймер перезарядки слайда
|
||||
_lastInputs = inputs;
|
||||
_dashMechanic.TickCooldown(Time.deltaTime);
|
||||
_slideMechanic.TickCooldown(Time.deltaTime);
|
||||
_wallClimbMechanic.TickCooldown(Time.deltaTime);
|
||||
_wallRunningMechanic.Tick(Time.deltaTime);
|
||||
|
||||
// Если активен слайд - игнорируем весь остальной ввод
|
||||
if (_slideMechanic.IsSliding)
|
||||
if (_dashMechanic.IsDashing || _slideMechanic.IsSliding)
|
||||
{
|
||||
// Во время слайда не обрабатываем движение, прыжки и спринт
|
||||
_inputHandler.MoveInputVector = Vector3.zero;
|
||||
_inputHandler.LookInputVector = Vector3.one;
|
||||
_inputHandler.IsSprinting = false;
|
||||
_groundMovement.RequestJump(inputs.JumpPressed);
|
||||
return;
|
||||
}
|
||||
|
||||
// Сохраняем текущий режим камеры
|
||||
_currentCameraMode = inputs.CameraMode;
|
||||
|
||||
if (isAbilitiesBlocked)
|
||||
if (IsAbilitiesBlocked)
|
||||
{
|
||||
abilityBlockTimer -= Time.deltaTime;
|
||||
if (abilityBlockTimer <= 0)
|
||||
{
|
||||
isAbilitiesBlocked = false;
|
||||
IsAbilitiesBlocked = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
inputs.SprintPressed = false;
|
||||
inputs.DashPressed = false;
|
||||
inputs.SlidePressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Обработка слайда
|
||||
_dashMechanic.RequestDash(inputs.DashPressed);
|
||||
_slideMechanic.RequestSlide(inputs.SlidePressed);
|
||||
|
||||
// Обработка остального ввода
|
||||
_inputHandler.ProcessInputs(ref inputs, motor);
|
||||
|
||||
// Передаём запрос прыжка напрямую в систему движения по земле
|
||||
_groundMovement.RequestJump(inputs.JumpPressed);
|
||||
// Передаём запрос прыжка
|
||||
var jumpInput = inputs.JumpPressed;
|
||||
|
||||
if (jumpInput && CanJump)
|
||||
{
|
||||
_groundMovement.RequestJump(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_groundMovement.RequestJump(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Обновление вращения персонажа на основе входных данных
|
||||
public void UpdateRotation(ref Quaternion currentRotation, float deltaTime)
|
||||
{
|
||||
if (_slideMechanic.IsSliding || _wallClimbMechanic.IsClimbingActive) return;
|
||||
if (_slideMechanic.IsSliding) return;
|
||||
|
||||
switch (_currentCameraMode)
|
||||
{
|
||||
// В FirstPerson режиме применяем вращение камеры напрямую к персонажу (только горизонталь)
|
||||
case CameraMode.FirstPerson when _inputHandler.ShouldApplyCameraRotation:
|
||||
// Немедленно применяем горизонтальное вращение камеры к персонажу
|
||||
currentRotation = _inputHandler.FirstPersonCameraRotation;
|
||||
break;
|
||||
// В ThirdPerson режиме плавно поворачиваем персонаж в направлении движения
|
||||
case CameraMode.ThirdPerson:
|
||||
{
|
||||
// Вращение применяется только если есть направление движения и разрешена резкость вращения
|
||||
if (_inputHandler.LookInputVector.sqrMagnitude > 0 && _characterConfig.orientationSharpness > 0)
|
||||
{
|
||||
// Плавная интерполяция текущего направления к целевому с экспоненциальным сглаживанием
|
||||
var smoothedLookInputDirection = Vector3.Slerp(
|
||||
motor.CharacterForward,
|
||||
_inputHandler.LookInputVector,
|
||||
1f - Mathf.Exp(-_characterConfig.orientationSharpness * deltaTime)
|
||||
).normalized;
|
||||
|
||||
// Установка нового вращения смотря в сглаженном направлении
|
||||
currentRotation = Quaternion.LookRotation(smoothedLookInputDirection, motor.CharacterUp);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
// Заготовка на будущее (если понадобится)
|
||||
case CameraMode.Static:
|
||||
case CameraMode.Cinematic:
|
||||
case CameraMode.Bogdan: // Скорее всего юзлес, но пускай будет
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Обновление скорости движения персонажа
|
||||
public void UpdateVelocity(ref Vector3 currentVelocity, float deltaTime)
|
||||
{
|
||||
// Если во время слайда запрошен прыжок — прерываем слайд
|
||||
if (_dashMechanic.IsDashing && _groundMovement.JumpRequested)
|
||||
_dashMechanic.EndDash();
|
||||
if (_slideMechanic.IsSliding && _groundMovement.JumpRequested)
|
||||
{
|
||||
_slideMechanic.EndSlide();
|
||||
}
|
||||
|
||||
// Проверяем запрос слайда и запускаем его если можно
|
||||
if (!_slideMechanic.IsSliding)
|
||||
{
|
||||
_slideMechanic.TryStartSlide(motor, _currentCameraMode, _inputHandler.FirstPersonCameraRotation,
|
||||
_inputHandler.LookInputVector);
|
||||
}
|
||||
// Если активен слайд - обрабатываем отдельно
|
||||
if (!_dashMechanic.IsDashing)
|
||||
_dashMechanic.TryStartDash(motor, _currentCameraMode, _inputHandler.FirstPersonCameraRotation, _inputHandler.LookInputVector);
|
||||
else
|
||||
{
|
||||
_dashMechanic.HandleDash(ref currentVelocity, deltaTime, motor);
|
||||
return;
|
||||
}
|
||||
|
||||
var wasSliding = _wasSlidingLastFrame;
|
||||
var isSlidingNow = _slideMechanic.IsSliding;
|
||||
|
||||
if (!isSlidingNow)
|
||||
{
|
||||
_slideMechanic.TryStartSlide(motor, _currentCameraMode, _inputHandler.FirstPersonCameraRotation, _inputHandler.LookInputVector);
|
||||
isSlidingNow = _slideMechanic.IsSliding;
|
||||
}
|
||||
|
||||
switch (isSlidingNow)
|
||||
{
|
||||
case true when !wasSliding:
|
||||
EnterSlideState();
|
||||
break;
|
||||
case false when wasSliding:
|
||||
ExitSlideState();
|
||||
break;
|
||||
}
|
||||
|
||||
if (isSlidingNow)
|
||||
{
|
||||
_slideMechanic.HandleSlide(ref currentVelocity, deltaTime, motor);
|
||||
}
|
||||
|
||||
_wasSlidingLastFrame = isSlidingNow;
|
||||
|
||||
// === WALL RUNNING: обработка состояния ===
|
||||
if (_wallRunningMechanic.IsWallRunning)
|
||||
{
|
||||
// 🔄 Передаём актуальные данные для walljump
|
||||
if (_groundMovement.JumpRequested) // или _lastInputs.JumpPressed — зависит от логики
|
||||
{
|
||||
_wallRunningMechanic.PerformWallJump(_lastInputs, _inputHandler.FirstPersonCameraRotation);
|
||||
_groundMovement.CancelJumpRequest(); // сброс, чтобы не сработало дважды
|
||||
}
|
||||
else
|
||||
{
|
||||
_wallRunningMechanic.HandleWallRun(ref currentVelocity, _lastInputs, deltaTime);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -232,75 +269,186 @@ namespace Code.Gameplay.Character.Controller
|
||||
{
|
||||
_groundMovement.UpdateVelocity(ref currentVelocity, _inputHandler, motor, deltaTime);
|
||||
}
|
||||
// Если персонаж не находится на земле
|
||||
// Если персонаж не на земле — стандартное воздушное движение
|
||||
else
|
||||
{
|
||||
_airMovement.UpdateVelocity(ref currentVelocity, deltaTime);
|
||||
// Отменяем прыжок (фикс проблемы с двойным прыжком после приземления)
|
||||
_airMovement.UpdateVelocity(ref currentVelocity, _inputHandler, motor, deltaTime);
|
||||
_groundMovement.CancelJumpRequest();
|
||||
}
|
||||
}
|
||||
|
||||
public void BlockAbilities(float duration)
|
||||
{
|
||||
isAbilitiesBlocked = true;
|
||||
IsAbilitiesBlocked = true;
|
||||
abilityBlockTimer = duration;
|
||||
}
|
||||
|
||||
private void EnterSlideState()
|
||||
{
|
||||
_isEnteringSlide = true;
|
||||
_isExitingSlide = false;
|
||||
_slideTransitionTime = 0f;
|
||||
_slideTransitionDuration = _characterConfig.slideEnterDuration;
|
||||
}
|
||||
|
||||
private void ExitSlideState()
|
||||
{
|
||||
_isExitingSlide = true;
|
||||
_isEnteringSlide = false;
|
||||
_slideTransitionTime = 0f;
|
||||
_slideTransitionDuration = _characterConfig.slideExitDuration;
|
||||
}
|
||||
|
||||
private void UpdateSlideTransition(float deltaTime)
|
||||
{
|
||||
if (!_isEnteringSlide && !_isExitingSlide) return;
|
||||
|
||||
_slideTransitionTime += deltaTime;
|
||||
var t = Mathf.Clamp01(_slideTransitionTime / _slideTransitionDuration);
|
||||
|
||||
t = Mathf.SmoothStep(0f, 1f, t);
|
||||
|
||||
if (_isEnteringSlide)
|
||||
{
|
||||
var targetHeight = _originalColliderHeight * _characterConfig.slideColliderHeightScale;
|
||||
var targetCenterY = targetHeight * 0.5f - _originalColliderHeight * 0.5f;
|
||||
var targetCenter = _originalColliderCenter + Vector3.up * targetCenterY;
|
||||
|
||||
var targetFollowPos = _originalFollowPointLocalPosition + Vector3.up * _characterConfig.slideCameraOffsetY;
|
||||
|
||||
_currentColliderHeight = Mathf.Lerp(_originalColliderHeight, targetHeight, t);
|
||||
_currentColliderCenter = Vector3.Lerp(_originalColliderCenter, targetCenter, t);
|
||||
_currentFollowPointLocalPosition = Vector3.Lerp(_originalFollowPointLocalPosition, targetFollowPos, t);
|
||||
}
|
||||
else if (_isExitingSlide)
|
||||
{
|
||||
_currentColliderHeight = Mathf.Lerp(_originalColliderHeight * _characterConfig.slideColliderHeightScale, _originalColliderHeight, t);
|
||||
|
||||
var prevHeight = _originalColliderHeight * _characterConfig.slideColliderHeightScale;
|
||||
var prevCenterY = prevHeight * 0.5f - _originalColliderHeight * 0.5f;
|
||||
var prevCenter = _originalColliderCenter + Vector3.up * prevCenterY;
|
||||
|
||||
var prevFollowPos = _originalFollowPointLocalPosition + Vector3.up * _characterConfig.slideCameraOffsetY;
|
||||
|
||||
_currentColliderCenter = Vector3.Lerp(prevCenter, _originalColliderCenter, t);
|
||||
_currentFollowPointLocalPosition = Vector3.Lerp(prevFollowPos, _originalFollowPointLocalPosition, t);
|
||||
}
|
||||
|
||||
if (_capsuleCollider)
|
||||
{
|
||||
_capsuleCollider.height = _currentColliderHeight;
|
||||
_capsuleCollider.center = _currentColliderCenter;
|
||||
}
|
||||
|
||||
if (_cameraFollowPoint)
|
||||
{
|
||||
_cameraFollowPoint.localPosition = _currentFollowPointLocalPosition;
|
||||
}
|
||||
|
||||
if (!(t >= 1f)) return;
|
||||
|
||||
if (_isEnteringSlide)
|
||||
{
|
||||
_isEnteringSlide = false;
|
||||
if (_capsuleCollider)
|
||||
{
|
||||
_capsuleCollider.height = _originalColliderHeight * _characterConfig.slideColliderHeightScale;
|
||||
var h = _capsuleCollider.height;
|
||||
_capsuleCollider.center = _originalColliderCenter + Vector3.up * (h * 0.5f - _originalColliderHeight * 0.5f);
|
||||
}
|
||||
if (_cameraFollowPoint)
|
||||
{
|
||||
_cameraFollowPoint.localPosition = _originalFollowPointLocalPosition + Vector3.up * _characterConfig.slideCameraOffsetY;
|
||||
}
|
||||
}
|
||||
else if (_isExitingSlide)
|
||||
{
|
||||
_isExitingSlide = false;
|
||||
if (_capsuleCollider)
|
||||
{
|
||||
_capsuleCollider.height = _originalColliderHeight;
|
||||
_capsuleCollider.center = _originalColliderCenter;
|
||||
}
|
||||
if (_cameraFollowPoint)
|
||||
{
|
||||
_cameraFollowPoint.localPosition = _originalFollowPointLocalPosition;
|
||||
}
|
||||
}
|
||||
|
||||
_currentColliderHeight = _capsuleCollider ? _capsuleCollider.height : _originalColliderHeight;
|
||||
_currentColliderCenter = _capsuleCollider ? _capsuleCollider.center : _originalColliderCenter;
|
||||
_currentFollowPointLocalPosition = _cameraFollowPoint ? _cameraFollowPoint.localPosition : _originalFollowPointLocalPosition;
|
||||
}
|
||||
|
||||
public void TriggerJump()
|
||||
{
|
||||
_jumpCooldownTimer = JumpCooldownDuration;
|
||||
}
|
||||
|
||||
// Метод вызывается перед обновлением персонажа (можно использовать для подготовки)
|
||||
public void BeforeCharacterUpdate(float deltaTime)
|
||||
{
|
||||
}
|
||||
|
||||
// Метод вызывается после обработки столкновения с землей
|
||||
public void PostGroundingUpdate(float deltaTime)
|
||||
{
|
||||
// Если во время слайда персонаж оторвался от земли - заканчиваем слайд
|
||||
if (_dashMechanic.IsDashing && !motor.GroundingStatus.IsStableOnGround)
|
||||
_dashMechanic.EndDash();
|
||||
if (_slideMechanic.IsSliding && !motor.GroundingStatus.IsStableOnGround)
|
||||
{
|
||||
_slideMechanic.EndSlide();
|
||||
}
|
||||
|
||||
if (motor.GroundingStatus.IsStableOnGround)
|
||||
{
|
||||
_wallClimbMechanic.ResetWallClimbSession();
|
||||
}
|
||||
}
|
||||
|
||||
// Метод вызывается после обновления персонажа
|
||||
public void AfterCharacterUpdate(float deltaTime)
|
||||
{
|
||||
_wallLeanMechanic.UpdateLean(motor, deltaTime);
|
||||
UpdateSlideTransition(deltaTime);
|
||||
|
||||
_jumpCooldownTimer -= deltaTime;
|
||||
if (_jumpCooldownTimer < 0f) _jumpCooldownTimer = 0f;
|
||||
|
||||
_wallLeanMechanic.Update(
|
||||
_wallRunningMechanic.IsWallRunning,
|
||||
_wallRunningMechanic.GetWallNormal(),
|
||||
motor.CharacterForward
|
||||
);
|
||||
}
|
||||
|
||||
// Проверка валидности коллайдера для обработки столкновений
|
||||
public bool IsColliderValidForCollisions(Collider coll)
|
||||
{
|
||||
return true; // Все коллайдеры считаются валидными для столкновений
|
||||
return true;
|
||||
}
|
||||
|
||||
// Обработка столкновения с землей (вызывается при приземлении)
|
||||
public void OnGroundHit(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint,
|
||||
ref HitStabilityReport hitStabilityReport)
|
||||
{
|
||||
}
|
||||
|
||||
// Обработка столкновения при движении (вызывается при ударе о препятствие)
|
||||
public void OnMovementHit(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint,
|
||||
ref HitStabilityReport hitStabilityReport)
|
||||
{
|
||||
if (_wallClimbMechanic.TryClimbWall(motor, hitNormal))
|
||||
_wallLeanMechanic.OnWallContact(motor, hitNormal, motor.TransientPosition.y);
|
||||
if (_wallRunningMechanic.TryStartWallRun(hitNormal, hitPoint)) return;
|
||||
|
||||
var horizontalVelocity = Vector3.ProjectOnPlane(motor.Velocity, motor.CharacterUp).normalized;
|
||||
var velocitySqrMag = horizontalVelocity.sqrMagnitude;
|
||||
|
||||
if (!(velocitySqrMag > 0.01f)) return;
|
||||
|
||||
var dot = Vector3.Dot(horizontalVelocity, hitNormal);
|
||||
|
||||
const float impactThreshold = -0.3f;
|
||||
|
||||
if (!(dot < impactThreshold)) return;
|
||||
if (_dashMechanic.IsDashing)
|
||||
_dashMechanic.EndDash();
|
||||
|
||||
if (_slideMechanic.IsSliding)
|
||||
_slideMechanic.EndSlide();
|
||||
}
|
||||
|
||||
// Обработка отчета о стабильности столкновения
|
||||
public void ProcessHitStabilityReport(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint,
|
||||
Vector3 atCharacterPosition,
|
||||
Quaternion atCharacterRotation, ref HitStabilityReport hitStabilityReport)
|
||||
{
|
||||
}
|
||||
|
||||
// Обработка дискретных столкновений (для триггеров и специальных коллайдеров)
|
||||
public void OnDiscreteCollisionDetected(Collider hitCollider)
|
||||
{
|
||||
}
|
||||
|
||||
+1
-18
@@ -11,40 +11,23 @@ namespace Code.Gameplay.Character.Controller.Input
|
||||
*/
|
||||
public class CharacterInputHandler
|
||||
{
|
||||
// Косинус порогового угла для спринта (предвычислен)
|
||||
private readonly float _sprintAngleThresholdCos;
|
||||
|
||||
// Векторы движения и направления взгляда
|
||||
public Vector3 MoveInputVector { get; set; }
|
||||
public Vector3 LookInputVector { get; set; }
|
||||
|
||||
// Флаг-свойство указывающий, что активен режим спринта
|
||||
public bool IsSprinting { get; set; }
|
||||
|
||||
// Вращение камеры в FirstPerson режиме для синхронизации (только горизонтальная компонента)
|
||||
public Quaternion FirstPersonCameraRotation { get; set; }
|
||||
|
||||
// Флаг-свойство указывающий, что нужно применить вращение камеры к персонажу
|
||||
public bool ShouldApplyCameraRotation { get; private set; }
|
||||
|
||||
// Конструктор с пороговым углом
|
||||
public CharacterInputHandler(float sprintAngleThreshold)
|
||||
{
|
||||
// Предвычисляем косинус порогового угла для эффективности
|
||||
// Угол в градусах → радианы → косинус
|
||||
// Чем меньше угол — тем строже условие
|
||||
_sprintAngleThresholdCos = Mathf.Cos(Mathf.Deg2Rad * sprintAngleThreshold);
|
||||
}
|
||||
|
||||
|
||||
// Обработка и преобразование входных данных от персонажа
|
||||
public void ProcessInputs(ref CharacterInputs inputs, KinematicCharacterMotor motor)
|
||||
{
|
||||
// Сохраняем текущий режим камеры
|
||||
var currentCameraMode = inputs.CameraMode;
|
||||
|
||||
// Обработка спринта
|
||||
IsSprinting = inputs.SprintPressed && inputs.MoveAxisForward > _sprintAngleThresholdCos; // Спринт только при движении на заданный в конфиге угол
|
||||
|
||||
// Нормализация вектора движения и ограничение его величины до 1
|
||||
var moveInputVector =
|
||||
Vector3.ClampMagnitude(new Vector3(inputs.MoveAxisRight, 0, inputs.MoveAxisForward), 1f);
|
||||
|
||||
+23
-11
@@ -1,26 +1,38 @@
|
||||
using UnityEngine;
|
||||
using Code.Gameplay.Character.Controller.Input;
|
||||
using KinematicCharacterController;
|
||||
|
||||
namespace Code.Gameplay.Character.Controller.Movement
|
||||
{
|
||||
/*
|
||||
* Система движения персонажа в воздухе
|
||||
*/
|
||||
public class AirMovementSystem
|
||||
{
|
||||
// Вектор, отвечающий за применение гравитации
|
||||
private readonly Vector3 _gravity;
|
||||
|
||||
// Конструктор системы движения в воздухе
|
||||
public AirMovementSystem(Vector3 gravity)
|
||||
private readonly float _maxAirSpeed;
|
||||
private readonly float _airControlSharpness;
|
||||
|
||||
public AirMovementSystem(Vector3 gravity, float maxAirSpeed, float airControlSharpness)
|
||||
{
|
||||
_gravity = gravity;
|
||||
_maxAirSpeed = maxAirSpeed;
|
||||
_airControlSharpness = airControlSharpness;
|
||||
}
|
||||
|
||||
// Обновление скорости движения персонажа в воздухе
|
||||
public void UpdateVelocity(ref Vector3 currentVelocity, float deltaTime)
|
||||
|
||||
public void UpdateVelocity(ref Vector3 currentVelocity, CharacterInputHandler inputHandler, KinematicCharacterMotor motor, float deltaTime)
|
||||
{
|
||||
// Применяем гравитацию
|
||||
currentVelocity += _gravity * deltaTime;
|
||||
|
||||
var horizontalVelocity = Vector3.ProjectOnPlane(currentVelocity, motor.CharacterUp);
|
||||
var verticalVelocity = Vector3.Dot(currentVelocity, motor.CharacterUp) * motor.CharacterUp;
|
||||
|
||||
var desiredHorizontalMovement = Vector3.ProjectOnPlane(inputHandler.MoveInputVector, motor.CharacterUp).normalized * _maxAirSpeed;
|
||||
|
||||
horizontalVelocity = Vector3.Lerp(
|
||||
horizontalVelocity,
|
||||
desiredHorizontalMovement,
|
||||
1f - Mathf.Exp(-_airControlSharpness * deltaTime)
|
||||
);
|
||||
|
||||
currentVelocity = horizontalVelocity + verticalVelocity;
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
-7
@@ -11,8 +11,6 @@ namespace Code.Gameplay.Character.Controller.Movement
|
||||
{
|
||||
// Максимальная скорость движения по устойчивой поверхности
|
||||
private readonly float _maxStableMoveSpeed;
|
||||
// Максимальная скорость спринта
|
||||
private readonly float _sprintMoveSpeed;
|
||||
// Резкость изменения скорости движения (чем выше - тем резче)
|
||||
private readonly float _stableMovementSharpness;
|
||||
// Скорость прыжка
|
||||
@@ -22,10 +20,9 @@ namespace Code.Gameplay.Character.Controller.Movement
|
||||
public bool JumpRequested { get; private set; }
|
||||
|
||||
// Конструктор системы движения на земле
|
||||
public GroundMovementSystem(float maxStableMoveSpeed, float sprintMoveSpeed, float stableMovementSharpness, float jumpSpeed)
|
||||
public GroundMovementSystem(float maxStableMoveSpeed, float stableMovementSharpness, float jumpSpeed)
|
||||
{
|
||||
_maxStableMoveSpeed = maxStableMoveSpeed;
|
||||
_sprintMoveSpeed = sprintMoveSpeed;
|
||||
_stableMovementSharpness = stableMovementSharpness;
|
||||
_jumpSpeed = jumpSpeed;
|
||||
}
|
||||
@@ -66,8 +63,7 @@ namespace Code.Gameplay.Character.Controller.Movement
|
||||
inputHandler.MoveInputVector.magnitude;
|
||||
|
||||
// Расчет целевой скорости движения с учетом ограничения максимальной скорости и спринта
|
||||
var targetSpeed = inputHandler.IsSprinting ? _sprintMoveSpeed : _maxStableMoveSpeed;
|
||||
var targetMovementVelocity = reorientedInput * targetSpeed;
|
||||
var targetMovementVelocity = reorientedInput * _maxStableMoveSpeed;
|
||||
|
||||
// Плавная интерполяция текущей скорости к целевой с экспоненциальным сглаживанием
|
||||
currentVelocity = Vector3.Lerp(
|
||||
@@ -80,8 +76,13 @@ namespace Code.Gameplay.Character.Controller.Movement
|
||||
if (JumpRequested)
|
||||
{
|
||||
currentVelocity += motor.CharacterUp * _jumpSpeed - Vector3.Project(currentVelocity, motor.CharacterUp);
|
||||
JumpRequested = false; // Сброс сразу после применения
|
||||
JumpRequested = false;
|
||||
motor.ForceUnground();
|
||||
|
||||
if (motor.CharacterController is CustomCharacterController controller)
|
||||
{
|
||||
controller.TriggerJump();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ namespace Code.Gameplay.Character.Core
|
||||
inputs.MoveAxisForward = moveInput.y; // Vertical ось (W/S или Up/Down)
|
||||
inputs.MoveAxisRight = moveInput.x; // Horizontal ось (A/D или Left/Right)
|
||||
inputs.JumpPressed = _inputService.JumpPressed; // Прыжки (Space)
|
||||
inputs.SprintPressed = _inputService.SprintPressed; // Спринт (Shift)
|
||||
inputs.SlidePressed = _inputService.SlidePressed; // Слайд (Ctrl)
|
||||
inputs.DashPressed = _inputService.DashPressed; // Слайд (Ctrl)
|
||||
inputs.CameraMode = ((ICameraState)_cameraStateMachine.CurrentBaseState).GetCameraMode();
|
||||
|
||||
// Передаем информацию о камере для адаптивного поведения
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Code.Gameplay.Character.Core
|
||||
public CameraMode CameraMode; // Текущий режим камеры для адаптации поведения
|
||||
public Vector3 CameraPlanarDirection; // Направление камеры в горизонтальной плоскости
|
||||
public bool JumpPressed; // Флаг указывающий, нажата ли кнопка прыжка
|
||||
public bool SprintPressed; // Флаг указывающий, нажата ли кнопка спринта
|
||||
public bool DashPressed;
|
||||
public bool SlidePressed; // Флаг указывающий, нажата ли кнопка слайда
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using Code.Gameplay.Camera;
|
||||
using Code.Gameplay.Camera.CameraStates;
|
||||
using Code.Gameplay.Character.Controller;
|
||||
using Code.Gameplay.Player;
|
||||
using Code.Input;
|
||||
using Reflex.Attributes;
|
||||
using UnityEngine;
|
||||
@@ -18,6 +19,9 @@ namespace Code.Gameplay.Character.Core
|
||||
|
||||
[Inject] private IInputService _inputService; // Сервис ввода через DI
|
||||
|
||||
[SerializeField] private PlayerAnimator _animator;
|
||||
public PlayerAnimator PlayerAnimator => _animator;
|
||||
|
||||
public void Teleport(Vector3 position, Quaternion rotation)
|
||||
{
|
||||
customCharacterController.SetPosition(position);
|
||||
@@ -34,7 +38,7 @@ namespace Code.Gameplay.Character.Core
|
||||
inputs.MoveAxisForward = moveInput.y; // Vertical ось (W/S или Up/Down)
|
||||
inputs.MoveAxisRight = moveInput.x; // Horizontal ось (A/D или Left/Right)
|
||||
inputs.JumpPressed = _inputService.JumpPressed; // Прыжки (Space)
|
||||
inputs.SprintPressed = true;//_inputService.SprintPressed; // Спринт (Shift)
|
||||
inputs.DashPressed = _inputService.DashPressed;
|
||||
inputs.SlidePressed = _inputService.SlidePressed; // Слайд (Ctrl)
|
||||
inputs.CameraMode = ((ICameraState)_cameraStateMachine.CurrentBaseState).GetCameraMode();
|
||||
|
||||
|
||||
@@ -5,19 +5,44 @@ namespace Code.Gameplay.Door
|
||||
{
|
||||
public class CinematicDoorOpening
|
||||
{
|
||||
public DamnDoor DamnDoor;
|
||||
public Light DoorLight;
|
||||
private MainMenuDoor _mainMenuDoor;
|
||||
private Light _doorLight;
|
||||
|
||||
public void PreOpen(bool start)
|
||||
public CinematicDoorOpening(MainMenuDoor mainMenuDoor, Light doorLight)
|
||||
{
|
||||
DoorLight.DOColor(start ? Color.yellow : Color.red, 0.2f);
|
||||
_mainMenuDoor = mainMenuDoor;
|
||||
_doorLight = doorLight;
|
||||
}
|
||||
public void PreOpen(int type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
_doorLight.DOColor(Color.green, 0.2f);
|
||||
break;
|
||||
case 1:
|
||||
_doorLight.DOColor(Color.yellow, 0.2f);
|
||||
break;
|
||||
case 2:
|
||||
_doorLight.DOColor(Color.red, 0.2f);
|
||||
break;
|
||||
}
|
||||
|
||||
DamnDoor.Petlya.DORotate(new Vector3(0, -40, 0), 1f);
|
||||
_mainMenuDoor.Petlya.DORotate(new Vector3(0, -10, 0), 1f);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
DamnDoor.Petlya.DORotate(new Vector3(0, 0, 0), 1f);
|
||||
_mainMenuDoor.Petlya.DORotate(new Vector3(0, 0, 0), 1f);
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class MainMenuUIVariables
|
||||
{
|
||||
public MainMenuDoor MainMenuDoor;
|
||||
public Light DoorLight;
|
||||
public Color ButtonDefaultColor;
|
||||
public Color ButtonHoverColor;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Gameplay.Door
|
||||
{
|
||||
public class Door : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Transform doorPolotno;
|
||||
private Vector3 _doorInitialPosition;
|
||||
private Quaternion _doorInitialRotation;
|
||||
[SerializeField] private Transform hingeJointAnchor;
|
||||
[SerializeField] private HingeJoint hingeJoint;
|
||||
[SerializeField] private Rigidbody rigidbody;
|
||||
|
||||
public void TranslationMode(bool on)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
rigidbody.isKinematic = true;
|
||||
return;
|
||||
}
|
||||
_doorInitialPosition = doorPolotno.position;
|
||||
_doorInitialRotation = doorPolotno.rotation;
|
||||
|
||||
rigidbody.isKinematic = false;
|
||||
hingeJoint.autoConfigureConnectedAnchor = false;
|
||||
hingeJoint.connectedAnchor = hingeJointAnchor.position;
|
||||
}
|
||||
|
||||
public void CloseTheDoor()
|
||||
{
|
||||
TranslationMode(true);
|
||||
doorPolotno.DORotate(_doorInitialRotation.eulerAngles, 0.5f);
|
||||
doorPolotno.DOMove(_doorInitialPosition, 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc9fc6ce2cc24b68b2b330e4fd029b80
|
||||
timeCreated: 1764304430
|
||||
Loaded 100 of 1036 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user